wallaby-cash 2.0.4 → 2.0.5
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/generated/api.d.ts +66 -288
- package/dist/index.cjs.js +27 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +27 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +27 -23
- package/dist/index.js.map +1 -1
- package/dist/lib/transactions/index.d.ts +2 -3
- package/dist/lib/wallet/wallet-handlers.service.d.ts +2 -2
- package/dist/package.json +1 -1
- package/dist/types/common.d.ts +1 -0
- package/dist/types/transactions.d.ts +8 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -70,6 +70,14 @@ var TransportEnum;
|
|
|
70
70
|
TransportEnum["Hybrid"] = "hybrid";
|
|
71
71
|
})(TransportEnum || (TransportEnum = {}));
|
|
72
72
|
|
|
73
|
+
const isWallabyError = (obj) => {
|
|
74
|
+
return (!!obj &&
|
|
75
|
+
typeof obj === 'object' &&
|
|
76
|
+
'statusCode' in obj &&
|
|
77
|
+
'message' in obj &&
|
|
78
|
+
typeof obj.statusCode === 'number' &&
|
|
79
|
+
(obj.statusCode >= 400 || 'error' in obj));
|
|
80
|
+
};
|
|
73
81
|
var UserAssetSource;
|
|
74
82
|
(function (UserAssetSource) {
|
|
75
83
|
UserAssetSource["Merchant"] = "merchant";
|
|
@@ -10908,9 +10916,9 @@ class Transactions extends Base {
|
|
|
10908
10916
|
throw new Error('No valid seed option found on this device.');
|
|
10909
10917
|
}
|
|
10910
10918
|
if (!transferResponse ||
|
|
10911
|
-
transferResponse
|
|
10919
|
+
isWallabyError(transferResponse) ||
|
|
10912
10920
|
(typeof transferResponse === 'object' && Object.keys(transferResponse).length === 0)) {
|
|
10913
|
-
throw new Error(transferResponse
|
|
10921
|
+
throw new Error(isWallabyError(transferResponse) ? transferResponse.error : 'Unknown error');
|
|
10914
10922
|
}
|
|
10915
10923
|
return transferResponse;
|
|
10916
10924
|
}
|
|
@@ -10956,30 +10964,26 @@ class Transactions extends Base {
|
|
|
10956
10964
|
logger.debug('Migration to V2 failed, continuing with original flow:', error);
|
|
10957
10965
|
}
|
|
10958
10966
|
}
|
|
10959
|
-
const { deviceAuthPublicKey, signatureMessage, readyForTransportSeedPhrase } = await this.prepareTransactionAuth(authenticationOptions, walletId);
|
|
10967
|
+
const { deviceAuthPublicKey, signatureMessage, readyForTransportSeedPhrase, sharesEncryptedWithWallabyPubKey, hasShares } = await this.prepareTransactionAuth(authenticationOptions, walletId);
|
|
10960
10968
|
const { message, signature } = signatureMessage;
|
|
10961
|
-
// Create allowance
|
|
10962
|
-
if (!readyForTransportSeedPhrase) {
|
|
10963
|
-
throw new Error('
|
|
10969
|
+
// Create allowance requires either a seed phrase or key shares
|
|
10970
|
+
if (!readyForTransportSeedPhrase && !hasShares) {
|
|
10971
|
+
throw new Error('No valid seed option found on this device.');
|
|
10964
10972
|
}
|
|
10973
|
+
const payload = Object.assign({ message,
|
|
10974
|
+
walletId,
|
|
10975
|
+
authenticationOptions,
|
|
10976
|
+
signature, clientAuthPubKey: deviceAuthPublicKey, ownerAddress,
|
|
10977
|
+
spenderAddress,
|
|
10978
|
+
chainName,
|
|
10979
|
+
assetSymbol,
|
|
10980
|
+
amount,
|
|
10981
|
+
assetId, contractAddress: contractAddress !== null && contractAddress !== void 0 ? contractAddress : suiObjectId, reference,
|
|
10982
|
+
memo }, (hasShares ? { encryptedShares: sharesEncryptedWithWallabyPubKey } : { encryptedSeed: readyForTransportSeedPhrase }));
|
|
10965
10983
|
const response = await this.request(TransactionsRoutes.createAllowance, {
|
|
10966
|
-
payload
|
|
10967
|
-
message,
|
|
10968
|
-
signature,
|
|
10969
|
-
clientAuthPubKey: deviceAuthPublicKey,
|
|
10970
|
-
encryptedSeed: readyForTransportSeedPhrase,
|
|
10971
|
-
ownerAddress,
|
|
10972
|
-
spenderAddress,
|
|
10973
|
-
chainName,
|
|
10974
|
-
assetSymbol,
|
|
10975
|
-
amount,
|
|
10976
|
-
assetId,
|
|
10977
|
-
contractAddress: contractAddress !== null && contractAddress !== void 0 ? contractAddress : suiObjectId,
|
|
10978
|
-
reference,
|
|
10979
|
-
memo,
|
|
10980
|
-
},
|
|
10984
|
+
payload,
|
|
10981
10985
|
});
|
|
10982
|
-
if (response
|
|
10986
|
+
if (isWallabyError(response)) {
|
|
10983
10987
|
throw new Error(response.error);
|
|
10984
10988
|
}
|
|
10985
10989
|
return response;
|
|
@@ -11112,5 +11116,5 @@ class Wallaby {
|
|
|
11112
11116
|
}
|
|
11113
11117
|
}
|
|
11114
11118
|
|
|
11115
|
-
export { AddressType, AndroidVersionNotSupportedError, ApiKeyStatus, AssetConfigStatus, AssetType, AuthType, AuthenticatorGeneralError, AuthenticatorMissingDiscoverableCredentialSupportError, AuthenticatorMissingUserVerificationSupportError, AuthenticatorNoSupportedPubKeyCredParamsAlgError, AuthenticatorNotRegisteredError, AuthenticatorPreviouslyRegisteredError, AutoRegisterUserVerificationFailureError, BadConfiguration, BlockchainName, BlockchainSlip44, BlockchainStatus, CeremonyAbortedError, ErrorResponseCodes, IOSVersionNotSupportedError, InterruptedError, InvalidChallengeError, InvalidDomainError, InvalidRpIdError, InvalidStateError, InvalidUserIdError, InvalidUserIdLengthError, KeyTypeName, LegacyKeyNames, LocalStorageItems, MalformedPubKeyCredParamsError, NativeError, NoCredentialsError, NotAllowedError, OwnershipType, PasskeyChallengeType, PasskeyErrorCodes, PassthroughSeeCausePropertyError, PublicKeyCredentialAlgorithm, RequestFailedError, RequestMethod, ReturnWalletOption, SeedPhraseType, TimeoutError, TokenStandard, TransactionEntryType, TransportEnum, UnknownError, UserAssetSource, UserCancelledError, V1KeyNames, V2KeyNames, Wallaby, Api as WallabyApiClient, HttpClient as WallabyHttpClient, WalletAddressTypeName, WalletOwnershipType, createIdentity, decryptWithPrivateKey, encryptWithPublicKey, hash, keccak256, publicKeyByPrivateKey, recoverPublicKey, sign };
|
|
11119
|
+
export { AddressType, AndroidVersionNotSupportedError, ApiKeyStatus, AssetConfigStatus, AssetType, AuthType, AuthenticatorGeneralError, AuthenticatorMissingDiscoverableCredentialSupportError, AuthenticatorMissingUserVerificationSupportError, AuthenticatorNoSupportedPubKeyCredParamsAlgError, AuthenticatorNotRegisteredError, AuthenticatorPreviouslyRegisteredError, AutoRegisterUserVerificationFailureError, BadConfiguration, BlockchainName, BlockchainSlip44, BlockchainStatus, CeremonyAbortedError, ErrorResponseCodes, IOSVersionNotSupportedError, InterruptedError, InvalidChallengeError, InvalidDomainError, InvalidRpIdError, InvalidStateError, InvalidUserIdError, InvalidUserIdLengthError, KeyTypeName, LegacyKeyNames, LocalStorageItems, MalformedPubKeyCredParamsError, NativeError, NoCredentialsError, NotAllowedError, OwnershipType, PasskeyChallengeType, PasskeyErrorCodes, PassthroughSeeCausePropertyError, PublicKeyCredentialAlgorithm, RequestFailedError, RequestMethod, ReturnWalletOption, SeedPhraseType, TimeoutError, TokenStandard, TransactionEntryType, TransportEnum, UnknownError, UserAssetSource, UserCancelledError, V1KeyNames, V2KeyNames, Wallaby, Api as WallabyApiClient, HttpClient as WallabyHttpClient, WalletAddressTypeName, WalletOwnershipType, createIdentity, decryptWithPrivateKey, encryptWithPublicKey, hash, isWallabyError, keccak256, publicKeyByPrivateKey, recoverPublicKey, sign };
|
|
11116
11120
|
//# sourceMappingURL=index.js.map
|