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.
Files changed (39) hide show
  1. package/dist/base.d.ts +1 -1
  2. package/dist/helpers/base64.d.ts +2 -0
  3. package/dist/index.cjs.js +6858 -5370
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.d.ts +3 -3
  6. package/dist/index.esm.js +6859 -5371
  7. package/dist/index.esm.js.map +1 -1
  8. package/dist/index.js +6859 -5371
  9. package/dist/index.js.map +1 -1
  10. package/dist/lib/auth/auth.service.d.ts +51 -0
  11. package/dist/lib/auth/index.d.ts +1 -58
  12. package/dist/lib/transactions/index.d.ts +17 -15
  13. package/dist/lib/utils/cipher.service.d.ts +81 -0
  14. package/dist/lib/utils/constants.d.ts +20 -0
  15. package/dist/lib/utils/index.d.ts +1 -9
  16. package/dist/lib/utils/storage.service.d.ts +11 -67
  17. package/dist/lib/wallet/index.d.ts +1 -189
  18. package/dist/lib/wallet/wallet.service.d.ts +233 -0
  19. package/dist/package.json +112 -0
  20. package/dist/routes/transactions.d.ts +5 -0
  21. package/dist/routes/wallet.d.ts +26 -1
  22. package/dist/tests/__mocks__/localStorageMock.d.ts +10 -0
  23. package/dist/tests/data/assets.d.ts +89 -0
  24. package/dist/tests/data/auth.d.ts +11 -0
  25. package/dist/tests/data/config.d.ts +2 -0
  26. package/dist/tests/data/credentials.data.d.ts +12 -0
  27. package/dist/tests/data/index.d.ts +7 -0
  28. package/dist/tests/data/merchants.d.ts +8 -0
  29. package/dist/tests/data/system.d.ts +47 -0
  30. package/dist/tests/data/user.d.ts +32 -0
  31. package/dist/tests/data/wallet.data.d.ts +69 -0
  32. package/dist/types/auth.d.ts +60 -3
  33. package/dist/types/base.d.ts +1 -1
  34. package/dist/types/common.d.ts +5 -0
  35. package/dist/types/index.d.ts +1 -0
  36. package/dist/types/storage.d.ts +13 -0
  37. package/dist/types/transactions.d.ts +5 -2
  38. package/dist/types/wallet.d.ts +73 -27
  39. package/package.json +3 -1
@@ -0,0 +1,51 @@
1
+ import { Base } from '../../base';
2
+ import { EncryptionMechanism, SignatureMessageResponse, WallabyConfig, AuthResponse, RefreshAccessTokenResponse, AuthenticationRequest, ClientAuthPubKeyResponse, SignInRequest } from '../../types';
3
+ import { Cipher } from '../utils/cipher.service';
4
+ export declare class AuthService extends Base {
5
+ readonly cipher: Cipher;
6
+ constructor(config: WallabyConfig);
7
+ getPasskeyCredential(): Promise<string>;
8
+ getStoredSeedPhrase(): Promise<string>;
9
+ /**
10
+ * @description
11
+ * The user salt is used to double encrypt the seed phrase before being stored
12
+ * in local storage.
13
+ * @returns {string} Returns user's salt that is generated by Wallaby system
14
+ */
15
+ getUserSalt(): Promise<string>;
16
+ /**
17
+ * @description
18
+ * It registers the client's device public key with Wallaby server and gets back a random message string.
19
+ * The random string will be hashed and signed by the client's device private key and sent back to Wallaby for verification.
20
+ * @returns a JWT encoded with users's externalUserId
21
+ */
22
+ getSignature(deviceAuthKeys: {
23
+ publicKey: string;
24
+ privateKey: string;
25
+ }): Promise<SignatureMessageResponse>;
26
+ signUp(input: AuthenticationRequest): Promise<AuthResponse>;
27
+ signIn(input: SignInRequest): Promise<AuthResponse>;
28
+ private handleSignInWithPassword;
29
+ private handlePasskeyRegistration;
30
+ private handleSignInWithPasskey;
31
+ /**
32
+ *
33
+ * @public
34
+ * Refreshes the access token stored in local storage.
35
+ * @returns {string} The new access token
36
+ */
37
+ refreshAuthTokens(): Promise<RefreshAccessTokenResponse | undefined>;
38
+ /**
39
+ * This method is used to refresh the device auth key pair.
40
+ * @param {string} password
41
+ * @returns {User} User object
42
+ */
43
+ updateClientAuthPubKey({ password, encryptionMechanism, }: {
44
+ password: string;
45
+ encryptionMechanism: EncryptionMechanism;
46
+ }): Promise<ClientAuthPubKeyResponse | undefined>;
47
+ private handleSignUpWithPassword;
48
+ private handleSignUpWithPasskey;
49
+ private constructPasskeyAuthenticationPublicKey;
50
+ private constructPasskeyRegistrationPublicKey;
51
+ }
@@ -1,58 +1 @@
1
- import { Base } from '../../base';
2
- import { SignatureMessageResponse, AuthRequest, AuthResponse, WallabyConfig, ClientAuthPubKeyRequest, RefreshAccessTokenResponse, ClientAuthPubKeyResponse } from '../../types';
3
- export declare class Auth extends Base {
4
- constructor(config: WallabyConfig);
5
- /**
6
- * Authenticates a user by either signing them in or signing them up based on the presence of existing credentials.
7
- *
8
- * @param { string } password - The user's password.
9
- * @returns {Promise<AuthResponse>} - A promise that resolves to the authentication response.
10
- */
11
- authenticate({ password }: AuthRequest): Promise<AuthResponse>;
12
- /**
13
- *
14
- * @public
15
- * The returned message will be used to authorize the user to sign operations
16
- * @param {string} password
17
- * @returns {SignatureMessageResponse} The returned message will be used for sign up and sign in signature
18
- */
19
- signatureMessage({ password }: AuthRequest): Promise<SignatureMessageResponse>;
20
- /**
21
- *
22
- * @public
23
- * Users will be able to sign in by providing a signature and message. Use the same key pair used on sign up'
24
- * @param { string } password
25
- * @param { string } firstName
26
- * @param { string } lastName
27
- * @param { string } email
28
- * @returns { AuthResponse | undefined }
29
- */
30
- signUp({ password }: AuthRequest): Promise<AuthResponse | undefined>;
31
- /**
32
- *
33
- * @public
34
- * Users will be able to sign in by providing a signature and message, the device auth public key and their signature.
35
- * @param { string } password password is used decrypt the device auth private key.
36
- * @returns { AuthResponse | undefined } Once the user is signed in, the response will contain the user object and the access token.
37
- */
38
- signIn({ password }: AuthRequest): Promise<AuthResponse | undefined>;
39
- /**
40
- *
41
- * @public
42
- * Refreshes the access token stored in local storage.
43
- * @returns {string} The new access token
44
- */
45
- refreshAccessToken(): Promise<RefreshAccessTokenResponse | undefined>;
46
- /**
47
- * This method is used to refresh the device auth key pair.
48
- * @param {string} password
49
- * @returns {User} User object
50
- */
51
- updateClientAuthPubKey({ password, }: Pick<ClientAuthPubKeyRequest, 'password'>): Promise<ClientAuthPubKeyResponse | undefined>;
52
- /**
53
- * The user salt is used to double encrypt the seed phrase before being stored
54
- * in local storage.
55
- * @returns {string} Returns user's salt that is generated by Wallaby system
56
- */
57
- getUserSalt(): Promise<string>;
58
- }
1
+ export * from './auth.service';
@@ -2,7 +2,8 @@ import { Base } from '../../base';
2
2
  import { WallabyConfig, BlockchainName, TokenStandard } from '../../types';
3
3
  import { CreateAllowanceRequest, FeeEstimateRequest, FeeEstimatesResponse, Transaction, TransactionStatusResponse, TransferRequest, TransactionResponse } from '../../types';
