Skip to content

Instantly share code, notes, and snippets.

@NorrinRadd
Last active April 11, 2024 08:19
Show Gist options
  • Save NorrinRadd/6c37d399b4918c8a3a765893b7dcacf1 to your computer and use it in GitHub Desktop.
Save NorrinRadd/6c37d399b4918c8a3a765893b7dcacf1 to your computer and use it in GitHub Desktop.
emscripten 3.1.10 running woodser/monero-ts#198
> monero-ts@0.9.7 test
> npm run build_commonjs && node --enable-source-maps --no-experimental-fetch node_modules/mocha/bin/_mocha --require @babel/register "dist/src/test/TestAll" --timeout 900000000 --exit
> monero-ts@0.9.7 build_commonjs
> babel ./src --extensions ".js,.ts" --out-dir ./dist/src && babel ./index.ts --extensions ".ts" --out-dir ./dist && shx mkdir -p dist/dist && shx cp dist/monero_wallet_full.js dist/monero_wallet_keys.js dist/dist && shx cp dist/*.js.map dist/dist && shx cp dist/*.wasm dist/dist
Successfully compiled 94 files with Babel (1579ms).
Successfully compiled 1 file with Babel (179ms).
Test sample code
MoneroRpcError: Failed to open wallet
at validateRpcResponse (/Users/user/code/monero-ts/src/main/ts/common/MoneroRpcConnection.ts:415:11)
at MoneroRpcConnection.sendJsonRequest (/Users/user/code/monero-ts/src/main/ts/common/MoneroRpcConnection.ts:273:27)
at MoneroWalletRpc.openWallet (/Users/user/code/monero-ts/src/main/ts/wallet/MoneroWalletRpc.ts:161:5)
at Function.getWalletRpc (/Users/user/code/monero-ts/src/test/utils/TestUtils.ts:109:7)
at Context.<anonymous> (/Users/user/code/monero-ts/src/test/TestSampleCode.ts:23:27) {
code: -1,
rpcMethod: 'open_wallet',
rpcParams: { filename: 'test_wallet_1', password: 'supersecretpassword123' }
}
Creating wallet!
Error before tests:
MoneroRpcError: Wallet already exists.
at validateRpcResponse (/Users/user/code/monero-ts/src/main/ts/common/MoneroRpcConnection.ts:415:11)
at MoneroRpcConnection.sendJsonRequest (/Users/user/code/monero-ts/src/main/ts/common/MoneroRpcConnection.ts:273:27)
at MoneroWalletRpc.createWalletFromSeed (/Users/user/code/monero-ts/src/main/ts/wallet/MoneroWalletRpc.ts:267:7)
at MoneroWalletRpc.createWallet (/Users/user/code/monero-ts/src/main/ts/wallet/MoneroWalletRpc.ts:234:51)
at Function.getWalletRpc (/Users/user/code/monero-ts/src/test/utils/TestUtils.ts:120:9)
at Context.<anonymous> (/Users/user/code/monero-ts/src/test/TestSampleCode.ts:23:27) {
code: -1,
rpcMethod: 'restore_deterministic_wallet',
rpcParams: {
filename: 'test_wallet_1',
password: 'supersecretpassword123',
seed: 'silk mocked cucumber lettuce hope adrenalin aching lush roles fuel revamp baptism wrist long tender teardrop midst pastry pigment equip frying inbound pinched ravine frying',
seed_offset: undefined,
enable_multisig_experimental: undefined,
restore_height: 171,
language: undefined,
autosave_current: undefined
}
}
1) "before all" hook for "Sample code demonstration"
TEST MONERO UTILITIES
✔ Can get integrated addresses (188ms)
✔ Can serialize heights with small numbers
✔ Can serialize heights with big numbers
✔ Can serialize json with text
✔ Can serialize json with long text
✔ Can validate addresses
✔ Can validate keys
✔ Can convert between XMR and atomic units
TEST MONERO DAEMON RPC
MoneroRpcError: Failed to open wallet
at validateRpcResponse (/Users/user/code/monero-ts/src/main/ts/common/MoneroRpcConnection.ts:415:11)
at MoneroRpcConnection.sendJsonRequest (/Users/user/code/monero-ts/src/main/ts/common/MoneroRpcConnection.ts:273:27)
at MoneroWalletRpc.openWallet (/Users/user/code/monero-ts/src/main/ts/wallet/MoneroWalletRpc.ts:161:5)
at Function.getWalletRpc (/Users/user/code/monero-ts/src/test/utils/TestUtils.ts:109:7)
at Context.<anonymous> (/Users/user/code/monero-ts/src/test/TestMoneroDaemonRpc.ts:60:25) {
code: -1,
rpcMethod: 'open_wallet',
rpcParams: { filename: 'test_wallet_1', password: 'supersecretpassword123' }
}
Creating wallet!
Error before tests:
MoneroRpcError: Wallet already exists.
at validateRpcResponse (/Users/user/code/monero-ts/src/main/ts/common/MoneroRpcConnection.ts:415:11)
at MoneroRpcConnection.sendJsonRequest (/Users/user/code/monero-ts/src/main/ts/common/MoneroRpcConnection.ts:273:27)
at MoneroWalletRpc.createWalletFromSeed (/Users/user/code/monero-ts/src/main/ts/wallet/MoneroWalletRpc.ts:267:7)
at MoneroWalletRpc.createWallet (/Users/user/code/monero-ts/src/main/ts/wallet/MoneroWalletRpc.ts:234:51)
at Function.getWalletRpc (/Users/user/code/monero-ts/src/test/utils/TestUtils.ts:120:9)
at Context.<anonymous> (/Users/user/code/monero-ts/src/test/TestMoneroDaemonRpc.ts:60:25) {
code: -1,
rpcMethod: 'restore_deterministic_wallet',
rpcParams: {
filename: 'test_wallet_1',
password: 'supersecretpassword123',
seed: 'silk mocked cucumber lettuce hope adrenalin aching lush roles fuel revamp baptism wrist long tender teardrop midst pastry pigment equip frying inbound pinched ravine frying',
seed_offset: undefined,
enable_multisig_experimental: undefined,
restore_height: 171,
language: undefined,
autosave_current: undefined
}
}
2) "before all" hook for "Can start and stop a daemon process"
TEST MONERO WALLET KEYS
Before all
Tests specific to keys wallet
Before test "Has the same keys as the RPC wallet"
MoneroRpcError: Failed to open wallet
at validateRpcResponse (/Users/user/code/monero-ts/src/main/ts/common/MoneroRpcConnection.ts:415:11)
at MoneroRpcConnection.sendJsonRequest (/Users/user/code/monero-ts/src/main/ts/common/MoneroRpcConnection.ts:273:27)
at MoneroWalletRpc.openWallet (/Users/user/code/monero-ts/src/main/ts/wallet/MoneroWalletRpc.ts:161:5)
at Function.getWalletRpc (/Users/user/code/monero-ts/src/test/utils/TestUtils.ts:109:7)
at Context.<anonymous> (/Users/user/code/monero-ts/src/test/TestMoneroWalletKeys.ts:93:58) {
code: -1,
rpcMethod: 'open_wallet',
rpcParams: { filename: 'test_wallet_1', password: 'supersecretpassword123' }
}
Creating wallet!
3) Has the same keys as the RPC wallet
After test "Has the same keys as the RPC wallet"
Before test "Has the same keys as the RPC wallet with a seed offset"
MoneroRpcError: Failed to open wallet
at validateRpcResponse (/Users/user/code/monero-ts/src/main/ts/common/MoneroRpcConnection.ts:415:11)
at MoneroRpcConnection.sendJsonRequest (/Users/user/code/monero-ts/src/main/ts/common/MoneroRpcConnection.ts:273:27)
at MoneroWalletRpc.openWallet (/Users/user/code/monero-ts/src/main/ts/wallet/MoneroWalletRpc.ts:161:5)
at Function.getWalletRpc (/Users/user/code/monero-ts/src/test/utils/TestUtils.ts:109:7)
at Context.<anonymous> (/Users/user/code/monero-ts/src/test/TestMoneroWalletKeys.ts:102:25) {
code: -1,
rpcMethod: 'open_wallet',
rpcParams: { filename: 'test_wallet_1', password: 'supersecretpassword123' }
}
Creating wallet!
4) Has the same keys as the RPC wallet with a seed offset
After test "Has the same keys as the RPC wallet with a seed offset"
Before test "Can get the address of a specified account and subaddress index"
✔ Can get the address of a specified account and subaddress index
After test "Can get the address of a specified account and subaddress index"
Common Wallet Tests
Before test "Can create a random wallet"
✔ Can create a random wallet
After test "Can create a random wallet"
Before test "Can create a wallet from a mnemonic phrase."
✔ Can create a wallet from a mnemonic phrase.
After test "Can create a wallet from a mnemonic phrase."
Before test "Can create a wallet from a mnemonic phrase with a seed offset"
✔ Can create a wallet from a mnemonic phrase with a seed offset (141ms)
After test "Can create a wallet from a mnemonic phrase with a seed offset"
Before test "Can create a wallet from keys"
✔ Can create a wallet from keys
After test "Can create a wallet from keys"
Before test "Can get the wallet's version"
5) Can get the wallet's version
After test "Can get the wallet's version"
Before test "Can get the wallet's path"
6) Can get the wallet's path
After test "Can get the wallet's path"
Before test "Can set the daemon connection"
7) Can set the daemon connection
After test "Can set the daemon connection"
Before test "Can use a connection manager"
8) Can use a connection manager
After test "Can use a connection manager"
Before test "Can get the seed as a mnemonic phrase"
✔ Can get the seed as a mnemonic phrase
After test "Can get the seed as a mnemonic phrase"
Before test "Can get the language of the seed"
✔ Can get the language of the seed
After test "Can get the language of the seed"
Before test "Can get a list of supported languages for the seed"
✔ Can get a list of supported languages for the seed (90ms)
After test "Can get a list of supported languages for the seed"
Before test "Can get the private view key"
✔ Can get the private view key
After test "Can get the private view key"
Before test "Can get the private spend key"
✔ Can get the private spend key
After test "Can get the private spend key"
Before test "Can get the public view key"
✔ Can get the public view key
After test "Can get the public view key"
Before test "Can get the public spend key"
✔ Can get the public spend key
After test "Can get the public spend key"
Before test "Can get the primary address"
✔ Can get the primary address
After test "Can get the primary address"
Before test "Can get the address of a subaddress at a specified account and subaddress index"
9) Can get the address of a subaddress at a specified account and subaddress index
After test "Can get the address of a subaddress at a specified account and subaddress index"
Before test "Can get addresses out of range of used accounts and subaddresses"
10) Can get addresses out of range of used accounts and subaddresses
After test "Can get addresses out of range of used accounts and subaddresses"
Before test "Can get the account and subaddress indices of an address"
11) Can get the account and subaddress indices of an address
After test "Can get the account and subaddress indices of an address"
Before test "Can get an integrated address given a payment id"
12) Can get an integrated address given a payment id
After test "Can get an integrated address given a payment id"
Before test "Can decode an integrated address"
13) Can decode an integrated address
After test "Can decode an integrated address"
Before test "Can sync (without progress)"
14) Can sync (without progress)
After test "Can sync (without progress)"
Before test "Can get the current height that the wallet is synchronized to"
15) Can get the current height that the wallet is synchronized to
After test "Can get the current height that the wallet is synchronized to"
Before test "Can get a blockchain height by date"
16) Can get a blockchain height by date
After test "Can get a blockchain height by date"
Before test "Can get the locked and unlocked balances of the wallet, accounts, and subaddresses"
17) Can get the locked and unlocked balances of the wallet, accounts, and subaddresses
After test "Can get the locked and unlocked balances of the wallet, accounts, and subaddresses"
Before test "Can get accounts without subaddresses"
18) Can get accounts without subaddresses
After test "Can get accounts without subaddresses"
Before test "Can get accounts with subaddresses"
19) Can get accounts with subaddresses
After test "Can get accounts with subaddresses"
Before test "Can get an account at a specified index"
20) Can get an account at a specified index
After test "Can get an account at a specified index"
Before test "Can create a new account without a label"
21) Can create a new account without a label
After test "Can create a new account without a label"
Before test "Can create a new account with a label"
22) Can create a new account with a label
After test "Can create a new account with a label"
Before test "Can set account labels"
23) Can set account labels
After test "Can set account labels"
Before test "Can get subaddresses at a specified account index"
24) Can get subaddresses at a specified account index
After test "Can get subaddresses at a specified account index"
Before test "Can get subaddresses at specified account and subaddress indices"
25) Can get subaddresses at specified account and subaddress indices
After test "Can get subaddresses at specified account and subaddress indices"
Before test "Can get a subaddress at a specified account and subaddress index"
26) Can get a subaddress at a specified account and subaddress index
After test "Can get a subaddress at a specified account and subaddress index"
Before test "Can create a subaddress with and without a label"
27) Can create a subaddress with and without a label
After test "Can create a subaddress with and without a label"
Before test "Can set subaddress labels"
28) Can set subaddress labels
After test "Can set subaddress labels"
Before test "Can get transactions in the wallet"
29) Can get transactions in the wallet
After test "Can get transactions in the wallet"
Before test "Can get transactions by hash"
30) Can get transactions by hash
After test "Can get transactions by hash"
Before test "Can get transactions with additional configuration"
31) Can get transactions with additional configuration
After test "Can get transactions with additional configuration"
Before test "Can get transactions by height"
32) Can get transactions by height
After test "Can get transactions by height"
Before test "Can get transactions by payment ids"
33) Can get transactions by payment ids
After test "Can get transactions by payment ids"
Before test "Returns all known fields of txs regardless of filtering"
34) Returns all known fields of txs regardless of filtering
After test "Returns all known fields of txs regardless of filtering"
Before test "Validates inputs when getting transactions"
35) Validates inputs when getting transactions
After test "Validates inputs when getting transactions"
Before test "Can get transfers in the wallet, accounts, and subaddresses"
36) Can get transfers in the wallet, accounts, and subaddresses
After test "Can get transfers in the wallet, accounts, and subaddresses"
Before test "Can get transfers with additional configuration"
37) Can get transfers with additional configuration
After test "Can get transfers with additional configuration"
Before test "Validates inputs when getting transfers"
38) Validates inputs when getting transfers
After test "Validates inputs when getting transfers"
Before test "Can get incoming and outgoing transfers using convenience methods"
39) Can get incoming and outgoing transfers using convenience methods
After test "Can get incoming and outgoing transfers using convenience methods"
Before test "Can get outputs in the wallet, accounts, and subaddresses"
40) Can get outputs in the wallet, accounts, and subaddresses
After test "Can get outputs in the wallet, accounts, and subaddresses"
Before test "Can get outputs with additional configuration"
41) Can get outputs with additional configuration
After test "Can get outputs with additional configuration"
Before test "Validates inputs when getting outputs"
42) Validates inputs when getting outputs
After test "Validates inputs when getting outputs"
Before test "Can export outputs in hex format"
43) Can export outputs in hex format
After test "Can export outputs in hex format"
Before test "Can import outputs in hex format"
44) Can import outputs in hex format
After test "Can import outputs in hex format"
Before test "Has correct accounting across accounts, subaddresses, txs, transfers, and outputs"
45) Has correct accounting across accounts, subaddresses, txs, transfers, and outputs
After test "Has correct accounting across accounts, subaddresses, txs, transfers, and outputs"
Before test "Can get and set a transaction note"
46) Can get and set a transaction note
After test "Can get and set a transaction note"
Before test "Can get and set multiple transaction notes"
47) Can get and set multiple transaction notes
After test "Can get and set multiple transaction notes"
Before test "Can check a transfer using the transaction's secret key and the destination"
48) Can check a transfer using the transaction's secret key and the destination
After test "Can check a transfer using the transaction's secret key and the destination"
Before test "Can prove a transaction by getting its signature"
49) Can prove a transaction by getting its signature
After test "Can prove a transaction by getting its signature"
Before test "Can prove a spend using a generated signature and no destination public address"
50) Can prove a spend using a generated signature and no destination public address
After test "Can prove a spend using a generated signature and no destination public address"
Before test "Can prove reserves in the wallet"
51) Can prove reserves in the wallet
After test "Can prove reserves in the wallet"
Before test "Can prove reserves in an account"
52) Can prove reserves in an account
After test "Can prove reserves in an account"
Before test "Can export key images"
53) Can export key images
After test "Can export key images"
Before test "Can get new key images from the last import"
54) Can get new key images from the last import
After test "Can get new key images from the last import"
Before test "Can sign and verify messages"
55) Can sign and verify messages
After test "Can sign and verify messages"
Before test "Has an address book"
56) Has an address book
After test "Has an address book"
Before test "Can get and set arbitrary key/value attributes"
57) Can get and set arbitrary key/value attributes
After test "Can get and set arbitrary key/value attributes"
Before test "Can convert between a tx config and payment URI"
58) Can convert between a tx config and payment URI
After test "Can convert between a tx config and payment URI"
Before test "Can start and stop mining"
59) Can start and stop mining
After test "Can start and stop mining"
Before test "Can change the wallet password"
60) Can change the wallet password
After test "Can change the wallet password"
Before test "Can save and close the wallet in a single call"
61) Can save and close the wallet in a single call
After test "Can save and close the wallet in a single call"
Before test "Can stop listening"
62) Can stop listening
After test "Can stop listening"
Before test "Validates inputs when sending funds"
63) Validates inputs when sending funds
After test "Validates inputs when sending funds"
Before test "Supports view-only and offline wallets to create, sign, and submit transactions"
64) Supports view-only and offline wallets to create, sign, and submit transactions
After test "Supports view-only and offline wallets to create, sign, and submit transactions"
Before test "Supports multisig wallets"
testMultisig(2, 2)
65) Supports multisig wallets
After test "Supports multisig wallets"
Before test "Can scan transactions by id"
66) Can scan transactions by id
After test "Can scan transactions by id"
Before test "Can freeze and thaw outputs"
67) Can freeze and thaw outputs
After test "Can freeze and thaw outputs"
Before test "Provides key images of spent outputs"
68) Provides key images of spent outputs
After test "Provides key images of spent outputs"
Before test "Can prove unrelayed txs"
69) Can prove unrelayed txs
After test "Can prove unrelayed txs"
After all
TEST MONERO WALLET FULL
Before all
Wallet exists at ./test_wallets/test_wallet_1: true
Wallet exists at ./test_wallets/test_wallet_1: true
onSyncProgress(2471361, 2471361, 2471388, 0.037037037037037035, Synchronizing)
onSyncProgress(2471362, 2471361, 2471388, 0.07407407407407407, Synchronizing)
onSyncProgress(2471363, 2471361, 2471388, 0.1111111111111111, Synchronizing)
onSyncProgress(2471365, 2471361, 2471388, 0.18518518518518517, Synchronizing)
onSyncProgress(2471366, 2471361, 2471388, 0.2222222222222222, Synchronizing)
onSyncProgress(2471367, 2471361, 2471388, 0.25925925925925924, Synchronizing)
onSyncProgress(2471369, 2471361, 2471388, 0.3333333333333333, Synchronizing)
onSyncProgress(2471370, 2471361, 2471388, 0.37037037037037035, Synchronizing)
onSyncProgress(2471371, 2471361, 2471388, 0.4074074074074074, Synchronizing)
onSyncProgress(2471373, 2471361, 2471388, 0.48148148148148145, Synchronizing)
onSyncProgress(2471374, 2471361, 2471388, 0.5185185185185185, Synchronizing)
onSyncProgress(2471375, 2471361, 2471388, 0.5555555555555556, Synchronizing)
onSyncProgress(2471377, 2471361, 2471388, 0.6296296296296297, Synchronizing)
onSyncProgress(2471378, 2471361, 2471388, 0.6666666666666666, Synchronizing)
onSyncProgress(2471379, 2471361, 2471388, 0.7037037037037037, Synchronizing)
onSyncProgress(2471381, 2471361, 2471388, 0.7777777777777778, Synchronizing)
onSyncProgress(2471382, 2471361, 2471388, 0.8148148148148148, Synchronizing)
onSyncProgress(2471383, 2471361, 2471388, 0.8518518518518519, Synchronizing)
onSyncProgress(2471385, 2471361, 2471388, 0.9259259259259259, Synchronizing)
onSyncProgress(2471386, 2471361, 2471388, 0.9629629629629629, Synchronizing)
onSyncProgress(2471387, 2471361, 2471388, 1, Synchronizing)
Tests specific to WebAssembly wallet
Before test "Can get the daemon's height"
✔ Can get the daemon's height
After test "Can get the daemon's height"
WASM memory usage: 224002048
Before test "Can open, sync, and close wallets repeatedly"
Wallet exists at ./test_wallets/2ef07a17-cf3f-402c-8aed-9ed8b8b1c3ea: false
Wallet exists at ./test_wallets/2ef07a17-cf3f-402c-8aed-9ed8b8b1c3ea: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment