mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-18 19:25:48 +00:00
Initial import
This commit is contained in:
63
packages/ripple-address-codec/.gitignore
vendored
Normal file
63
packages/ripple-address-codec/.gitignore
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
# .gitignore
|
||||
|
||||
# Ignore vim swap files.
|
||||
*.swp
|
||||
|
||||
# Ignore SCons support files.
|
||||
.sconsign.dblite
|
||||
|
||||
# Ignore python compiled files.
|
||||
*.pyc
|
||||
|
||||
# Ignore Macintosh Desktop Services Store files.
|
||||
.DS_Store
|
||||
|
||||
# Ignore backup/temps
|
||||
*~
|
||||
|
||||
# Ignore object files.
|
||||
*.o
|
||||
build/
|
||||
tags
|
||||
bin/rippled
|
||||
Debug/*.*
|
||||
Release/*.*
|
||||
|
||||
# Ignore locally installed node_modules
|
||||
node_modules
|
||||
!test/node_modules
|
||||
|
||||
# Ignore tmp directory.
|
||||
tmp
|
||||
|
||||
# Ignore database directory.
|
||||
db/*.db
|
||||
db/*.db-*
|
||||
|
||||
# Ignore customized configs
|
||||
rippled.cfg
|
||||
validators.txt
|
||||
test/config.js
|
||||
|
||||
# Ignore coverage files
|
||||
/lib-cov
|
||||
/src-cov
|
||||
/coverage.html
|
||||
/coverage
|
||||
|
||||
# Ignore IntelliJ files
|
||||
.idea
|
||||
|
||||
# Ignore npm-debug
|
||||
npm-debug.log
|
||||
|
||||
# Ignore dist folder, build for bower
|
||||
dist/
|
||||
|
||||
# Ignore flow output directory
|
||||
out/
|
||||
|
||||
# Ignore perf test cache
|
||||
scripts/cache
|
||||
|
||||
eslintrc
|
||||
30
packages/ripple-address-codec/index.js
Normal file
30
packages/ripple-address-codec/index.js
Normal file
@@ -0,0 +1,30 @@
|
||||
var hashjs = require('hash.js');
|
||||
var apiFactory = require('coin-address-codec');
|
||||
|
||||
var VER_NODE_PUBLIC = 28;
|
||||
var VER_NODE_PRIVATE = 32;
|
||||
var VER_ACCOUNT_ID = 0;
|
||||
var VER_FAMILY_SEED = 33;
|
||||
|
||||
function sha256(bytes) {
|
||||
return hashjs.sha256().update(bytes).digest();
|
||||
}
|
||||
|
||||
var api = apiFactory({sha256: sha256, defaultAlphabet: 'ripple'});
|
||||
|
||||
function addVersion(name, version) {
|
||||
function add(symbol, func) {
|
||||
api[symbol+name] = function(string) {
|
||||
return api[symbol](string, {version: version});
|
||||
}
|
||||
}
|
||||
add('decode')
|
||||
add('encode')
|
||||
}
|
||||
|
||||
addVersion('Seed', VER_FAMILY_SEED);
|
||||
addVersion('AccountID', VER_ACCOUNT_ID);
|
||||
addVersion('NodePublic', VER_NODE_PUBLIC);
|
||||
addVersion('NodePrivate', VER_NODE_PRIVATE);
|
||||
|
||||
module.exports = api;
|
||||
14
packages/ripple-address-codec/package.json
Normal file
14
packages/ripple-address-codec/package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "ripple-address-codec",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"hash.js": "^1.0.3"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user