4
4
  export declare class Transactions extends Base {
5
- private auth;
5
+ private authService;
6
+ private cipher;
6
7
  private utils;
7
8
  constructor(config: WallabyConfig);
8
9
  /**
@@ -18,19 +19,6 @@ export declare class Transactions extends Base {
18
19
  * @returns {FeeEstimateRequest}
19
20
  */
20
21
  estimateFee({ originAddress, recipientAddress, amount, assetSymbol, transactionType, tokenStandard, blockchain, }: FeeEstimateRequest): Promise<FeeEstimatesResponse | undefined>;
21
- /**
22
- *
23
- * @public
24
- * @param {string} originAddress
25
- * @param {string} recipientAddress
26
- * @param {number} amount
27
- * @param {string} assetId
28
- * @param {string} reference
29
- * @param {string} memo
30
- * @param {string} password
31
- * @returns {TransactionResponse} Transaction object which contains the transaction hash and status
32
- */
33
- transfer({ originAddress, recipientAddress, amount, assetId, reference, memo, password, }: TransferRequest): Promise<TransactionResponse | undefined>;
34
22
  /**
35
23
  *
36
24
  * @public
@@ -62,6 +50,20 @@ export declare class Transactions extends Base {
62
50
  transactions: Transaction[];
63
51
  error?: any;
64
52
  } | undefined>;
53
+ /**
54
+ *
55
+ * @public
56
+ * @param {string} originAddress
57
+ * @param {string} recipientAddress
58
+ * @param {number} amount
59
+ * @param {string} assetId
60
+ * @param {string} reference
61
+ * @param {string} memo
62
+ * @param {string} password
63
+ * @returns {TransactionResponse} Transaction object which contains the transaction hash and status
64
+ */
65
+ transfer({ originAddress, recipientAddress, amount, assetId, reference, encryptionMechanism, wallabyAuthPublicKey, prfValue, memo, password, }: TransferRequest): Promise<TransactionResponse | undefined>;
66
+ transferWithShares({ originAddress, recipientAddress, amount, assetId, reference, encryptionMechanism, prfValue, memo, password, wallabyAuthPublicKey, }: TransferRequest): Promise<TransactionResponse | undefined>;
65
67
  /**
66
68
  *
67
69
  * @public
@@ -77,5 +79,5 @@ export declare class Transactions extends Base {
77
79
  * @returns {CreateAllowanceResponse}
78
80
  *
79
81
  */
80
- createAllowance({ password, ownerAddress, spenderAddress, amount, assetId, suiObjectId, contractAddress, reference, memo, }: CreateAllowanceRequest): Promise<TransactionResponse | undefined>;
82
+ createAllowance({ password, prfValue, encryptionMechanism, wallabyAuthPublicKey, ownerAddress, spenderAddress, amount, assetId, suiObjectId, contractAddress, reference, memo, }: CreateAllowanceRequest): Promise<TransactionResponse | undefined>;
81
83
  }
