added bitcoin cash js to project for address translations
This commit is contained in:
parent
b544baee11
commit
12853152af
4 changed files with 35 additions and 3 deletions
|
|
@ -138,7 +138,8 @@ module.exports = function(grunt) {
|
||||||
'bower_components/angular-mocks/angular-mocks.js',
|
'bower_components/angular-mocks/angular-mocks.js',
|
||||||
'bower_components/ngtouch/src/ngTouch.js',
|
'bower_components/ngtouch/src/ngTouch.js',
|
||||||
'angular-bitauth/angular-bitauth.js',
|
'angular-bitauth/angular-bitauth.js',
|
||||||
'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js'
|
'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js',
|
||||||
|
'bitcoin-cash-js/bitcoin-cash-js.js'
|
||||||
],
|
],
|
||||||
dest: 'www/lib/angular-components.js'
|
dest: 'www/lib/angular-components.js'
|
||||||
},
|
},
|
||||||
|
|
@ -255,7 +256,8 @@ module.exports = function(grunt) {
|
||||||
dist: {
|
dist: {
|
||||||
files: {
|
files: {
|
||||||
'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js': ['angular-bitcore-wallet-client/index.js'],
|
'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js': ['angular-bitcore-wallet-client/index.js'],
|
||||||
'angular-bitauth/angular-bitauth.js': ['angular-bitauth/index.js']
|
'angular-bitauth/angular-bitauth.js': ['angular-bitauth/index.js'],
|
||||||
|
'bitcoin-cash-js/bitcoin-cash-js.js': ['bitcoin-cash-js/index.js']
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,8 @@
|
||||||
"grunt-sass": "^1.2.0",
|
"grunt-sass": "^1.2.0",
|
||||||
"load-grunt-tasks": "^3.5.0",
|
"load-grunt-tasks": "^3.5.0",
|
||||||
"shelljs": "^0.3.0",
|
"shelljs": "^0.3.0",
|
||||||
"android-versions": "^1.2.1"
|
"android-versions": "^1.2.1",
|
||||||
|
"bitcoincashjs": "^0.1.7"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "bower install",
|
"postinstall": "bower install",
|
||||||
|
|
|
||||||
28
bitcoin-cash-js/index.js
Normal file
28
bitcoin-cash-js/index.js
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
var bitcoinCashJsModule = angular.module('bitcoinCashJsModule', []);
|
||||||
|
var bchjs = require('../node_modules/bitcoincashjs');
|
||||||
|
|
||||||
|
bitcoinCashJsModule.constant('MODULE_VERSION', '1.0.0');
|
||||||
|
|
||||||
|
bitcoinCashJsModule.provider('bitcoinCashJsService', function() {
|
||||||
|
var provider = {};
|
||||||
|
|
||||||
|
provider.$get = function() {
|
||||||
|
var service = {};
|
||||||
|
|
||||||
|
service.translateAddresses = function(address) {
|
||||||
|
const Address = bchjs.Address;
|
||||||
|
const BitpayFormat = Address.BitpayFormat;
|
||||||
|
const CashAddrFormat = Address.CashAddrFormat;
|
||||||
|
var result = new Address(address);
|
||||||
|
return {
|
||||||
|
'legacy': result.toString(),
|
||||||
|
'bitpay': result.toString(BitpayFormat),
|
||||||
|
'cashaddr': result.toString(CashAddrFormat)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
return provider;
|
||||||
|
});
|
||||||
|
|
@ -13,6 +13,7 @@ var modules = [
|
||||||
'angular-md5',
|
'angular-md5',
|
||||||
'bwcModule',
|
'bwcModule',
|
||||||
'bitauthModule',
|
'bitauthModule',
|
||||||
|
'bitcoinCashJsModule',
|
||||||
'copayApp.filters',
|
'copayApp.filters',
|
||||||
'copayApp.services',
|
'copayApp.services',
|
||||||
'copayApp.controllers',
|
'copayApp.controllers',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue