wallaby-cash 1.7.21 → 2.0.1-alpha.0
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/dist/base.d.ts +1 -1
- package/dist/helpers/base64.d.ts +2 -0
- package/dist/index.cjs.js +6858 -5370
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.js +6859 -5371
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6859 -5371
- package/dist/index.js.map +1 -1
- package/dist/lib/auth/auth.service.d.ts +51 -0
- package/dist/lib/auth/index.d.ts +1 -58
- package/dist/lib/transactions/index.d.ts +17 -15
- package/dist/lib/utils/cipher.service.d.ts +81 -0
- package/dist/lib/utils/constants.d.ts +20 -0
- package/dist/lib/utils/index.d.ts +1 -9
- package/dist/lib/utils/storage.service.d.ts +11 -67
- package/dist/lib/wallet/index.d.ts +1 -189
- package/dist/lib/wallet/wallet.service.d.ts +233 -0
- package/dist/package.json +112 -0
- package/dist/routes/transactions.d.ts +5 -0
- package/dist/routes/wallet.d.ts +26 -1
- package/dist/tests/__mocks__/localStorageMock.d.ts +10 -0
- package/dist/tests/data/assets.d.ts +89 -0
- package/dist/tests/data/auth.d.ts +11 -0
- package/dist/tests/data/config.d.ts +2 -0
- package/dist/tests/data/credentials.data.d.ts +12 -0
- package/dist/tests/data/index.d.ts +7 -0
- package/dist/tests/data/merchants.d.ts +8 -0
- package/dist/tests/data/system.d.ts +47 -0
- package/dist/tests/data/user.d.ts +32 -0
- package/dist/tests/data/wallet.data.d.ts +69 -0
- package/dist/types/auth.d.ts +60 -3
- package/dist/types/base.d.ts +1 -1
- package/dist/types/common.d.ts +5 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/storage.d.ts +13 -0
- package/dist/types/transactions.d.ts +5 -2
- package/dist/types/wallet.d.ts +73 -27
- package/package.json +3 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { Base } from '../../base';
|
|
2
|
+
import { AddTokenToWalletRequest, AddTokenToWalletResponse, ConvertToAlgorandSeedPhraseRequest, ConvertMnemonicSeedPhraseResponse, CreateWalletRequest, CreateWalletResponse, EncryptionMechanism, QueryUserRequest, QueryWalletRequest, TokenBalanceRequest, TokenBalanceResponse, UpdateAssetRequest, UpdateAssetResponse, UserAssetsResponse, UserWalletsResponse, WallabyConfig, WalletAssetsResponse, ExportWalletRequest, RetrieveKeySharesResponse, RecoverWalletResponse, ImportWalletRequest, ImportWalletResponse } from '../../types';
|
|
3
|
+
export declare class WalletService extends Base {
|
|
4
|
+
private authService;
|
|
5
|
+
private cipher;
|
|
6
|
+
constructor(config: WallabyConfig);
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
* Exports a encrypted shares and/or encrypted seedPhrase(s).
|
|
10
|
+
*
|
|
11
|
+
* @param {string} wallabyAuthPublicKey - Wallaby auth public key. Can be passed from [AuthResponse] (`signIn` | `signUp`)
|
|
12
|
+
* @param {EncryptionMechanism} encryptionMechanism - The mechanism used for encrypting the wallet data.
|
|
13
|
+
* @param {string} [password] - The password for additional encryption, if required.
|
|
14
|
+
* @param {Uint8Array} [prfValue] - The PRF value for encryption, used if applicable.
|
|
15
|
+
* @param {object} exportOptions - Specifies the options for exporting the wallet:
|
|
16
|
+
* - { boolean } standardSeedPhrase - Includes the standard seed phrase (bip32 standard 24 words mnemonic) in the export.
|
|
17
|
+
* - { boolean } algorandSeedPhrase - Includes the Algorand seed phrase (25 words mnemonic) in the export.
|
|
18
|
+
* - { boolean } keyShares - Includes key shares in the export.
|
|
19
|
+
*/
|
|
20
|
+
export({ walletId, wallabyAuthPublicKey, prfValue, password, encryptionMechanism, exportOptions }: ExportWalletRequest): Promise<{
|
|
21
|
+
keyShares: any[] | undefined;
|
|
22
|
+
standardSeedPhrase: string | undefined;
|
|
23
|
+
algorandSeedPhrase: string | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* Creates a new wallet, returns assets list, encrypted shares and/or encrypted seedPhrase.
|
|
29
|
+
*
|
|
30
|
+
* @param { boolean } storeSeedPhrase An option to either store the encrypted seed phrase from the response or to only return it in the response.
|
|
31
|
+
* @param { ReturnWalletOption } returnWalletOption An enum `@link ReturnWalletOption` for what options to return
|
|
32
|
+
* - `RETURN_ONLY_ENCRYPTED_SHARES` An option to split the seed phrase into multiple shares. It only return the shares based on a threshold.
|
|
33
|
+
* - `RETURN_ONLY_ENCRYPTED_SEED_PHRASE` An option to only return a seed phrase. (Similar to how v1 works)
|
|
34
|
+
* - `RETURN_BOTH_ENCRYPTED_SHARES_AND_SEED` An option to split the seed phrase and to add it to the response.
|
|
35
|
+
* @param authenticationOptions parameters carried from the authentication request (`signIn` | `signUp`)
|
|
36
|
+
* - { EncryptionMechanism } encryptionMechanism - The mechanism used for encryption.
|
|
37
|
+
* - { object } [user] - User details, required if `publicKey` is not available and 'prf' is the encryption mechanism:
|
|
38
|
+
* - { string } id - The user's unique identifier.
|
|
39
|
+
* - { string } firstName - The user's first name.
|
|
40
|
+
* - { string } email - The user's email address.
|
|
41
|
+
* - {PublicKeyCredential } [publicKey] - Used if the user is already registered.
|
|
42
|
+
* - { Uint8Array } [prfValue] - PRF value, used if 'prf' encryption is applied.
|
|
43
|
+
* - { string } [password] - The user's password, if required for encryption.
|
|
44
|
+
* - { string } [salt] - The salt value for password-based encryption.
|
|
45
|
+
* @param [keyShareOptions] - Required if the return option involves seed splitting (`RETURN_ONLY_ENCRYPTED_SHARES` or `RETURN_BOTH_ENCRYPTED_SHARES_AND_SEED`):
|
|
46
|
+
* - { number } `threshold`
|
|
47
|
+
* - { number } `numberOfKeyShares`
|
|
48
|
+
* - { number } `numberOfSharesReturned`
|
|
49
|
+
* - { boolean } `storeOneKeyShareWithWallaby`
|
|
50
|
+
* @returns {ImportWalletResponse} The wallet has been created successfully.
|
|
51
|
+
*/
|
|
52
|
+
import(input: ImportWalletRequest): Promise<ImportWalletResponse>;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
* Creates a new wallet, returns assets list, encrypted shares and/or encrypted seedPhrase.
|
|
57
|
+
*
|
|
58
|
+
* @param { boolean } storeSeedPhrase An option to either store the encrypted seed phrase from the response or to only return it in the response.
|
|
59
|
+
* @param { ReturnWalletOption } returnWalletOption An enum `@link ReturnWalletOption` for what options to return
|
|
60
|
+
* - `RETURN_ONLY_ENCRYPTED_SHARES` An option to split the seed phrase into multiple shares. It only return the shares based on a threshold.
|
|
61
|
+
* - `RETURN_ONLY_ENCRYPTED_SEED_PHRASE` An option to only return a seed phrase. (Similar to how v1 works)
|
|
62
|
+
* - `RETURN_BOTH_ENCRYPTED_SHARES_AND_SEED` An option to split the seed phrase and to add it to the response.
|
|
63
|
+
* @param authenticationOptions parameters carried from the authentication request (`signIn` | `signUp`)
|
|
64
|
+
* - { EncryptionMechanism } encryptionMechanism - The mechanism used for encryption.
|
|
65
|
+
* - { object } [user] - User details, required if `publicKey` is not available and 'prf' is the encryption mechanism:
|
|
66
|
+
* - { string } id - The user's unique identifier.
|
|
67
|
+
* - { string } firstName - The user's first name.
|
|
68
|
+
* - { string } email - The user's email address.
|
|
69
|
+
* - {PublicKeyCredential } [publicKey] - Used if the user is already registered.
|
|
70
|
+
* - { Uint8Array } [prfValue] - PRF value, used if 'prf' encryption is applied.
|
|
71
|
+
* - { string } [password] - The user's password, if required for encryption.
|
|
72
|
+
* - { string } [salt] - The salt value for password-based encryption.
|
|
73
|
+
* @param [keyShareOptions] - Required if the return option involves seed splitting (`RETURN_ONLY_ENCRYPTED_SHARES` or `RETURN_BOTH_ENCRYPTED_SHARES_AND_SEED`):
|
|
74
|
+
* - { number } `threshold`
|
|
75
|
+
* - { number } `numberOfKeyShares`
|
|
76
|
+
* - { number } `numberOfSharesReturned`
|
|
77
|
+
* - { boolean } `storeOneKeyShareWithWallaby`
|
|
78
|
+
* @returns {CreateWalletResponse} The wallet has been created successfully.
|
|
79
|
+
*/
|
|
80
|
+
create(input: CreateWalletRequest): Promise<CreateWalletResponse>;
|
|
81
|
+
recover(input: {
|
|
82
|
+
walletId: string;
|
|
83
|
+
decryptedShares?: string[];
|
|
84
|
+
decryptedSeedPhrase?: string;
|
|
85
|
+
authenticationOptions: {
|
|
86
|
+
encryptionMechanism: EncryptionMechanism;
|
|
87
|
+
user?: {
|
|
88
|
+
id: string;
|
|
89
|
+
firstName: string;
|
|
90
|
+
email: string;
|
|
91
|
+
};
|
|
92
|
+
publicKey?: PublicKeyCredential;
|
|
93
|
+
prfValue?: Uint8Array;
|
|
94
|
+
password?: string;
|
|
95
|
+
salt?: string;
|
|
96
|
+
};
|
|
97
|
+
keyShareOptions?: {
|
|
98
|
+
threshold: number;
|
|
99
|
+
numberOfKeyShares: number;
|
|
100
|
+
numberOfSharesReturned: number;
|
|
101
|
+
storeOneKeyShareWithWallaby: boolean;
|
|
102
|
+
};
|
|
103
|
+
storeSeedPhrase: boolean;
|
|
104
|
+
wallabyAuthPubKey: string;
|
|
105
|
+
}): Promise<RecoverWalletResponse | {
|
|
106
|
+
standardSeedPhrase: string | undefined;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* @public
|
|
110
|
+
* Retrieves the encrypted shares for a specified wallet
|
|
111
|
+
*
|
|
112
|
+
* @param {string} walletId - The Wallaby wallet ID.
|
|
113
|
+
* @param {string} [password] - The password for decrypting the shares, if required.
|
|
114
|
+
* @param {Uint8Array} [prfValue] - The PRF value used for encryption, if applicable.
|
|
115
|
+
* @param {EncryptionMechanism} encryptionMechanism - The mechanism used to encrypt the shares.
|
|
116
|
+
*
|
|
117
|
+
* @returns {Promise<EncryptedSharesResponse>} A promise that resolves with the encrypted shares.
|
|
118
|
+
*/
|
|
119
|
+
retrieveShares({ walletId, password, prfValue, encryptionMechanism, }: {
|
|
120
|
+
walletId: string;
|
|
121
|
+
password?: string;
|
|
122
|
+
prfValue?: Uint8Array;
|
|
123
|
+
encryptionMechanism: EncryptionMechanism;
|
|
124
|
+
}): Promise<RetrieveKeySharesResponse>;
|
|
125
|
+
/**
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
* Create a newly fresh wallet, returns asset list and encrypted seedPhrase
|
|
129
|
+
* @param { string } address Wallet address
|
|
130
|
+
* @param { string } symbol Token symbol
|
|
131
|
+
* @param { BlockchainName } chainName the chain name enum. i.e. 'ETHEREUM', 'BITCOIN'
|
|
132
|
+
* @returns { CreateWalletResponse } The wallet has been created successfully
|
|
133
|
+
*/
|
|
134
|
+
getTokenBalance({ address, symbol, tokenStandard, chainName, }: TokenBalanceRequest): Promise<TokenBalanceResponse | undefined>;
|
|
135
|
+
/**
|
|
136
|
+
*
|
|
137
|
+
* @public
|
|
138
|
+
* Fetches the balances for a group of tokens in bulk.
|
|
139
|
+
* Takes an array of addresses and tokens and return their balances.
|
|
140
|
+
* @param { string } address Wallet address
|
|
141
|
+
* @param { string } symbol Token symbol
|
|
142
|
+
* @param { BlockchainName } chainName the chain name enum. i.e. 'ETHEREUM', 'BITCOIN'
|
|
143
|
+
* @returns { TokenBalanceResponse[] } Returns an array of the requested tokens balances.
|
|
144
|
+
*/
|
|
145
|
+
getMultiTokenBalances(tokensAndAddressesList: TokenBalanceRequest[]): Promise<TokenBalanceResponse | undefined>;
|
|
146
|
+
/**
|
|
147
|
+
*
|
|
148
|
+
* @public
|
|
149
|
+
* Fetches the balances for all tokens in a specific wallet.
|
|
150
|
+
* @param { string } walletId Wallet address
|
|
151
|
+
* @returns { TokenBalanceResponse[] } Returns an array of the requested tokens balances.
|
|
152
|
+
*/
|
|
153
|
+
getWalletBalances({ walletId }: {
|
|
154
|
+
walletId: string;
|
|
155
|
+
}): Promise<TokenBalanceResponse[]>;
|
|
156
|
+
/**
|
|
157
|
+
*
|
|
158
|
+
* Get all user assets across all wallets by specifying user id
|
|
159
|
+
* @param userId Wallaby's user ID
|
|
160
|
+
* @param queryOptions Optional query options
|
|
161
|
+
* @returns {UserWalletsResponse} Returns an array of user assets by specifying user id
|
|
162
|
+
*/
|
|
163
|
+
getUserAssets({ userId, queryOptions }: QueryUserRequest): Promise<UserAssetsResponse | undefined>;
|
|
164
|
+
/**
|
|
165
|
+
*
|
|
166
|
+
* Get all wallets belonging to a user.
|
|
167
|
+
* @param userId Wallaby's user ID
|
|
168
|
+
* @returns {UserWalletsResponse} Returns an array of user wallets by specifying user ID
|
|
169
|
+
*/
|
|
170
|
+
getUserWallets({ userId, queryOptions }: QueryUserRequest): Promise<UserWalletsResponse | undefined>;
|
|
171
|
+
/**
|
|
172
|
+
*
|
|
173
|
+
* Get all assets that exist in a certain wallet, by specifying a wallet ID
|
|
174
|
+
* @param walletId Wallaby's wallet ID
|
|
175
|
+
* @param { BasicQueryOptions } queryOptions Optional query options
|
|
176
|
+
* @returns { WalletAssetsResponse } Returns all assets belonging in a certain wallet ID
|
|
177
|
+
*/
|
|
178
|
+
getWalletAssets({ walletId, queryOptions }: QueryWalletRequest): Promise<WalletAssetsResponse | undefined>;
|
|
179
|
+
/**
|
|
180
|
+
* Adds a token to the wallet.
|
|
181
|
+
*
|
|
182
|
+
* @param {string} params.assetConfigId - The asset configuration ID.
|
|
183
|
+
* @param {string} params.walletId - The wallet ID.
|
|
184
|
+
* @param {string} params.userId - The user ID.
|
|
185
|
+
* @param {Object} params.config - The configuration object.
|
|
186
|
+
* @param {string} [params.config.contractAddress] - The contract address.
|
|
187
|
+
* @param {string} [params.config.suiObjectId] - The Sui object ID.
|
|
188
|
+
* @param {string} params.config.chainName - The name of the blockchain.
|
|
189
|
+
*
|
|
190
|
+
* @returns {Promise<AddTokenToWalletResponse>} The response from adding the token to the wallet.
|
|
191
|
+
*
|
|
192
|
+
* @throws {Error} If required parameters are missing or invalid.
|
|
193
|
+
*/
|
|
194
|
+
addTokenToWallet({ assetConfigId, walletId, userId, config, }: AddTokenToWalletRequest): Promise<AddTokenToWalletResponse>;
|
|
195
|
+
/**
|
|
196
|
+
* Updates a wallet asset.
|
|
197
|
+
*
|
|
198
|
+
* @param {string} params.assetConfigId - Config ID for the user asset.
|
|
199
|
+
* @param {string} params.walletId - Wallet ID to which the asset belongs.
|
|
200
|
+
* @param {string} params.assetName - Asset name.
|
|
201
|
+
* @param {boolean} params.isVisible - Asset visibility toggle.
|
|
202
|
+
* @param {string} params.assetSymbol - Asset symbol.
|
|
203
|
+
*
|
|
204
|
+
* @returns {Promise<UpdateAssetResponse>} The response from updating the wallet token.
|
|
205
|
+
*
|
|
206
|
+
* @throws {Error} If required parameters are missing or invalid.
|
|
207
|
+
*/
|
|
208
|
+
updateAsset({ assetConfigId, walletId, ...assetConfig }: UpdateAssetRequest): Promise<UpdateAssetResponse>;
|
|
209
|
+
/**
|
|
210
|
+
*
|
|
211
|
+
* @public
|
|
212
|
+
* Convert BIP39 Standard seed phrase to Algorand fixed 25 words mnemonic phrase
|
|
213
|
+
* @param {string} password
|
|
214
|
+
* @returns {ConvertMnemonicSeedPhraseResponse} The mnemonic seed phrase has been converted successfully.
|
|
215
|
+
*/
|
|
216
|
+
getAlgorandSeedPhrase(input: ConvertToAlgorandSeedPhraseRequest): Promise<ConvertMnemonicSeedPhraseResponse>;
|
|
217
|
+
private handleImportWallet;
|
|
218
|
+
/**
|
|
219
|
+
* Handles the creation of a wallet, including generating signatures, validating input,
|
|
220
|
+
* and processing the wallet creation response.
|
|
221
|
+
* @private
|
|
222
|
+
* @param {Object} deviceAuthKeys - The device authentication key pair. { publicKey: string, privateKey: string}
|
|
223
|
+
* @param {CreateWalletRequest} walletCreationInput - The input parameters for wallet creation.
|
|
224
|
+
* @returns {Promise<Omit<CreateWalletResponse, 'standardSeedPhrase'> & { standardSeedPhrase?: string }>}
|
|
225
|
+
* The response from the wallet creation process, including the decrypted seed phrase if applicable.
|
|
226
|
+
* @throws {Error} If key share options are required but not provided, or if the number of shares is less than the threshold.
|
|
227
|
+
*/
|
|
228
|
+
private handleWalletCreation;
|
|
229
|
+
private handleKeySharesFromResponse;
|
|
230
|
+
private handleSeedPhraseFromResponse;
|
|
231
|
+
private handleRecoverFromSeedPhrase;
|
|
232
|
+
private handleConstructingSeedPhraseFromShares;
|
|
233
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wallaby-cash",
|
|
3
|
+
"version": "2.0.1-alpha.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git@github.com:WALLABY-WaaS/wallaby-sdk-js.git"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.cjs.js",
|
|
10
|
+
"module": "./dist/index.esm.js",
|
|
11
|
+
"commonjs": "./dist/index.cjs.js",
|
|
12
|
+
"react-native": "./dist/index.js",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"react-native": "./dist/index.js",
|
|
18
|
+
"default": "./dist/index.esm.js"
|
|
19
|
+
},
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.cjs.js"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=14"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"prebuild": "rimraf dist",
|
|
35
|
+
"build": "rollup --config --sourcemap --validate --bundleConfigAsCjs",
|
|
36
|
+
"build:prod": "npm run build --compact --environment production",
|
|
37
|
+
"build:dev": "rollup --config --bundleConfigAsCjs --watch",
|
|
38
|
+
"test": "NODE_ENV=test jest",
|
|
39
|
+
"test:watch": "NODE_ENV=test jest --watch",
|
|
40
|
+
"lint": "eslint .",
|
|
41
|
+
"typecheck": "tsc --noEmit",
|
|
42
|
+
"audit-ci": "npx audit-ci@^7 --config audit-ci.jsonc",
|
|
43
|
+
"docs:serve": "docsify serve -p 3100 ./docsify",
|
|
44
|
+
"docs:generate": "npx typedoc",
|
|
45
|
+
"release:dry": "semantic-release --dry-run",
|
|
46
|
+
"release": "npm publish --access-public",
|
|
47
|
+
"size": "size-limit --json"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
51
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
52
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
53
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
54
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
55
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
56
|
+
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
57
|
+
"@semantic-release/git": "^10.0.1",
|
|
58
|
+
"@semantic-release/github": "^8.0.7",
|
|
59
|
+
"@semantic-release/npm": "^12.0.0",
|
|
60
|
+
"@semantic-release/release-notes-generator": "^11.0.1",
|
|
61
|
+
"@size-limit/preset-small-lib": "^8.2.6",
|
|
62
|
+
"@types/crypto-js": "^4.2.2",
|
|
63
|
+
"@types/jest": "^29.5.0",
|
|
64
|
+
"@types/uuid": "^10.0.0",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^8.7.0",
|
|
66
|
+
"@typescript-eslint/parser": "^8.6.0",
|
|
67
|
+
"eslint": "^8.57.1",
|
|
68
|
+
"eslint-config-prettier": "^9.1.0",
|
|
69
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
70
|
+
"jest": "^29.7.0",
|
|
71
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
72
|
+
"nock": "^13.5.6",
|
|
73
|
+
"prettier": "^3.3.3",
|
|
74
|
+
"rimraf": "^5.0.7",
|
|
75
|
+
"rollup": "^4.18.0",
|
|
76
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
77
|
+
"rollup-plugin-filesize": "^10.0.0",
|
|
78
|
+
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
79
|
+
"semantic-release": "^23.0.8",
|
|
80
|
+
"size-limit": "^8.2.4",
|
|
81
|
+
"ts-jest": "^29.2.5",
|
|
82
|
+
"tslib": "^2.7.0",
|
|
83
|
+
"typedoc": "^0.26.7",
|
|
84
|
+
"typescript": "^5.3.3",
|
|
85
|
+
"underscore": "^1.13.7"
|
|
86
|
+
},
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"axios": "^1.7.7",
|
|
89
|
+
"crypto-js": "4.2.0",
|
|
90
|
+
"ethereum-cryptography": "^3.0.0",
|
|
91
|
+
"jwt-decode": "^4.0.0",
|
|
92
|
+
"loglevel": "^1.9.2",
|
|
93
|
+
"uuid": "^10.0.0"
|
|
94
|
+
},
|
|
95
|
+
"size-limit": [
|
|
96
|
+
{
|
|
97
|
+
"path": "dist/index.js",
|
|
98
|
+
"limit": "125 kB",
|
|
99
|
+
"platform": "node"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"path": "dist/index.cjs.js",
|
|
103
|
+
"limit": "125 kb",
|
|
104
|
+
"platform": "node"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"path": "dist/index.esm.js",
|
|
108
|
+
"limit": "125 kb",
|
|
109
|
+
"platform": "node"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
@@ -5,6 +5,11 @@ export declare const TransactionsRoutes: {
|
|
|
5
5
|
method: RequestMethod;
|
|
6
6
|
requiresAccessToken: boolean;
|
|
7
7
|
};
|
|
8
|
+
transferWithShares: {
|
|
9
|
+
fullPath: string;
|
|
10
|
+
method: RequestMethod;
|
|
11
|
+
requiresAccessToken: boolean;
|
|
12
|
+
};
|
|
8
13
|
createAllowance: {
|
|
9
14
|
fullPath: string;
|
|
10
15
|
method: RequestMethod;
|
package/dist/routes/wallet.d.ts
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { TokenBalanceRequest, QueryUserRequest, QueryWalletRequest, RequestMethod } from '../types';
|
|
2
2
|
export declare const WalletRoutes: {
|
|
3
|
+
importSeedPhraseV2: {
|
|
4
|
+
fullPath: string;
|
|
5
|
+
method: RequestMethod;
|
|
6
|
+
requiresAccessToken: boolean;
|
|
7
|
+
};
|
|
8
|
+
initKeyExchange: {
|
|
9
|
+
fullPath: string;
|
|
10
|
+
method: RequestMethod;
|
|
11
|
+
requiresAccessToken: boolean;
|
|
12
|
+
};
|
|
13
|
+
retrieveSeedPhrase: {
|
|
14
|
+
fullPath: string;
|
|
15
|
+
method: RequestMethod;
|
|
16
|
+
requiresAccessToken: boolean;
|
|
17
|
+
};
|
|
18
|
+
createWithKeyShares: {
|
|
19
|
+
fullPath: string;
|
|
20
|
+
method: RequestMethod;
|
|
21
|
+
requiresAccessToken: boolean;
|
|
22
|
+
};
|
|
23
|
+
retrieveShares: {
|
|
24
|
+
fullPath: string;
|
|
25
|
+
method: RequestMethod;
|
|
26
|
+
requiresAccessToken: boolean;
|
|
27
|
+
};
|
|
3
28
|
create: {
|
|
4
29
|
fullPath: string;
|
|
5
30
|
method: RequestMethod;
|
|
@@ -60,7 +85,7 @@ export declare const WalletRoutes: {
|
|
|
60
85
|
method: RequestMethod;
|
|
61
86
|
requiresAccessToken: boolean;
|
|
62
87
|
};
|
|
63
|
-
|
|
88
|
+
convertMnemonicSeedPhrase: {
|
|
64
89
|
fullPath: string;
|
|
65
90
|
method: RequestMethod;
|
|
66
91
|
requiresAccessToken: boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class LocalStorageMock implements Storage {
|
|
2
|
+
store: Record<string, string>;
|
|
3
|
+
constructor();
|
|
4
|
+
get length(): number;
|
|
5
|
+
key(index: number): string | null;
|
|
6
|
+
clear(): void;
|
|
7
|
+
getItem(key: string): string | null;
|
|
8
|
+
setItem(key: string, value: any): void;
|
|
9
|
+
removeItem(key: string): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export declare enum AssetConfigStatus {
|
|
2
|
+
Active = "active",
|
|
3
|
+
Inactive = "inactive"
|
|
4
|
+
}
|
|
5
|
+
export declare enum MerchantStatus {
|
|
6
|
+
Active = "active",
|
|
7
|
+
Inactive = "inactive",
|
|
8
|
+
Invalidated = "invalidated"
|
|
9
|
+
}
|
|
10
|
+
export type Address = {
|
|
11
|
+
type: string;
|
|
12
|
+
address: string;
|
|
13
|
+
publicKey: string;
|
|
14
|
+
};
|
|
15
|
+
export type Config = {
|
|
16
|
+
id: string;
|
|
17
|
+
chainId: string;
|
|
18
|
+
merchantId: string;
|
|
19
|
+
chainName: string;
|
|
20
|
+
name: string;
|
|
21
|
+
symbol: string;
|
|
22
|
+
verified: boolean;
|
|
23
|
+
isOffChain: boolean;
|
|
24
|
+
decimals: number;
|
|
25
|
+
iconUrl: string;
|
|
26
|
+
ticker: string;
|
|
27
|
+
type: string;
|
|
28
|
+
tokenStandard: string | null;
|
|
29
|
+
assetIndex: number | null;
|
|
30
|
+
contractAddress: string | null;
|
|
31
|
+
testnetContractAddress: string | null;
|
|
32
|
+
description: string | null;
|
|
33
|
+
ownershipType: string;
|
|
34
|
+
multisigVersion: number;
|
|
35
|
+
multisigSignerThreshold: number;
|
|
36
|
+
ownerAddresses: string | null;
|
|
37
|
+
status: AssetConfigStatus;
|
|
38
|
+
createdByUserId: string | null;
|
|
39
|
+
createdByMerchantId: string | null;
|
|
40
|
+
};
|
|
41
|
+
export type Merchant = {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
nameSlugify: string;
|
|
45
|
+
verified: boolean;
|
|
46
|
+
contactEmail: string | null;
|
|
47
|
+
contactPhoneNumber: string | null;
|
|
48
|
+
usersCount: number;
|
|
49
|
+
assetsCount: number;
|
|
50
|
+
tokensCount: number;
|
|
51
|
+
coinsCount: number;
|
|
52
|
+
walletsCount: number;
|
|
53
|
+
status: MerchantStatus;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
updatedAt: string;
|
|
56
|
+
};
|
|
57
|
+
export type UserAsset = {
|
|
58
|
+
id: string;
|
|
59
|
+
userId: string;
|
|
60
|
+
merchantId: string;
|
|
61
|
+
chainId: string;
|
|
62
|
+
userAssetAddress: string;
|
|
63
|
+
walletId: string;
|
|
64
|
+
configId: string;
|
|
65
|
+
assetName: string;
|
|
66
|
+
assetSymbol: string;
|
|
67
|
+
balance: number | null;
|
|
68
|
+
balanceUpdatedAt: string | null;
|
|
69
|
+
lockedTokenBalance: number | null;
|
|
70
|
+
lockedTokenBalanceUpdatedAt: string | null;
|
|
71
|
+
mainnetBalance: number | null;
|
|
72
|
+
mainnetBalanceUpdatedAt: string | null;
|
|
73
|
+
testnetBalance: number | null;
|
|
74
|
+
testnetBalanceUpdatedAt: string | null;
|
|
75
|
+
mainnetLockedBalance: number | null;
|
|
76
|
+
mainnetLockedBalanceUpdatedAt: string | null;
|
|
77
|
+
testnetLockedBalance: number | null;
|
|
78
|
+
testnetLockedBalanceUpdatedAt: string | null;
|
|
79
|
+
defaultAddress: string;
|
|
80
|
+
isVisible: boolean;
|
|
81
|
+
source: string;
|
|
82
|
+
addresses: Address[];
|
|
83
|
+
ownershipType: string;
|
|
84
|
+
createdAt: string;
|
|
85
|
+
updatedAt: string;
|
|
86
|
+
config: Config;
|
|
87
|
+
merchant: Merchant;
|
|
88
|
+
};
|
|
89
|
+
export declare const userAssets: UserAsset[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const signatureMessageMockResponse: {
|
|
2
|
+
message: string;
|
|
3
|
+
hashedMessage: string;
|
|
4
|
+
signature: string;
|
|
5
|
+
decryptedClientAuthPrivKey: string;
|
|
6
|
+
clientAuthPubKey: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const testClientJWTKeyPair: {
|
|
9
|
+
privateKey: string;
|
|
10
|
+
publicKey: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const credentials: {
|
|
2
|
+
deviceAuthPublicKey: string;
|
|
3
|
+
deviceAuthPrivateKey: string;
|
|
4
|
+
encryptedDeviceAuthPrivateKey: {
|
|
5
|
+
iv: string;
|
|
6
|
+
ephemPublicKey: string;
|
|
7
|
+
ciphertext: string;
|
|
8
|
+
mac: string;
|
|
9
|
+
};
|
|
10
|
+
signature: string;
|
|
11
|
+
wallabyPublicKey: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const mockBlockchainsResponse: {
|
|
2
|
+
chains: {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
derivationPath: string;
|
|
6
|
+
addressRegex: string;
|
|
7
|
+
slip44: number;
|
|
8
|
+
indexUrl: string;
|
|
9
|
+
rpcUrl: string;
|
|
10
|
+
chainId: string;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
export declare const mockTokensResponse: {
|
|
14
|
+
assets: {
|
|
15
|
+
chainId: string;
|
|
16
|
+
chainName: string;
|
|
17
|
+
name: string;
|
|
18
|
+
symbol: string;
|
|
19
|
+
type: string;
|
|
20
|
+
tokenStandard: string;
|
|
21
|
+
assetIndex: number;
|
|
22
|
+
description: string;
|
|
23
|
+
ownershipType: string;
|
|
24
|
+
multisigVersion: number;
|
|
25
|
+
multisigSignerThreshold: number;
|
|
26
|
+
chain: {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
derivationPath: string;
|
|
30
|
+
addressRegex: string;
|
|
31
|
+
slip44: number;
|
|
32
|
+
indexUrl: string;
|
|
33
|
+
rpcUrl: string;
|
|
34
|
+
chainId: string;
|
|
35
|
+
};
|
|
36
|
+
}[];
|
|
37
|
+
};
|
|
38
|
+
export declare const mockUserData: {
|
|
39
|
+
user: {
|
|
40
|
+
id: string;
|
|
41
|
+
externalUserId: string;
|
|
42
|
+
firstName: string;
|
|
43
|
+
lastName: string;
|
|
44
|
+
latestWallabyAuthPubKey: string;
|
|
45
|
+
latestWallabyAuthPubKeyVersion: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const testUser: {
|
|
2
|
+
id: string;
|
|
3
|
+
wallabyUserId: string;
|
|
4
|
+
wrongId: string;
|
|
5
|
+
algoAddress: string;
|
|
6
|
+
firstName: string;
|
|
7
|
+
lastName: string;
|
|
8
|
+
email: string;
|
|
9
|
+
password: string;
|
|
10
|
+
salt: string;
|
|
11
|
+
wrongPassword: string;
|
|
12
|
+
message: string;
|
|
13
|
+
hashedMessage: string;
|
|
14
|
+
signature: string;
|
|
15
|
+
wallabyAuthPublicKey: string;
|
|
16
|
+
privateKey: string;
|
|
17
|
+
encryptedPrivateKey: string;
|
|
18
|
+
publicKey: string;
|
|
19
|
+
seedPhrase: string;
|
|
20
|
+
testAccessToken: string;
|
|
21
|
+
testInputKeyMaterial: number[];
|
|
22
|
+
passkeyResponseClientJSONData: {
|
|
23
|
+
type: string;
|
|
24
|
+
challenge: string;
|
|
25
|
+
origin: string;
|
|
26
|
+
crossOrigin: boolean;
|
|
27
|
+
};
|
|
28
|
+
seedPhraseEncryptedWithTestInputKeyMaterial: string;
|
|
29
|
+
passkeyCredentialId: string;
|
|
30
|
+
merchantId: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const braveWalletSeed = "drastic ask cause noise potato phrase fix accuse spare million bronze brain";
|