@@ -0,0 +1,81 @@
1
+ import { DeviceInformation, SignatureResponse, EncryptionMechanism, Encrypted } from '../../types';
2
+ export declare class Cipher {
3
+ private device;
4
+ constructor(device: Promise<DeviceInformation>);
5
+ /**
6
+ * @description Signs a message using the provided private key.
7
+ *
8
+ * @param {string} message - A random string.
9
+ * @param {string} privateKey - The private key to sign the message with.
10
+ * @returns { Object } The signed message, including the original message, the signature, and the hashed message.
11
+ */
12
+ sign({ message, privateKey }: {
13
+ message: string;
14
+ privateKey: string;
15
+ }): SignatureResponse;
16
+ /**
17
+ * @description Encrypts the data with the given key material.
18
+ * @param { string } data
19
+ * @param { Uint8Array } inputKeyMaterial
20
+ * @returns The encrypted data as a string or undefined if it can't encrypt it.
21
+ */
22
+ encrypt: ({ data, inputKeyMaterial }: {
23
+ data: string;
24
+ inputKeyMaterial: Uint8Array;
25
+ }) => Promise<Encrypted | undefined>;
26
+ /**
27
+ * @description Decrypts the data with the given key material.
28
+ * @param { string } cipherText
29
+ * @param { Uint8Array } inputKeyMaterial
30
+ * @returns The decrypted data as a string or undefined if it can't decrypt it.
31
+ */
32
+ decrypt: ({ cipherText, inputKeyMaterial }: {
33
+ cipherText: string;
34
+ inputKeyMaterial: Uint8Array;
35
+ }) => Promise<string | undefined>;
36
+ deriveKeyPairFromPassKey({ inputKeyMaterial }: {
37
+ inputKeyMaterial: Uint8Array;
38
+ }): Promise<{
39
+ privateKey: string;
40
+ publicKey: string;
41
+ }>;
42
+ deriveKeyPairFromPassword({ password, salt }: {
43
+ password: string;
44
+ salt: string;
45
+ }): Promise<{
46
+ privateKey: string;
47
+ publicKey: string;
48
+ }>;
49
+ /**
50
+ *
51
+ * @description it prepares the seed phrase for transport by unwrapping it twice.
52
+ * The first layer is encrypted with the device's private key.
53
+ * The second layer is encrypted with the user's password.
54
+ * Then it gets wrapped by the wallaby's public key.
55
+ * @param { string } password
56
+ * @returns Ready to transport seed phrase encrypted with wallaby's public key.
57
+ */
58
+ prepDataForTransport({ storedEncryptedData, password, prfValue, encryptionMechanism, wallabyAuthPublicKey, getUserSalt, }: {
59
+ storedEncryptedData: string;
60
+ encryptionMechanism: EncryptionMechanism;
61
+ wallabyAuthPublicKey: string;
62
+ prfValue?: Uint8Array;
63
+ password?: string;
64
+ getUserSalt?: () => Promise<string>;
65
+ }): Promise<Encrypted>;
66
+ getInputKeyMaterial({ password, salt, prfValue, encryptionMechanism, }: {
67
+ encryptionMechanism: EncryptionMechanism;
68
+ password?: string;
69
+ salt?: string;
70
+ prfValue?: Uint8Array;
71
+ }): Promise<Uint8Array>;
72
+ prepDataForDisplay({ storedEncryptedData, password, prfValue, decryptedDevicePrivateKey, encryptionMechanism, salt, }: {
73
+ storedEncryptedData: string;
74
+ encryptionMechanism: EncryptionMechanism;
75
+ decryptedDevicePrivateKey: string;
76
+ wallabyAuthPublicKey: string;
77
+ prfValue?: Uint8Array;
78
+ password?: string;
79
+ salt?: string;
80
+ }): Promise<string>;
81
+ }
@@ -1,3 +1,4 @@
1
+ import { PublicKeyCredentialAlgorithm } from '../../types';
1
2
  /**
2
3
  * The default environment will be set to NODE_ENV if environment is not set in config.
3
4
  * For production builds, it is recommended to set NODE_ENV to 'production'.
@@ -9,3 +10,22 @@ export declare const defaultEnvironment: string;
9
10
  */
10
11
  export declare const defaultNetwork = "testnet";
11
12
  export declare const isTest: boolean;
