@bitpay-labs/crypto-wallet-core 11.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/package.json +58 -0
- package/src/constants/address.ts +7 -0
- package/src/constants/algorithms.ts +9 -0
- package/src/constants/chains.ts +64 -0
- package/src/constants/feeMinimums.ts +20 -0
- package/src/constants/index.ts +37 -0
- package/src/constants/tokens.ts +224 -0
- package/src/constants/units.ts +289 -0
- package/src/derivation/arb/index.ts +3 -0
- package/src/derivation/base/index.ts +3 -0
- package/src/derivation/bch/index.ts +11 -0
- package/src/derivation/btc/index.ts +39 -0
- package/src/derivation/doge/index.ts +6 -0
- package/src/derivation/eth/index.ts +58 -0
- package/src/derivation/index.ts +124 -0
- package/src/derivation/ltc/index.ts +6 -0
- package/src/derivation/matic/index.ts +3 -0
- package/src/derivation/op/index.ts +3 -0
- package/src/derivation/paths.ts +42 -0
- package/src/derivation/sol/index.ts +57 -0
- package/src/derivation/xrp/index.ts +38 -0
- package/src/index.ts +48 -0
- package/src/message/btc.ts +28 -0
- package/src/message/eth.ts +47 -0
- package/src/message/index.ts +70 -0
- package/src/message/sol.ts +3 -0
- package/src/message/xrp.ts +4 -0
- package/src/transactions/arb/index.ts +14 -0
- package/src/transactions/base/index.ts +13 -0
- package/src/transactions/bch/index.ts +25 -0
- package/src/transactions/btc/index.ts +227 -0
- package/src/transactions/doge/index.ts +31 -0
- package/src/transactions/erc20/abi.ts +418 -0
- package/src/transactions/erc20/index.ts +57 -0
- package/src/transactions/eth/index.ts +183 -0
- package/src/transactions/eth-multisig/abi.ts +724 -0
- package/src/transactions/eth-multisig/index.ts +172 -0
- package/src/transactions/index.ts +83 -0
- package/src/transactions/ltc/index.ts +31 -0
- package/src/transactions/matic/index.ts +14 -0
- package/src/transactions/matic-multisig/index.ts +172 -0
- package/src/transactions/op/index.ts +14 -0
- package/src/transactions/sol/index.ts +292 -0
- package/src/transactions/spl/index.ts +192 -0
- package/src/transactions/xrp/index.ts +129 -0
- package/src/types/derivation.ts +17 -0
- package/src/types/index.ts +3 -0
- package/src/types/message.ts +15 -0
- package/src/types/utils.ts +1 -0
- package/src/types/validation.ts +4 -0
- package/src/utils/bigint.ts +238 -0
- package/src/utils/index.ts +94 -0
- package/src/validation/arb/index.ts +8 -0
- package/src/validation/base/index.ts +8 -0
- package/src/validation/bch/index.ts +17 -0
- package/src/validation/btc/index.ts +17 -0
- package/src/validation/doge/index.ts +16 -0
- package/src/validation/eth/index.ts +29 -0
- package/src/validation/index.ts +43 -0
- package/src/validation/ltc/index.ts +16 -0
- package/src/validation/matic/index.ts +8 -0
- package/src/validation/op/index.ts +8 -0
- package/src/validation/sol/index.ts +34 -0
- package/src/validation/xrp/index.ts +50 -0
- package/test/address.test.ts +178 -0
- package/test/bigint.test.ts +373 -0
- package/test/transactions.test.ts +1777 -0
- package/test/utils.test.ts +121 -0
- package/test/validation.test.ts +261 -0
- package/ts_build/src/constants/address.d.ts +8 -0
- package/ts_build/src/constants/address.d.ts.map +1 -0
- package/ts_build/src/constants/address.js +11 -0
- package/ts_build/src/constants/address.js.map +1 -0
- package/ts_build/src/constants/algorithms.d.ts +9 -0
- package/ts_build/src/constants/algorithms.d.ts.map +1 -0
- package/ts_build/src/constants/algorithms.js +12 -0
- package/ts_build/src/constants/algorithms.js.map +1 -0
- package/ts_build/src/constants/chains.d.ts +42 -0
- package/ts_build/src/constants/chains.d.ts.map +1 -0
- package/ts_build/src/constants/chains.js +54 -0
- package/ts_build/src/constants/chains.js.map +1 -0
- package/ts_build/src/constants/feeMinimums.d.ts +21 -0
- package/ts_build/src/constants/feeMinimums.d.ts.map +1 -0
- package/ts_build/src/constants/feeMinimums.js +24 -0
- package/ts_build/src/constants/feeMinimums.js.map +1 -0
- package/ts_build/src/constants/index.d.ts +569 -0
- package/ts_build/src/constants/index.d.ts.map +1 -0
- package/ts_build/src/constants/index.js +31 -0
- package/ts_build/src/constants/index.js.map +1 -0
- package/ts_build/src/constants/tokens.d.ts +423 -0
- package/ts_build/src/constants/tokens.d.ts.map +1 -0
- package/ts_build/src/constants/tokens.js +222 -0
- package/ts_build/src/constants/tokens.js.map +1 -0
- package/ts_build/src/constants/units.d.ts +289 -0
- package/ts_build/src/constants/units.d.ts.map +1 -0
- package/ts_build/src/constants/units.js +292 -0
- package/ts_build/src/constants/units.js.map +1 -0
- package/ts_build/src/derivation/arb/index.d.ts +4 -0
- package/ts_build/src/derivation/arb/index.d.ts.map +1 -0
- package/ts_build/src/derivation/arb/index.js +8 -0
- package/ts_build/src/derivation/arb/index.js.map +1 -0
- package/ts_build/src/derivation/base/index.d.ts +4 -0
- package/ts_build/src/derivation/base/index.d.ts.map +1 -0
- package/ts_build/src/derivation/base/index.js +8 -0
- package/ts_build/src/derivation/base/index.js.map +1 -0
- package/ts_build/src/derivation/bch/index.d.ts +6 -0
- package/ts_build/src/derivation/bch/index.d.ts.map +1 -0
- package/ts_build/src/derivation/bch/index.js +17 -0
- package/ts_build/src/derivation/bch/index.js.map +1 -0
- package/ts_build/src/derivation/btc/index.d.ts +23 -0
- package/ts_build/src/derivation/btc/index.d.ts.map +1 -0
- package/ts_build/src/derivation/btc/index.js +40 -0
- package/ts_build/src/derivation/btc/index.js.map +1 -0
- package/ts_build/src/derivation/doge/index.d.ts +5 -0
- package/ts_build/src/derivation/doge/index.d.ts.map +1 -0
- package/ts_build/src/derivation/doge/index.js +13 -0
- package/ts_build/src/derivation/doge/index.js.map +1 -0
- package/ts_build/src/derivation/eth/index.d.ts +21 -0
- package/ts_build/src/derivation/eth/index.d.ts.map +1 -0
- package/ts_build/src/derivation/eth/index.js +58 -0
- package/ts_build/src/derivation/eth/index.js.map +1 -0
- package/ts_build/src/derivation/index.d.ts +12 -0
- package/ts_build/src/derivation/index.d.ts.map +1 -0
- package/ts_build/src/derivation/index.js +68 -0
- package/ts_build/src/derivation/index.js.map +1 -0
- package/ts_build/src/derivation/ltc/index.d.ts +5 -0
- package/ts_build/src/derivation/ltc/index.d.ts.map +1 -0
- package/ts_build/src/derivation/ltc/index.js +13 -0
- package/ts_build/src/derivation/ltc/index.js.map +1 -0
- package/ts_build/src/derivation/matic/index.d.ts +4 -0
- package/ts_build/src/derivation/matic/index.d.ts.map +1 -0
- package/ts_build/src/derivation/matic/index.js +8 -0
- package/ts_build/src/derivation/matic/index.js.map +1 -0
- package/ts_build/src/derivation/op/index.d.ts +4 -0
- package/ts_build/src/derivation/op/index.d.ts.map +1 -0
- package/ts_build/src/derivation/op/index.js +8 -0
- package/ts_build/src/derivation/op/index.js.map +1 -0
- package/ts_build/src/derivation/paths.d.ts +43 -0
- package/ts_build/src/derivation/paths.d.ts.map +1 -0
- package/ts_build/src/derivation/paths.js +46 -0
- package/ts_build/src/derivation/paths.js.map +1 -0
- package/ts_build/src/derivation/sol/index.d.ts +17 -0
- package/ts_build/src/derivation/sol/index.d.ts.map +1 -0
- package/ts_build/src/derivation/sol/index.js +85 -0
- package/ts_build/src/derivation/sol/index.js.map +1 -0
- package/ts_build/src/derivation/xrp/index.d.ts +19 -0
- package/ts_build/src/derivation/xrp/index.d.ts.map +1 -0
- package/ts_build/src/derivation/xrp/index.js +40 -0
- package/ts_build/src/derivation/xrp/index.js.map +1 -0
- package/ts_build/src/index.d.ts +30 -0
- package/ts_build/src/index.d.ts.map +1 -0
- package/ts_build/src/index.js +81 -0
- package/ts_build/src/index.js.map +1 -0
- package/ts_build/src/message/btc.d.ts +19 -0
- package/ts_build/src/message/btc.d.ts.map +1 -0
- package/ts_build/src/message/btc.js +32 -0
- package/ts_build/src/message/btc.js.map +1 -0
- package/ts_build/src/message/eth.d.ts +19 -0
- package/ts_build/src/message/eth.d.ts.map +1 -0
- package/ts_build/src/message/eth.js +39 -0
- package/ts_build/src/message/eth.js.map +1 -0
- package/ts_build/src/message/index.d.ts +25 -0
- package/ts_build/src/message/index.d.ts.map +1 -0
- package/ts_build/src/message/index.js +50 -0
- package/ts_build/src/message/index.js.map +1 -0
- package/ts_build/src/message/sol.d.ts +4 -0
- package/ts_build/src/message/sol.d.ts.map +1 -0
- package/ts_build/src/message/sol.js +9 -0
- package/ts_build/src/message/sol.js.map +1 -0
- package/ts_build/src/message/xrp.d.ts +4 -0
- package/ts_build/src/message/xrp.d.ts.map +1 -0
- package/ts_build/src/message/xrp.js +9 -0
- package/ts_build/src/message/xrp.js.map +1 -0
- package/ts_build/src/transactions/arb/index.d.ts +9 -0
- package/ts_build/src/transactions/arb/index.d.ts.map +1 -0
- package/ts_build/src/transactions/arb/index.js +18 -0
- package/ts_build/src/transactions/arb/index.js.map +1 -0
- package/ts_build/src/transactions/base/index.d.ts +8 -0
- package/ts_build/src/transactions/base/index.d.ts.map +1 -0
- package/ts_build/src/transactions/base/index.js +17 -0
- package/ts_build/src/transactions/base/index.js.map +1 -0
- package/ts_build/src/transactions/bch/index.d.ts +12 -0
- package/ts_build/src/transactions/bch/index.d.ts.map +1 -0
- package/ts_build/src/transactions/bch/index.js +32 -0
- package/ts_build/src/transactions/bch/index.js.map +1 -0
- package/ts_build/src/transactions/btc/index.d.ts +84 -0
- package/ts_build/src/transactions/btc/index.d.ts.map +1 -0
- package/ts_build/src/transactions/btc/index.js +184 -0
- package/ts_build/src/transactions/btc/index.js.map +1 -0
- package/ts_build/src/transactions/doge/index.d.ts +12 -0
- package/ts_build/src/transactions/doge/index.d.ts.map +1 -0
- package/ts_build/src/transactions/doge/index.js +38 -0
- package/ts_build/src/transactions/doge/index.js.map +1 -0
- package/ts_build/src/transactions/erc20/abi.d.ts +78 -0
- package/ts_build/src/transactions/erc20/abi.d.ts.map +1 -0
- package/ts_build/src/transactions/erc20/abi.js +421 -0
- package/ts_build/src/transactions/erc20/abi.js.map +1 -0
- package/ts_build/src/transactions/erc20/index.d.ts +29 -0
- package/ts_build/src/transactions/erc20/index.d.ts.map +1 -0
- package/ts_build/src/transactions/erc20/index.js +46 -0
- package/ts_build/src/transactions/erc20/index.js.map +1 -0
- package/ts_build/src/transactions/eth/index.d.ts +53 -0
- package/ts_build/src/transactions/eth/index.d.ts.map +1 -0
- package/ts_build/src/transactions/eth/index.js +156 -0
- package/ts_build/src/transactions/eth/index.js.map +1 -0
- package/ts_build/src/transactions/eth-multisig/abi.d.ts +51 -0
- package/ts_build/src/transactions/eth-multisig/abi.d.ts.map +1 -0
- package/ts_build/src/transactions/eth-multisig/abi.js +728 -0
- package/ts_build/src/transactions/eth-multisig/abi.js.map +1 -0
- package/ts_build/src/transactions/eth-multisig/index.d.ts +65 -0
- package/ts_build/src/transactions/eth-multisig/index.d.ts.map +1 -0
- package/ts_build/src/transactions/eth-multisig/index.js +143 -0
- package/ts_build/src/transactions/eth-multisig/index.js.map +1 -0
- package/ts_build/src/transactions/index.d.ts +15 -0
- package/ts_build/src/transactions/index.d.ts.map +1 -0
- package/ts_build/src/transactions/index.js +69 -0
- package/ts_build/src/transactions/index.js.map +1 -0
- package/ts_build/src/transactions/ltc/index.d.ts +12 -0
- package/ts_build/src/transactions/ltc/index.d.ts.map +1 -0
- package/ts_build/src/transactions/ltc/index.js +38 -0
- package/ts_build/src/transactions/ltc/index.js.map +1 -0
- package/ts_build/src/transactions/matic/index.d.ts +9 -0
- package/ts_build/src/transactions/matic/index.d.ts.map +1 -0
- package/ts_build/src/transactions/matic/index.js +18 -0
- package/ts_build/src/transactions/matic/index.js.map +1 -0
- package/ts_build/src/transactions/matic-multisig/index.d.ts +65 -0
- package/ts_build/src/transactions/matic-multisig/index.d.ts.map +1 -0
- package/ts_build/src/transactions/matic-multisig/index.js +143 -0
- package/ts_build/src/transactions/matic-multisig/index.js.map +1 -0
- package/ts_build/src/transactions/op/index.d.ts +9 -0
- package/ts_build/src/transactions/op/index.d.ts.map +1 -0
- package/ts_build/src/transactions/op/index.js +18 -0
- package/ts_build/src/transactions/op/index.js.map +1 -0
- package/ts_build/src/transactions/sol/index.d.ts +56 -0
- package/ts_build/src/transactions/sol/index.d.ts.map +1 -0
- package/ts_build/src/transactions/sol/index.js +261 -0
- package/ts_build/src/transactions/sol/index.js.map +1 -0
- package/ts_build/src/transactions/spl/index.d.ts +57 -0
- package/ts_build/src/transactions/spl/index.d.ts.map +1 -0
- package/ts_build/src/transactions/spl/index.js +129 -0
- package/ts_build/src/transactions/spl/index.js.map +1 -0
- package/ts_build/src/transactions/xrp/index.d.ts +50 -0
- package/ts_build/src/transactions/xrp/index.d.ts.map +1 -0
- package/ts_build/src/transactions/xrp/index.js +146 -0
- package/ts_build/src/transactions/xrp/index.js.map +1 -0
- package/ts_build/src/types/derivation.d.ts +13 -0
- package/ts_build/src/types/derivation.d.ts.map +1 -0
- package/ts_build/src/types/derivation.js +3 -0
- package/ts_build/src/types/derivation.js.map +1 -0
- package/ts_build/src/types/index.d.ts +4 -0
- package/ts_build/src/types/index.d.ts.map +1 -0
- package/ts_build/src/types/index.js +40 -0
- package/ts_build/src/types/index.js.map +1 -0
- package/ts_build/src/types/message.d.ts +26 -0
- package/ts_build/src/types/message.d.ts.map +1 -0
- package/ts_build/src/types/message.js +3 -0
- package/ts_build/src/types/message.js.map +1 -0
- package/ts_build/src/types/utils.d.ts +2 -0
- package/ts_build/src/types/utils.d.ts.map +1 -0
- package/ts_build/src/types/utils.js +3 -0
- package/ts_build/src/types/utils.js.map +1 -0
- package/ts_build/src/types/validation.d.ts +5 -0
- package/ts_build/src/types/validation.d.ts.map +1 -0
- package/ts_build/src/types/validation.js +3 -0
- package/ts_build/src/types/validation.js.map +1 -0
- package/ts_build/src/utils/bigint.d.ts +14 -0
- package/ts_build/src/utils/bigint.d.ts.map +1 -0
- package/ts_build/src/utils/bigint.js +165 -0
- package/ts_build/src/utils/bigint.js.map +1 -0
- package/ts_build/src/utils/index.d.ts +12 -0
- package/ts_build/src/utils/index.d.ts.map +1 -0
- package/ts_build/src/utils/index.js +118 -0
- package/ts_build/src/utils/index.js.map +1 -0
- package/ts_build/src/validation/arb/index.d.ts +5 -0
- package/ts_build/src/validation/arb/index.d.ts.map +1 -0
- package/ts_build/src/validation/arb/index.js +12 -0
- package/ts_build/src/validation/arb/index.js.map +1 -0
- package/ts_build/src/validation/base/index.d.ts +5 -0
- package/ts_build/src/validation/base/index.d.ts.map +1 -0
- package/ts_build/src/validation/base/index.js +12 -0
- package/ts_build/src/validation/base/index.js.map +1 -0
- package/ts_build/src/validation/bch/index.d.ts +6 -0
- package/ts_build/src/validation/bch/index.d.ts.map +1 -0
- package/ts_build/src/validation/bch/index.js +19 -0
- package/ts_build/src/validation/bch/index.js.map +1 -0
- package/ts_build/src/validation/btc/index.d.ts +6 -0
- package/ts_build/src/validation/btc/index.d.ts.map +1 -0
- package/ts_build/src/validation/btc/index.js +19 -0
- package/ts_build/src/validation/btc/index.js.map +1 -0
- package/ts_build/src/validation/doge/index.d.ts +6 -0
- package/ts_build/src/validation/doge/index.d.ts.map +1 -0
- package/ts_build/src/validation/doge/index.js +19 -0
- package/ts_build/src/validation/doge/index.js.map +1 -0
- package/ts_build/src/validation/eth/index.d.ts +9 -0
- package/ts_build/src/validation/eth/index.d.ts.map +1 -0
- package/ts_build/src/validation/eth/index.js +28 -0
- package/ts_build/src/validation/eth/index.js.map +1 -0
- package/ts_build/src/validation/index.d.ts +9 -0
- package/ts_build/src/validation/index.d.ts.map +1 -0
- package/ts_build/src/validation/index.js +42 -0
- package/ts_build/src/validation/index.js.map +1 -0
- package/ts_build/src/validation/ltc/index.d.ts +6 -0
- package/ts_build/src/validation/ltc/index.d.ts.map +1 -0
- package/ts_build/src/validation/ltc/index.js +19 -0
- package/ts_build/src/validation/ltc/index.js.map +1 -0
- package/ts_build/src/validation/matic/index.d.ts +5 -0
- package/ts_build/src/validation/matic/index.d.ts.map +1 -0
- package/ts_build/src/validation/matic/index.js +12 -0
- package/ts_build/src/validation/matic/index.js.map +1 -0
- package/ts_build/src/validation/op/index.d.ts +5 -0
- package/ts_build/src/validation/op/index.d.ts.map +1 -0
- package/ts_build/src/validation/op/index.js +12 -0
- package/ts_build/src/validation/op/index.js.map +1 -0
- package/ts_build/src/validation/sol/index.d.ts +9 -0
- package/ts_build/src/validation/sol/index.d.ts.map +1 -0
- package/ts_build/src/validation/sol/index.js +34 -0
- package/ts_build/src/validation/sol/index.js.map +1 -0
- package/ts_build/src/validation/xrp/index.d.ts +7 -0
- package/ts_build/src/validation/xrp/index.d.ts.map +1 -0
- package/ts_build/src/validation/xrp/index.js +50 -0
- package/ts_build/src/validation/xrp/index.js.map +1 -0
- package/ts_build/test/address.test.d.ts +2 -0
- package/ts_build/test/address.test.d.ts.map +1 -0
- package/ts_build/test/address.test.js +139 -0
- package/ts_build/test/address.test.js.map +1 -0
- package/ts_build/test/bigint.test.d.ts +2 -0
- package/ts_build/test/bigint.test.d.ts.map +1 -0
- package/ts_build/test/bigint.test.js +298 -0
- package/ts_build/test/bigint.test.js.map +1 -0
- package/ts_build/test/transactions.test.d.ts +2 -0
- package/ts_build/test/transactions.test.d.ts.map +1 -0
- package/ts_build/test/transactions.test.js +1549 -0
- package/ts_build/test/transactions.test.js.map +1 -0
- package/ts_build/test/utils.test.d.ts +2 -0
- package/ts_build/test/utils.test.d.ts.map +1 -0
- package/ts_build/test/utils.test.js +137 -0
- package/ts_build/test/utils.test.js.map +1 -0
- package/ts_build/test/validation.test.d.ts +2 -0
- package/ts_build/test/validation.test.d.ts.map +1 -0
- package/ts_build/test/validation.test.js +210 -0
- package/ts_build/test/validation.test.js.map +1 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import * as utils from '../src/utils';
|
|
3
|
+
|
|
4
|
+
describe('Utils', function() {
|
|
5
|
+
describe('isHexString', function() {
|
|
6
|
+
it('should return true for valid prefixed hex string', function() {
|
|
7
|
+
const str = '0xabcdef123456';
|
|
8
|
+
const result = utils.isHexString(str);
|
|
9
|
+
expect(result).to.be.true;
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should return true for valid non-prefixed hex string', function() {
|
|
13
|
+
const str = 'abcdef123456';
|
|
14
|
+
const result = utils.isHexString(str);
|
|
15
|
+
expect(result).to.be.true;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should return false for invalid prefixed hex string', function() {
|
|
19
|
+
const str = '0xabc123g';
|
|
20
|
+
const result = utils.isHexString(str);
|
|
21
|
+
expect(result).to.be.false;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should return false for string with 0x somewhere in the middle', function() {
|
|
25
|
+
const str = 'abc0x123';
|
|
26
|
+
const result = utils.isHexString(str);
|
|
27
|
+
expect(result).to.be.false;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should return false for invalid non-prefixed hex string', function() {
|
|
31
|
+
const str = 'abc123g';
|
|
32
|
+
const result = utils.isHexString(str);
|
|
33
|
+
expect(result).to.be.false;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should return false for empty string', function() {
|
|
37
|
+
const str = '';
|
|
38
|
+
const result = utils.isHexString(str);
|
|
39
|
+
expect(result).to.be.false;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should return false for null/undefined input', function() {
|
|
43
|
+
expect(utils.isHexString(null)).to.be.false;
|
|
44
|
+
expect(utils.isHexString(undefined as any)).to.be.false;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should return false for non-string input', function() {
|
|
48
|
+
expect(utils.isHexString(123 as any)).to.be.false;
|
|
49
|
+
expect(utils.isHexString({} as any)).to.be.false;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should return false for octal string', function() {
|
|
53
|
+
const str = '0o01234567';
|
|
54
|
+
const result = utils.isHexString(str);
|
|
55
|
+
expect(result).to.be.false;
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('toHex', function() {
|
|
60
|
+
it('should convert number to hex string', function() {
|
|
61
|
+
const input = 255;
|
|
62
|
+
const result = utils.toHex(input);
|
|
63
|
+
expect(result).to.equal('0xff');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should convert bigint to hex string', function() {
|
|
67
|
+
const input = BigInt('12345678901234567890');
|
|
68
|
+
const result = utils.toHex(input);
|
|
69
|
+
expect(result).to.equal('0xab54a98ceb1f0ad2');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should convert number string to hex string', function() {
|
|
73
|
+
const input = '4095';
|
|
74
|
+
const result = utils.toHex(input);
|
|
75
|
+
expect(result).to.equal('0xfff');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should convert prefixed hex string to hex string', function() {
|
|
79
|
+
const input = '0xabcdef';
|
|
80
|
+
const result = utils.toHex(input);
|
|
81
|
+
expect(result).to.equal('0xabcdef');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('should convert non-prefixed hex string to hex string', function() {
|
|
85
|
+
const input = 'abcdef';
|
|
86
|
+
const result = utils.toHex(input);
|
|
87
|
+
expect(result).to.equal('0xabcdef');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should convert octal string to hex string', function() {
|
|
91
|
+
const input = '0o17';
|
|
92
|
+
const result = utils.toHex(input);
|
|
93
|
+
expect(result).to.equal('0xf');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('should throw error for invalid string input', function() {
|
|
97
|
+
const input = 'notanumber';
|
|
98
|
+
expect(() => utils.toHex(input)).to.throw('Invalid input for toHex: notanumber');
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('should throw error for unsupported input type', function() {
|
|
102
|
+
const input = { key: 'value' };
|
|
103
|
+
expect(() => utils.toHex(input as any)).to.throw('Input for toHex must be a number, string (non-empty), or bigint. Got typeof object');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('should throw error for empty string input', function() {
|
|
107
|
+
const input = '';
|
|
108
|
+
expect(() => utils.toHex(input)).to.throw('Input for toHex must be a number, string (non-empty), or bigint. Got ""');
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('should throw error for null/undefined input', function() {
|
|
112
|
+
expect(() => utils.toHex(null as any)).to.throw('Input for toHex must be a number, string (non-empty), or bigint. Got null');
|
|
113
|
+
expect(() => utils.toHex(undefined as any)).to.throw('Input for toHex must be a number, string (non-empty), or bigint. Got undefined');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should throw error for NaN input', function() {
|
|
117
|
+
const input = NaN;
|
|
118
|
+
expect(() => utils.toHex(input)).to.throw('Invalid input for toHex: NaN');
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
});
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
import { Validation } from '../src';
|
|
4
|
+
|
|
5
|
+
describe('Address Validation', () => {
|
|
6
|
+
// BTC
|
|
7
|
+
const btcAddress = '1NuKwkDtCymgA1FNLUBaUWLD8s4kdKWvgn';
|
|
8
|
+
const btcTestAddress = 'mkUNMewkQsHKRcUvv5HLKbqmepCqNH8goc';
|
|
9
|
+
|
|
10
|
+
// BCH
|
|
11
|
+
const bchAddress = 'qr8uujscckc56ancdkmqnyyl2rx6pnp24gmdfrf8qd';
|
|
12
|
+
const bchTestLegacyAddress = 'mms6yCDGo3fDdapguTSMtCyF9XGfWJpD6H';
|
|
13
|
+
|
|
14
|
+
// DOGE
|
|
15
|
+
const dogeAddress = 'DQnSpKaUdXYZz8Q4WUBCdaGBSthiAJbWBr';
|
|
16
|
+
const dogeTestAddress = 'nY525SPsHXVopmUMm1JyReDEop45MSWc3D';
|
|
17
|
+
|
|
18
|
+
// LTC
|
|
19
|
+
const ltcAddress = 'LYgDcZ3oW3aZBhZUyiC84fb99hyUPVxLwB';
|
|
20
|
+
const ltcTestAddress = 'QhpBFbYvLG2bgCZ3D1ztGEUVqmcgY5vjVF';
|
|
21
|
+
|
|
22
|
+
// ETH
|
|
23
|
+
const ethAddress = '37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A';
|
|
24
|
+
const prefixEthAddress = '0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A';
|
|
25
|
+
|
|
26
|
+
// MATIC
|
|
27
|
+
const maticAddress = '37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A';
|
|
28
|
+
const prefixMaticAddress = '0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A';
|
|
29
|
+
|
|
30
|
+
// XRP
|
|
31
|
+
const xrpAddress = 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh';
|
|
32
|
+
|
|
33
|
+
// SOL
|
|
34
|
+
const solAddress = '7EWwMxKQa5Gru7oTcS1Wi3AaEgTfA6MU3z7MaLUT6hnD';
|
|
35
|
+
|
|
36
|
+
// Uri
|
|
37
|
+
const btcUri = 'bitcoin:1NuKwkDtCymgA1FNLUBaUWLD8s4kdKWvgn';
|
|
38
|
+
const bchUri = 'bitcoincash:pp8skudq3x5hzw8ew7vzsw8tn4k8wxsqsv0lt0mf3g';
|
|
39
|
+
const dogeUri = 'dogecoin:DQnSpKaUdXYZz8Q4WUBCdaGBSthiAJbWBr';
|
|
40
|
+
const ltcUri = 'litecoin:LYgDcZ3oW3aZBhZUyiC84fb99hyUPVxLwB';
|
|
41
|
+
const ethUri = 'ethereum:0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A';
|
|
42
|
+
const ethUriParams = 'ethereum:0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A?value=123&gasPrice=123&gas=123&gasLimit=123';
|
|
43
|
+
const ethUriSingleParam = 'ethereum:0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A?value=123';
|
|
44
|
+
const btcTestUri = 'bitcoin:mkUNMewkQsHKRcUvv5HLKbqmepCqNH8goc';
|
|
45
|
+
const bchTestUri = 'bchtest:qq083kgf3wjg7ya8nun36e8nf24g9xgvachahfnyle';
|
|
46
|
+
const dogeTestUri = 'dogecoin:mpz836YMHb7Ubjx4G2YnutwQRd1yz5ssNv';
|
|
47
|
+
const ltcTestUri = 'litecoin:QhpBFbYvLG2bgCZ3D1ztGEUVqmcgY5vjVF';
|
|
48
|
+
const xrpUri = 'ripple:rEqj9WKSH7wEkPvWf6b4gCi26Y3F7HbKUF';
|
|
49
|
+
const xrpUriParams = 'ripple:rEqj9WKSH7wEkPvWf6b4gCi26Y3F7HbKUF?amount=123456&dt=123456';
|
|
50
|
+
const xrpUriSingleParam = 'ripple:rEqj9WKSH7wEkPvWf6b4gCi26Y3F7HbKUF?amount=123456';
|
|
51
|
+
const maticUri = 'matic:0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A';
|
|
52
|
+
const maticUriParams = 'matic:0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A?value=123&gasPrice=123&gas=123&gasLimit=123';
|
|
53
|
+
const maticUriSingleParam = 'matic:0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A?value=123';
|
|
54
|
+
const solUri = 'solana:7EWwMxKQa5Gru7oTcS1Wi3AaEgTfA6MU3z7MaLUT6hnD';
|
|
55
|
+
|
|
56
|
+
// Invalid Address
|
|
57
|
+
const invalidBtcAddress = '1NuKwkDtCymgA1FNLUBaUWLD8s4kKWvgn';
|
|
58
|
+
const invalidBchAddress = 'r8uujscckc56ancdkmqnyyl2rx6pnp24gmdfrf8qd';
|
|
59
|
+
const invalidDogeAddress = 'DQnSpKaUdXYZz8Q4WUBCdaGBSthiAJbWB';
|
|
60
|
+
const invalidLtcAddress = 'LYgDcZ3oW3aZBhZUyiC84fb99hyUPVxLw';
|
|
61
|
+
const invalidEthAddress = '37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08';
|
|
62
|
+
const invalidXrpAddress = 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTH';
|
|
63
|
+
const invalidMaticAddress = '57d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08';
|
|
64
|
+
const invalidSolAddress = '7EWwMxKQa5Gru7oTcS1Wi3AaEgTfA6MU3z7MaLUT6hn0';
|
|
65
|
+
|
|
66
|
+
// Invalid Uri
|
|
67
|
+
const invalidEthPrefix = '0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A';
|
|
68
|
+
const invalidXrpPrefix = 'rEqj9WKSH7wEkPvWf6b4gCi26Y3F7HbKUF';
|
|
69
|
+
const invalidMaticPrefix = '0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A';
|
|
70
|
+
const invalidEthUriParams = 'ethereum:0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A?value=invalid&gasLimit=123&gas=123';
|
|
71
|
+
const invalidXrpUriParams = 'ripple:rEqj9WKSH7wEkPvWf6b4gCi26Y3F7HbKUF?amount=invalid&dt=123';
|
|
72
|
+
const invalidMaticUriParams = 'matic:0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A?value=invalid&gasLimit=123&gas=123';
|
|
73
|
+
const invalidSolUri = 'solana:7EWwMxKQa5Gru7oTcS1Wi3AaEgTfA6MU3z7MaLUT6hn0';
|
|
74
|
+
|
|
75
|
+
it('should be able to validate an BTC address', async () => {
|
|
76
|
+
const isValidAddress = await Validation.validateAddress('BTC', 'mainnet', btcAddress);
|
|
77
|
+
const isValidTestAddress = await Validation.validateAddress('BTC', 'testnet', btcTestAddress);
|
|
78
|
+
expect(isValidAddress).to.equal(true);
|
|
79
|
+
expect(isValidTestAddress).to.equal(true);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('should be able to validate an BCH address', async () => {
|
|
83
|
+
const isValidAddress = await Validation.validateAddress('BCH', 'mainnet', bchAddress);
|
|
84
|
+
const isValidTestLegacyAddress = await Validation.validateAddress('BCH', 'testnet', bchTestLegacyAddress);
|
|
85
|
+
expect(isValidAddress).to.equal(true);
|
|
86
|
+
expect(isValidTestLegacyAddress).to.equal(true);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should be able to validate an DOGE address', async () => {
|
|
90
|
+
const isValidAddress = await Validation.validateAddress('DOGE', 'mainnet', dogeAddress);
|
|
91
|
+
const isValidTestAddress = await Validation.validateAddress('DOGE', 'testnet', dogeTestAddress);
|
|
92
|
+
expect(isValidAddress).to.equal(true);
|
|
93
|
+
expect(isValidTestAddress).to.equal(true);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('should be able to validate an LTC address', async () => {
|
|
97
|
+
const isValidAddress = await Validation.validateAddress('LTC', 'mainnet', ltcAddress);
|
|
98
|
+
const isValidTestAddress = await Validation.validateAddress('LTC', 'testnet', ltcTestAddress);
|
|
99
|
+
expect(isValidAddress).to.equal(true);
|
|
100
|
+
expect(isValidTestAddress).to.equal(true);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should be able to validate an ETH address', async () => {
|
|
104
|
+
const isValidAddress = await Validation.validateAddress('ETH', 'mainnet', ethAddress);
|
|
105
|
+
const isValidPrefixAddress = await Validation.validateAddress('ETH', 'mainnet', prefixEthAddress);
|
|
106
|
+
expect(isValidAddress).to.equal(true);
|
|
107
|
+
expect(isValidPrefixAddress).to.equal(true);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should be able to validate an XRP address', async () => {
|
|
111
|
+
const isValidAddress = await Validation.validateAddress('XRP', 'mainnet', xrpAddress);
|
|
112
|
+
expect(isValidAddress).to.equal(true);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('should be able to validate an MATIC address', async () => {
|
|
116
|
+
const isValidAddress = await Validation.validateAddress('MATIC', 'mainnet', maticAddress);
|
|
117
|
+
const isValidPrefixAddress = await Validation.validateAddress('MATIC', 'mainnet', prefixMaticAddress);
|
|
118
|
+
expect(isValidAddress).to.equal(true);
|
|
119
|
+
expect(isValidPrefixAddress).to.equal(true);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('should be able to validate an BTC Uri', async () => {
|
|
123
|
+
const isValidUri = await Validation.validateUri('BTC', btcUri);
|
|
124
|
+
const isValidTestUri = await Validation.validateUri('BTC', btcTestUri);
|
|
125
|
+
expect(isValidUri).to.equal(true);
|
|
126
|
+
expect(isValidTestUri).to.equal(true);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('should be able to validate an BCH Uri', async () => {
|
|
130
|
+
const isValidUri = await Validation.validateUri('BCH', bchUri);
|
|
131
|
+
const isValidTestUri = await Validation.validateUri('BCH', bchTestUri);
|
|
132
|
+
expect(isValidUri).to.equal(true);
|
|
133
|
+
expect(isValidTestUri).to.equal(true);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('should be able to validate an DOGE Uri', async () => {
|
|
137
|
+
const isValidUri = await Validation.validateUri('DOGE', dogeUri);
|
|
138
|
+
const isValidTestUri = await Validation.validateUri('DOGE', dogeTestUri);
|
|
139
|
+
expect(isValidUri).to.equal(true);
|
|
140
|
+
expect(isValidTestUri).to.equal(true);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('should be able to validate an LTC Uri', async () => {
|
|
144
|
+
const isValidUri = await Validation.validateUri('LTC', ltcUri);
|
|
145
|
+
const isValidTestUri = await Validation.validateUri('LTC', ltcTestUri);
|
|
146
|
+
expect(isValidUri).to.equal(true);
|
|
147
|
+
expect(isValidTestUri).to.equal(true);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('should be able to validate an ETH Uri', async () => {
|
|
151
|
+
const isValidUri = await Validation.validateUri('ETH', ethUri);
|
|
152
|
+
const isValidUriParams = await Validation.validateUri('ETH', ethUriParams);
|
|
153
|
+
const isValidUriSingleParam = await Validation.validateUri('ETH', ethUriSingleParam);
|
|
154
|
+
expect(isValidUri).to.equal(true);
|
|
155
|
+
expect(isValidUriParams).to.equal(true);
|
|
156
|
+
expect(isValidUriSingleParam).to.equal(true);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('should be able to validate an XRP Uri', async () => {
|
|
160
|
+
const isValidUri = await Validation.validateUri('XRP', xrpUri);
|
|
161
|
+
const isValidUriParams = await Validation.validateUri('XRP', xrpUriParams);
|
|
162
|
+
const isValidUriSingleParam = await Validation.validateUri('XRP', xrpUriSingleParam);
|
|
163
|
+
expect(isValidUri).to.equal(true);
|
|
164
|
+
expect(isValidUriParams).to.equal(true);
|
|
165
|
+
expect(isValidUriSingleParam).to.equal(true);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('should be able to validate an MATIC Uri', async () => {
|
|
169
|
+
const isValidUri = await Validation.validateUri('MATIC', maticUri);
|
|
170
|
+
const isValidUriParams = await Validation.validateUri('MATIC', maticUriParams);
|
|
171
|
+
const isValidUriSingleParam = await Validation.validateUri('MATIC', maticUriSingleParam);
|
|
172
|
+
expect(isValidUri).to.equal(true);
|
|
173
|
+
expect(isValidUriParams).to.equal(true);
|
|
174
|
+
expect(isValidUriSingleParam).to.equal(true);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('should be able to invalidate an incorrect BTC address', async () => {
|
|
178
|
+
const inValidAddress = await Validation.validateAddress('BTC', 'mainnet', invalidBtcAddress);
|
|
179
|
+
expect(inValidAddress).to.equal(false);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('should be able to invalidate an incorrect BCH address', async () => {
|
|
183
|
+
const inValidAddress = await Validation.validateAddress('BCH', 'mainnet', invalidBchAddress);
|
|
184
|
+
expect(inValidAddress).to.equal(false);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('should be able to invalidate an incorrect DOGE address', async () => {
|
|
188
|
+
const inValidAddress = await Validation.validateAddress('DOGE', 'mainnet', invalidDogeAddress);
|
|
189
|
+
expect(inValidAddress).to.equal(false);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it('should be able to invalidate an incorrect LTC address', async () => {
|
|
193
|
+
const inValidAddress = await Validation.validateAddress('LTC', 'mainnet', invalidLtcAddress);
|
|
194
|
+
expect(inValidAddress).to.equal(false);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it('should be able to invalidate an incorrect ETH address', async () => {
|
|
198
|
+
const inValidAddress = await Validation.validateAddress('ETH', 'mainnet', invalidEthAddress);
|
|
199
|
+
expect(inValidAddress).to.equal(false);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('should be able to invalidate an incorrect XRP address', async () => {
|
|
203
|
+
const inValidAddress = await Validation.validateAddress('XRP', 'mainnet', invalidXrpAddress);
|
|
204
|
+
expect(inValidAddress).to.equal(false);
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('should be able to invalidate an incorrect MATIC address', async () => {
|
|
208
|
+
const inValidAddress = await Validation.validateAddress('MATIC', 'mainnet', invalidMaticAddress);
|
|
209
|
+
expect(inValidAddress).to.equal(false);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it('should be able to invalidate incorrect ETH Uri params', async () => {
|
|
213
|
+
const inValidEthUri = await Validation.validateUri('ETH', invalidEthUriParams);
|
|
214
|
+
expect(inValidEthUri).to.equal(false);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('should be able to invalidate ETH URI without ethereum prefix', async () => {
|
|
218
|
+
const inValidEthPrefix = await Validation.validateUri('ETH', invalidEthPrefix);
|
|
219
|
+
expect(inValidEthPrefix).to.equal(false);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('should be able to invalidate incorrect XRP Uri params', async () => {
|
|
223
|
+
const inValidXrpUri = await Validation.validateUri('XRP', invalidXrpUriParams);
|
|
224
|
+
expect(inValidXrpUri).to.equal(false);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it('should be able to invalidate XRP URI without ripple prefix', async () => {
|
|
228
|
+
const inValidXrpPrefix = await Validation.validateUri('XRP', invalidXrpPrefix);
|
|
229
|
+
expect(inValidXrpPrefix).to.equal(false);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it('should be able to invalidate incorrect MATIC Uri params', async () => {
|
|
233
|
+
const inValidMaticUri = await Validation.validateUri('MATIC', invalidMaticUriParams);
|
|
234
|
+
expect(inValidMaticUri).to.equal(false);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('should be able to invalidate MATIC URI without ethereum prefix', async () => {
|
|
238
|
+
const inValidMaticPrefix = await Validation.validateUri('MATIC', invalidMaticPrefix);
|
|
239
|
+
expect(inValidMaticPrefix).to.equal(false);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it('should be able to validate a SOL address', async () => {
|
|
243
|
+
const isValidAddress = await Validation.validateAddress('SOL', 'mainnet', solAddress);
|
|
244
|
+
expect(isValidAddress).to.equal(true);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('should be able to invalidate an incorrect SOL address', async () => {
|
|
248
|
+
const isValidAddress = await Validation.validateAddress('SOL', 'mainnet', invalidSolAddress);
|
|
249
|
+
expect(isValidAddress).to.equal(false);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
it('should be able to validate a SOL Uri', async () => {
|
|
253
|
+
const isValidUri = await Validation.validateUri('SOL', solUri);
|
|
254
|
+
expect(isValidUri).to.equal(true);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it('should be able to invalidate an incorrect SOL Uri', async () => {
|
|
258
|
+
const isValidUri = await Validation.validateUri('SOL', invalidSolUri);
|
|
259
|
+
expect(isValidUri).to.equal(false);
|
|
260
|
+
});
|
|
261
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../src/constants/address.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SCRIPT_TYPES = void 0;
|
|
4
|
+
exports.SCRIPT_TYPES = {
|
|
5
|
+
P2SH: 'P2SH',
|
|
6
|
+
P2PKH: 'P2PKH',
|
|
7
|
+
P2WPKH: 'P2WPKH',
|
|
8
|
+
P2WSH: 'P2WSH',
|
|
9
|
+
P2TR: 'P2TR'
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src/constants/address.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algorithms.d.ts","sourceRoot":"","sources":["../../../src/constants/algorithms.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;CAG1B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;CAG5B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ALGO_TO_KEY_TYPE = exports.ALGOS_BY_CHAIN = void 0;
|
|
4
|
+
exports.ALGOS_BY_CHAIN = {
|
|
5
|
+
default: 'ECDSA',
|
|
6
|
+
SOL: 'EDDSA'
|
|
7
|
+
};
|
|
8
|
+
exports.ALGO_TO_KEY_TYPE = {
|
|
9
|
+
ECDSA: 'Bitcoin',
|
|
10
|
+
EDDSA: 'ed25519'
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=algorithms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algorithms.js","sourceRoot":"","sources":["../../../src/constants/algorithms.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,OAAO;IAChB,GAAG,EAAE,OAAO;CACb,CAAC;AAEW,QAAA,gBAAgB,GAAG;IAC9B,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;CACjB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const UTXO_CHAINS: string[];
|
|
2
|
+
export declare const EVM_CHAINS: string[];
|
|
3
|
+
export declare const SVM_CHAINS: string[];
|
|
4
|
+
export declare const RIPPLE_CHAINS: string[];
|
|
5
|
+
export declare const CHAINS: string[];
|
|
6
|
+
export declare const MULTISIG_CHAINS: string[];
|
|
7
|
+
export declare const EVM_CHAIN_DEFAULT_TESTNET: {
|
|
8
|
+
ETH: string;
|
|
9
|
+
MATIC: string;
|
|
10
|
+
ARB: string;
|
|
11
|
+
BASE: string;
|
|
12
|
+
OP: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const EVM_CHAIN_NETWORK_TO_CHAIN_ID: {
|
|
15
|
+
ETH_mainnet: number;
|
|
16
|
+
MATIC_mainnet: number;
|
|
17
|
+
ARB_mainnet: number;
|
|
18
|
+
BASE_mainnet: number;
|
|
19
|
+
OP_mainnet: number;
|
|
20
|
+
ETH_holesky: number;
|
|
21
|
+
ETH_sepolia: number;
|
|
22
|
+
ETH_goerli: number;
|
|
23
|
+
ETH_kovan: number;
|
|
24
|
+
ETH_ropsten: number;
|
|
25
|
+
ETH_rinkeby: number;
|
|
26
|
+
MATIC_mumbai: number;
|
|
27
|
+
MATIC_amoy: number;
|
|
28
|
+
ARB_sepolia: number;
|
|
29
|
+
ARB_goerli: number;
|
|
30
|
+
BASE_sepolia: number;
|
|
31
|
+
BASE_goerli: number;
|
|
32
|
+
OP_sepolia: number;
|
|
33
|
+
OP_goerli: number;
|
|
34
|
+
ETH_regtest: number;
|
|
35
|
+
MATIC_regtest: number;
|
|
36
|
+
ARB_regtest: number;
|
|
37
|
+
BASE_regtest: number;
|
|
38
|
+
OP_regtest: number;
|
|
39
|
+
};
|
|
40
|
+
export declare const EVM_CHAIN_ID_TO_CHAIN_NETWORK: Record<number, "ETH_mainnet" | "MATIC_mainnet" | "ARB_mainnet" | "BASE_mainnet" | "OP_mainnet" | "ETH_holesky" | "ETH_sepolia" | "ETH_goerli" | "ETH_kovan" | "ETH_ropsten" | "ETH_rinkeby" | "MATIC_mumbai" | "MATIC_amoy" | "ARB_sepolia" | "ARB_goerli" | "BASE_sepolia" | "BASE_goerli" | "OP_sepolia" | "OP_goerli" | "ETH_regtest" | "MATIC_regtest" | "ARB_regtest" | "BASE_regtest" | "OP_regtest">;
|
|
41
|
+
export declare const EVM_CHAIN_ID_TO_CHAIN: Record<number, "ETH_mainnet" | "MATIC_mainnet" | "ARB_mainnet" | "BASE_mainnet" | "OP_mainnet" | "ETH_holesky" | "ETH_sepolia" | "ETH_goerli" | "ETH_kovan" | "ETH_ropsten" | "ETH_rinkeby" | "MATIC_mumbai" | "MATIC_amoy" | "ARB_sepolia" | "ARB_goerli" | "BASE_sepolia" | "BASE_goerli" | "OP_sepolia" | "OP_goerli" | "ETH_regtest" | "MATIC_regtest" | "ARB_regtest" | "BASE_regtest" | "OP_regtest">;
|
|
42
|
+
//# sourceMappingURL=chains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../../src/constants/chains.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,UAAgC,CAAC;AACzD,eAAO,MAAM,UAAU,UAAwC,CAAC;AAChE,eAAO,MAAM,UAAU,UAAU,CAAC;AAClC,eAAO,MAAM,aAAa,UAAU,CAAC;AACrC,eAAO,MAAM,MAAM,UAAmE,CAAC;AAEvF,eAAO,MAAM,eAAe,UAAc,CAAC;AAE3C,eAAO,MAAM,yBAAyB;;;;;;CAMrC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;CAgCzC,CAAC;AAYF,eAAO,MAAM,6BAA6B,6YAA+C,CAAC;AAE1F,eAAO,MAAM,qBAAqB,6YAAqD,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EVM_CHAIN_ID_TO_CHAIN = exports.EVM_CHAIN_ID_TO_CHAIN_NETWORK = exports.EVM_CHAIN_NETWORK_TO_CHAIN_ID = exports.EVM_CHAIN_DEFAULT_TESTNET = exports.MULTISIG_CHAINS = exports.CHAINS = exports.RIPPLE_CHAINS = exports.SVM_CHAINS = exports.EVM_CHAINS = exports.UTXO_CHAINS = void 0;
|
|
4
|
+
exports.UTXO_CHAINS = ['btc', 'bch', 'doge', 'ltc'];
|
|
5
|
+
exports.EVM_CHAINS = ['eth', 'matic', 'arb', 'base', 'op'];
|
|
6
|
+
exports.SVM_CHAINS = ['sol'];
|
|
7
|
+
exports.RIPPLE_CHAINS = ['xrp'];
|
|
8
|
+
exports.CHAINS = [...exports.UTXO_CHAINS, ...exports.EVM_CHAINS, ...exports.SVM_CHAINS, ...exports.RIPPLE_CHAINS];
|
|
9
|
+
exports.MULTISIG_CHAINS = exports.UTXO_CHAINS;
|
|
10
|
+
exports.EVM_CHAIN_DEFAULT_TESTNET = {
|
|
11
|
+
ETH: 'sepolia',
|
|
12
|
+
MATIC: 'amoy',
|
|
13
|
+
ARB: 'sepolia',
|
|
14
|
+
BASE: 'sepolia',
|
|
15
|
+
OP: 'sepolia'
|
|
16
|
+
};
|
|
17
|
+
exports.EVM_CHAIN_NETWORK_TO_CHAIN_ID = {
|
|
18
|
+
ETH_mainnet: 1,
|
|
19
|
+
MATIC_mainnet: 137,
|
|
20
|
+
ARB_mainnet: 42161,
|
|
21
|
+
BASE_mainnet: 8453,
|
|
22
|
+
OP_mainnet: 10,
|
|
23
|
+
ETH_holesky: 17000,
|
|
24
|
+
ETH_sepolia: 11155111,
|
|
25
|
+
ETH_goerli: 5,
|
|
26
|
+
ETH_kovan: 42,
|
|
27
|
+
ETH_ropsten: 3,
|
|
28
|
+
ETH_rinkeby: 4,
|
|
29
|
+
MATIC_mumbai: 80001,
|
|
30
|
+
MATIC_amoy: 80002,
|
|
31
|
+
ARB_sepolia: 421614,
|
|
32
|
+
ARB_goerli: 421613,
|
|
33
|
+
BASE_sepolia: 84532,
|
|
34
|
+
BASE_goerli: 84531,
|
|
35
|
+
OP_sepolia: 11155420,
|
|
36
|
+
OP_goerli: 28528,
|
|
37
|
+
ETH_regtest: 1337,
|
|
38
|
+
MATIC_regtest: 13375,
|
|
39
|
+
ARB_regtest: 442161,
|
|
40
|
+
BASE_regtest: 88453,
|
|
41
|
+
OP_regtest: 111554201
|
|
42
|
+
};
|
|
43
|
+
const reverseObject = (obj, split = false) => {
|
|
44
|
+
const reversed = {};
|
|
45
|
+
const entries = Object.entries(obj);
|
|
46
|
+
for (const [key, value] of entries) {
|
|
47
|
+
const _key = split ? key.split('_')[0] : key;
|
|
48
|
+
reversed[value] = _key;
|
|
49
|
+
}
|
|
50
|
+
return reversed;
|
|
51
|
+
};
|
|
52
|
+
exports.EVM_CHAIN_ID_TO_CHAIN_NETWORK = reverseObject(exports.EVM_CHAIN_NETWORK_TO_CHAIN_ID);
|
|
53
|
+
exports.EVM_CHAIN_ID_TO_CHAIN = reverseObject(exports.EVM_CHAIN_NETWORK_TO_CHAIN_ID, true);
|
|
54
|
+
//# sourceMappingURL=chains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains.js","sourceRoot":"","sources":["../../../src/constants/chains.ts"],"names":[],"mappings":";;;AACa,QAAA,WAAW,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAC5C,QAAA,UAAU,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AACnD,QAAA,UAAU,GAAG,CAAC,KAAK,CAAC,CAAC;AACrB,QAAA,aAAa,GAAG,CAAC,KAAK,CAAC,CAAC;AACxB,QAAA,MAAM,GAAG,CAAC,GAAG,mBAAW,EAAE,GAAG,kBAAU,EAAE,GAAG,kBAAU,EAAE,GAAG,qBAAa,CAAC,CAAC;AAE1E,QAAA,eAAe,GAAG,mBAAW,CAAC;AAE9B,QAAA,yBAAyB,GAAG;IACvC,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,MAAM;IACb,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,EAAE,EAAE,SAAS;CACd,CAAC;AAEW,QAAA,6BAA6B,GAAG;IAE3C,WAAW,EAAE,CAAC;IACd,aAAa,EAAE,GAAG;IAClB,WAAW,EAAE,KAAK;IAClB,YAAY,EAAE,IAAI;IAClB,UAAU,EAAE,EAAE;IAEd,WAAW,EAAE,KAAK;IAClB,WAAW,EAAE,QAAQ;IACrB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,CAAC;IAEd,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,KAAK;IAEjB,WAAW,EAAE,MAAM;IACnB,UAAU,EAAE,MAAM;IAElB,YAAY,EAAE,KAAK;IACnB,WAAW,EAAE,KAAK;IAElB,UAAU,EAAE,QAAQ;IACpB,SAAS,EAAE,KAAK;IAEhB,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,MAAM;IACnB,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,SAAS;CACtB,CAAC;AAEF,MAAM,aAAa,GAAG,CAA8C,GAAiB,EAAE,KAAK,GAAG,KAAK,EAAgB,EAAE;IACpH,MAAM,QAAQ,GAAG,EAAkB,CAAC;IACpC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAa,CAAC;IAChD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAM,CAAC,CAAC,CAAC,GAAG,CAAC;QAClD,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACzB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEW,QAAA,6BAA6B,GAAG,aAAa,CAAC,qCAA6B,CAAC,CAAC;AAE7E,QAAA,qBAAqB,GAAG,aAAa,CAAC,qCAA6B,EAAE,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const FEE_MINIMUMS: {
|
|
2
|
+
ETH: {
|
|
3
|
+
priority: number;
|
|
4
|
+
};
|
|
5
|
+
MATIC: {
|
|
6
|
+
priority: number;
|
|
7
|
+
};
|
|
8
|
+
OP: {
|
|
9
|
+
priority: number;
|
|
10
|
+
};
|
|
11
|
+
ARB: {
|
|
12
|
+
priority: number;
|
|
13
|
+
};
|
|
14
|
+
BASE: {
|
|
15
|
+
priority: number;
|
|
16
|
+
};
|
|
17
|
+
SOL: {
|
|
18
|
+
priority: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=feeMinimums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feeMinimums.d.ts","sourceRoot":"","sources":["../../../src/constants/feeMinimums.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;CAmBxB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FEE_MINIMUMS = void 0;
|
|
4
|
+
exports.FEE_MINIMUMS = {
|
|
5
|
+
ETH: {
|
|
6
|
+
priority: 1
|
|
7
|
+
},
|
|
8
|
+
MATIC: {
|
|
9
|
+
priority: 30 * 1e9
|
|
10
|
+
},
|
|
11
|
+
OP: {
|
|
12
|
+
priority: 1
|
|
13
|
+
},
|
|
14
|
+
ARB: {
|
|
15
|
+
priority: 0
|
|
16
|
+
},
|
|
17
|
+
BASE: {
|
|
18
|
+
priority: 1
|
|
19
|
+
},
|
|
20
|
+
SOL: {
|
|
21
|
+
priority: 0
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=feeMinimums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feeMinimums.js","sourceRoot":"","sources":["../../../src/constants/feeMinimums.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,GAAG,EAAE;QACH,QAAQ,EAAE,CAAC;KACZ;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,EAAE,GAAG,GAAG;KACnB;IACD,EAAE,EAAE;QACF,QAAQ,EAAE,CAAC;KACZ;IACD,GAAG,EAAE;QACH,QAAQ,EAAE,CAAC;KACZ;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,CAAC;KACZ;IACD,GAAG,EAAE;QACH,QAAQ,EAAE,CAAC;KACZ;CACF,CAAC"}
|