13
+ export declare const SALT_BITE_SIZE = 32;
14
+ export declare const IV_BYTE_SIZE = 12;
15
+ export declare const PUBLIC_KEY_CREDENTIAL_TIMEOUT = 60000;
16
+ export declare const DEFAULT_ENTROPY_BYTES = 32;
17
+ /**
18
+ * In the options for a Web Authentication credential registration request, the caller can specify a list of cryptographic algorithm identifiers in the pubKeyCredParams field.
19
+ If left unspecified, Chrome uses the default values of ES256 (-7) and RS256 (-257).
20
+ In some situations, a Relying Party developer might choose to augment this list with other identifiers.
21
+ However, developers should be aware that excluding either of the default identifiers has compatibility risks.
22
+ In particular, RS256 is necessary for compatibility with Microsoft Windows platform authenticators.
23
+ ES256 is a widely supported algorithm and is compatible with most other platform authenticators and roaming authenticators.
24
+ Therefore a Relying Party that uses an algorithm identifier list that omits either of those values will see registration failures when users attempt to use incompatible authenticators.
25
+
26
+ https://chromium.googlesource.com/chromium/src/+/main/content/browser/webauth/pub_key_cred_params.md
27
+ */
28
+ export declare const PUBLIC_KEY_CREDENTIAL_PARAM: {
29
+ type: PublicKeyCredentialType;
30
+ alg: PublicKeyCredentialAlgorithm;
31
+ }[];
@@ -1,4 +1,4 @@
1
- import { UtilsResponse, PasswordValidatorResponse, WallabyConfig, RequestMethod, Encrypted } from '../../types';
1
+ import { UtilsResponse, PasswordValidatorResponse, WallabyConfig, RequestMethod } from '../../types';
2
2
  import { Base } from '../../base';
3
3
  export declare class Utils extends Base {
4
4
  private auth;
@@ -23,14 +23,6 @@ export declare class Utils extends Base {
23
23
  encryptedPrivateKey: string;
24
24
  password: string;
25
25
  }) => string | undefined;
26
- /**
27
- *
28
- * @param { string } password
29
- * @returns Ready to transport seed phrase encrypted with wallaby's public key.
30
- */
31
- prepSeedPhraseForTransport({ password }: {
32
- password: string;
33
- }): Promise<Encrypted>;
34
26
  fetchFromEndpoint({ endpoint, method, requiresAccessToken, payload, }: {
35
27
  endpoint: string;
36
28
  method: RequestMethod;
@@ -1,80 +1,24 @@
1
- import { DeviceInformation, SeedPhraseType } from '../../types';
2
- import { LocalStorage } from 'src/types/storage';
3
- declare class StorageService {
1
+ import { DeviceInformation } from '../../types';
2
+ import { LocalStorage, LocalStorageItems } from '../../types/storage';
3
+ export declare class StorageService {
4
4
  private environment;
5
5
  private userId;
6
- private clientAuthToken;
7
6
  private deviceStorage;
8
- constructor({ deviceStorage, userId, clientAuthToken, environment, }: {
7
+ constructor({ deviceStorage, userId, environment }: {
9
8
  deviceStorage: LocalStorage;
10
9
  userId: string;
11
- clientAuthToken: string;
12
10
  environment?: string;
13
11
  });
14
- /** derive storage functions */
12
+ fetch(key: LocalStorageItems): Promise<string | undefined>;
13
+ save(key: LocalStorageItems, value: string): Promise<void>;
14
+ saveInBulk(data: {
15
+ key: LocalStorageItems;
16
+ value: string;
17
+ }[]): Promise<void>;
18
+ delete(key: LocalStorageItems): Promise<void>;
15
19
  private setItem;
16
20
  private getItem;
17
21
  private removeItem;
18
- /**
19
- *
20
- * Stores Wallaby auth public key to local storage
21
- * @param wallabyAuthPubKey
22
- */
23
- setWallabyAuthPubKey(wallabyAuthPubKey: string): Promise<boolean>;
24
- /**
25
- *
26
- * Fetches Wallaby auth public key from local storage
27
- * @returns { string | undefined } Wallaby Auth Public key or undefined.
28
- */
29
- getWallabyAuthPubKey(): Promise<string | undefined>;
30
- /**
31
- *
32
- * Encrypts and stores device auth private key
33
- * @param privateKey private key
34
- * @param password password that is used to encrypt the private key
35
- */
36
- setEncryptedPrivateKey(privateKey: string, password: string): Promise<boolean>;
37
- /**
38
- *
39
- * Fetches encrypted private key from local storage
40
- * @param userId
41
- */
42
- getEncryptedPrivateKey(): Promise<string | undefined>;
43
- /**
44
- *
45
- * Decrypts user private key
46
- * @param password
47
- * @returns { string | undefined } It returns the decrypted private key as a string or undefined if it can't decrypt it or find it
48
- */
49
- getDecryptedPrivateKey(password: string): Promise<string | undefined>;
50
- setEncryptedSeedPhrase({ decryptedSeedPhrase, seedPhraseType, password, deviceAuthPublicKey, getUserSalt, }: {
51
- decryptedSeedPhrase: string;
52
- seedPhraseType: SeedPhraseType;
53
- password: string;
54
- deviceAuthPublicKey: string;
55
- getUserSalt: () => Promise<string>;
56
- }): Promise<boolean>;
57
- /**
58
- *
59
- * @param { SeedPhraseType } seedPhraseType Standard or Mnemonic seed phrase
60
- * @returns { string | undefined } It returns the encrypted seed phrase as a string or undefined
61
- */
62
- getEncryptedSeedPhrase(seedPhraseType: SeedPhraseType): Promise<string | undefined>;
63
- /**
64
- *
65
- * @param {string} password
66
- * @param {SeedPhraseType} seedPhraseType
67
- * @returns { string | undefined } It returns the decrypted seed phrase as a string or undefined
68
- */
69
- getDecryptedSeedPhrase({ password, seedPhraseType, getUserSalt, }: {
70
- password: string;
71
- seedPhraseType: SeedPhraseType;
72
- getUserSalt: () => Promise<string>;
73
- }): Promise<string | undefined>;
74
- setAccessToken(accessToken: string): Promise<boolean>;
75
- getAccessToken(): Promise<string | undefined>;
76
22
  clearLocalStorage(): Promise<void>;
77
23
  loadDeviceInformation(): Promise<DeviceInformation>;
78
- private getMerchantId;
79
24
  }
80
- export default StorageService;
@@ -1,189 +1 @@
1
- import { Base } from '../../base';
2
- import { QueryUserRequest, CreateWalletRequest, CreateWalletResponse, RecoverWalletRequest, RecoverWalletResponse, TokenBalanceRequest, TokenBalanceResponse, WallabyError, QueryWalletRequest, UserAssetsResponse, UserWalletsResponse, WalletAssetsResponse, WallabyConfig, ConvertMnemonicSeedPhraseRequest, ConvertMnemonicSeedPhraseResponse, CreateMultisigAssetRequest, CreateMultisigAssetResponse, ImportWalletRequest, ImportWalletResponse, AddTokenToWalletRequest, AddTokenToWalletResponse, UpdateAssetRequest, UpdateAssetResponse } from '../../types';
3
- export declare class Wallet extends Base {
4
- private auth;
5
- constructor(config: WallabyConfig);
6
- /**
7
- *
8
- * @public
9
- * Retrieve the user's mnemonic seed phrases
10
- * @param password User's wallet password
11
- * @returns { Promise<{standardSeedPhrase: string, algorandSeedPhrase: string}> }
12
- * @deprecated This function has been renamed to `export` and will be removed in the next major release.
13
- * It returns the user's standard (24 words) and algorand (25 words) seed phrases
14
- */
15
- mnemonicSeedPhrase({ password, }: {
16
- password: string;
17
- }): Promise<{
18
- standardSeedPhrase: string;
19
- algorandSeedPhrase: string;
20
- }>;
21
- /**
22
- *
23
- * @public
24
- * Create a newly fresh wallet, returns asset list and encrypted seedPhrase
25
- * @param { string } address Wallet address
26
- * @param { string } symbol Token symbol
27
- * @param { BlockchainName } chainName the chain name enum. i.e. 'ETHEREUM', 'BITCOIN'
28
- * @returns { CreateWalletResponse } The wallet has been created successfully
29
- */
30
- getTokenBalance({ address, symbol, tokenStandard, chainName, }: TokenBalanceRequest): Promise<TokenBalanceResponse | undefined>;
31
- /**
32
- *
33
- * @public
34
- * Fetches the balances for a group of tokens in bulk.
35
- * Takes an array of addresses and tokens and return their balances.
36
- * @param { string } address Wallet address
37
- * @param { string } symbol Token symbol
38
- * @param { BlockchainName } chainName the chain name enum. i.e. 'ETHEREUM', 'BITCOIN'
39
- * @returns { TokenBalanceResponse[] } Returns an array of the requested tokens balances.
40
- */
41
- getMultiTokenBalances(tokensAndAddressesList: TokenBalanceRequest[]): Promise<TokenBalanceResponse | undefined>;
42
- /**
43
- *
44
- * @public
45
- * Fetches the balances for all tokens in a specific wallet.
46
- * @param { string } walletId Wallet address
47
- * @returns { TokenBalanceResponse[] } Returns an array of the requested tokens balances.
48
- */
49
- getWalletBalances({ walletId }: {
50
- walletId: string;
51
- }): Promise<TokenBalanceResponse[]>;
52
- /**
53
- *`
54
- * @public
55
- * Create a newly fresh wallet, returns asset list and encrypted seedPhrase
56
- * @returns {CreateWalletResponse} The wallet has been created successfully
57
- */
58
- create({ password }: {
59
- password: string;
60
- }): Promise<CreateWalletResponse | WallabyError>;
61
- /**
62
- *
63
- * @public
64
- * Creates a fresh wallet and always signs user up with using a new external user ID
65
- * @param {string} password The user's chosen password
66
- * @returns {CreateWalletResponse} Assets list and encrypted seedPhrase.
67
- */
68
- createWithNewAccount({ password }: Pick<CreateWalletRequest, 'password'>): Promise<CreateWalletResponse | WallabyError>;
69
- /**
70
- *
71
- * @public
72
- * Import an existing wallet, returns asset list and encrypted seedPhrase
73
- * @param {string} password The user's chosen password
74
- * @param {string} seedPhrase The user's seed phrase
75
- * @returns {ImportWalletResponse} The wallet has been imported successfully
76
- * The return includes the wallet, wallet assets, and the encrypted seedphrase
77
- */
78
- import({ password, seedPhrase }: ImportWalletRequest): Promise<ImportWalletResponse>;
79
- /**
80
- *
81
- * @public
82
- * Retrieve the user's mnemonic seed phrases
83
- * @param password User's wallet password
84
- * @returns { Promise<{standardSeedPhrase: string, algorandSeedPhrase: string}> }
85
- * It returns the user's standard (24 words) and algorand (25 words) seed phrases
86
- */
87
- export({ password }: {
88
- password: string;
89
- }): Promise<{
90
- standardSeedPhrase: string;
91
- algorandSeedPhrase: string;
92
- }>;
93
- /**
94
- *
95
- * @public
96
- * Removes all Wallaby data from local storage.
97
- * @returns {Boolean}
98
- */
99
- clearDevice(): Promise<boolean>;
100
- /**
101
- *
102
- * @public
103
- * Convert BIP39 Standard seed phrase to Algorand fixed 25 words mnemonic phrase
104
- * @param {string} password
105
- * @param {Encrypted} encryptedSeedPhrase It needs to be encypted using wallabyAuthPubKey
106
- * @returns {ConvertMnemonicSeedPhraseResponse} The mnemonic seed phrase has been converted successfully.
107
- */
108
- convertToAlgorandSeedPhrase({ password, encryptedSeedPhrase, }: Pick<ConvertMnemonicSeedPhraseRequest, 'password' | 'encryptedSeedPhrase'>): Promise<ConvertMnemonicSeedPhraseResponse>;
109
- /**
110
- *
111
- * @public
112
- * Recover the lost wallet and its assets.
113
- * @param {string} newPassword User need to set a new password while recovering the wallet
114
- * @param {string} seedPhrase It needs to be encypted using wallabyAuthPubKey
115
- * @returns {RecoverWalletResponse} The wallet has been recovered successfully.
116
- */
117
- recover({ newPassword, seedPhrase, }: Omit<RecoverWalletRequest, 'clientAuthPubKey'>): Promise<(RecoverWalletResponse & {
118
- seedPhrase: string;
119
- decryptedAlgorandSeedphrase: string;
120
- }) | undefined>;
121
- /**
122
- *
123
- * Get all user assets across all wallets by specifying user id
124
- * @param userId Wallaby's user ID
125
- * @param queryOptions Optional query options
126
- * @returns {UserWalletsResponse} Returns an array of user assets by specifying user id
127
- */
128
- getUserAssets({ userId, queryOptions }: QueryUserRequest): Promise<UserAssetsResponse | undefined>;
129
- /**
130
- *
131
- * Get all wallets belonging to a user.
132
- * @param userId Wallaby's user ID
133
- * @returns {UserWalletsResponse} Returns an array of user wallets by specifying user ID
134
- */
135
- getUserWallets({ userId, queryOptions }: QueryUserRequest): Promise<UserWalletsResponse | undefined>;
136
- /**
137
- *
138
- * Get all assets that exist in a certain wallet, by specifying a wallet ID
139
- * @param walletId Wallaby's wallet ID
140
- * @param { BasicQueryOptions } queryOptions Optional query options
141
- * @returns { WalletAssetsResponse } Returns all assets belonging in a certain wallet ID
142
- */
143
- getWalletAssets({ walletId, queryOptions }: QueryWalletRequest): Promise<WalletAssetsResponse | undefined>;
144
- /**
145
- *
146
- * @public
147
- * @deprecated
148
- * Initiate creation for a new multisig asset, by specifying participants and the threshold
149
- * @param {string} assetSymbol Asset symbol
150
- * @param {string} tokenType Optional value only used when dealing with non native assets (aka tokens), If native asset, keep the field empty
151
- * @param {number} threshold The threshold is the number of signatures required to sign a transaction
152
- * @param {string} creatorAddress The address of the account that is initiating the multisig asset creation
153
- * @param {Array} participants The array containing the addresses of the users requested to participate in the multisig
154
- * @param {number} version Version of the multi-sig
155
- * @returns {CreateMultisigAssetResponse} Multisig asset was created successfully
156
- */
157
- createMultisigAsset({ assetSymbol, tokenType, threshold, creatorAddress, participants, version, }: CreateMultisigAssetRequest): Promise<CreateMultisigAssetResponse>;
158
- /**
159
- * Adds a token to the wallet.
160
- *
161
- * @param {string} params.assetConfigId - The asset configuration ID.
162
- * @param {string} params.walletId - The wallet ID.
163
- * @param {string} params.userId - The user ID.
164
- * @param {Object} params.config - The configuration object.
165
- * @param {string} [params.config.contractAddress] - The contract address.
166
- * @param {string} [params.config.suiObjectId] - The Sui object ID.
167
- * @param {string} params.config.chainName - The name of the blockchain.
168
- *
169
- * @returns {Promise<AddTokenToWalletResponse>} The response from adding the token to the wallet.
170
- *
171
- * @throws {Error} If required parameters are missing or invalid.
172
- */
173
- addTokenToWallet({ assetConfigId, walletId, userId, config, }: AddTokenToWalletRequest): Promise<AddTokenToWalletResponse>;
174
- /**
175
- * Updates a wallet asset.
176
- *
177
- * @param {string} params.assetConfigId - Config ID for the user asset.
178
- * @param {string} params.walletId - Wallet ID to which the asset belongs.
179
- * @param {string} params.assetName - Asset name.
180
- * @param {boolean} params.isVisible - Asset visibility toggle.
181
- * @param {string} params.assetSymbol - Asset symbol.
182
- *
183
- * @returns {Promise<UpdateAssetResponse>} The response from updating the wallet token.
184
- *
185
- * @throws {Error} If required parameters are missing or invalid.
186
- */
187
- updateAsset({ assetConfigId, walletId, ...assetConfig }: UpdateAssetRequest): Promise<UpdateAssetResponse>;
188
- private initRecoveryFlow;
189
- }
1
+ export * from './wallet.service';