@dynamic-labs-sdk/client 1.25.0 → 1.27.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/client/core/createCore/createCore.d.ts.map +1 -1
- package/dist/client/core/types/DynamicCore.d.ts +11 -0
- package/dist/client/core/types/DynamicCore.d.ts.map +1 -1
- package/dist/core.cjs +6 -5
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +6 -6
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +6 -6
- package/dist/core.native.esm.js.map +1 -1
- package/dist/errors/CoinbaseTransferMfaFailedError.d.ts +34 -0
- package/dist/errors/CoinbaseTransferMfaFailedError.d.ts.map +1 -0
- package/dist/errors/CoinbaseTransferMfaRequiredError.d.ts +37 -0
- package/dist/errors/CoinbaseTransferMfaRequiredError.d.ts.map +1 -0
- package/dist/errors/CoinbaseTravelRuleRequiredError.d.ts +55 -0
- package/dist/errors/CoinbaseTravelRuleRequiredError.d.ts.map +1 -0
- package/dist/errors/TransactionBroadcastError.d.ts +44 -0
- package/dist/errors/TransactionBroadcastError.d.ts.map +1 -0
- package/dist/exports/core.d.ts +2 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +17 -1
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +3 -1
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/exports/waasCore.d.ts +1 -1
- package/dist/exports/waasCore.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-DCvqxwoP.esm.js → getNetworkProviderFromNetworkId-CIKbNKdk.esm.js} +27 -3
- package/dist/getNetworkProviderFromNetworkId-CIKbNKdk.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-CN0fhJMJ.native.esm.js → getNetworkProviderFromNetworkId-CsZBSoWG.native.esm.js} +29 -5
- package/dist/getNetworkProviderFromNetworkId-CsZBSoWG.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-CtXKqsri.cjs → getNetworkProviderFromNetworkId-DmLtSJC9.cjs} +32 -2
- package/dist/{getNetworkProviderFromNetworkId-DCvqxwoP.esm.js.map → getNetworkProviderFromNetworkId-DmLtSJC9.cjs.map} +1 -1
- package/dist/{getSignedSessionId-B3aCjPhf.native.esm.js → getSignedSessionId-BIz9qPIB.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-B3aCjPhf.native.esm.js.map → getSignedSessionId-BIz9qPIB.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-DIn697B6.cjs → getSignedSessionId-B_NkNNim.cjs} +3 -3
- package/dist/{getSignedSessionId-DIn697B6.cjs.map → getSignedSessionId-B_NkNNim.cjs.map} +1 -1
- package/dist/{getSignedSessionId-BmL1vPnC.esm.js → getSignedSessionId-CV4WePdo.esm.js} +3 -3
- package/dist/{getSignedSessionId-BmL1vPnC.esm.js.map → getSignedSessionId-CV4WePdo.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-Pg1oNi-G.native.esm.js → getWalletProviderByKey-B7eSVPP5.native.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-Pg1oNi-G.native.esm.js.map → getWalletProviderByKey-B7eSVPP5.native.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-DtcD_nPD.cjs → getWalletProviderByKey-CRTAETJR.cjs} +2 -2
- package/dist/{getWalletProviderByKey-DtcD_nPD.cjs.map → getWalletProviderByKey-CRTAETJR.cjs.map} +1 -1
- package/dist/{getWalletProviderByKey-Dm7Ey9SI.esm.js → getWalletProviderByKey-W0eocsJF.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-Dm7Ey9SI.esm.js.map → getWalletProviderByKey-W0eocsJF.esm.js.map} +1 -1
- package/dist/index.cjs +528 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +516 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +516 -10
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isDynamicWaasEnabled-BC2gR0R1.esm.js → isDynamicWaasEnabled-1CgDWfqH.esm.js} +34 -3
- package/dist/isDynamicWaasEnabled-1CgDWfqH.esm.js.map +1 -0
- package/dist/{isDynamicWaasEnabled-BWvSMhAP.cjs → isDynamicWaasEnabled-CMhy_gpM.cjs} +39 -2
- package/dist/isDynamicWaasEnabled-CMhy_gpM.cjs.map +1 -0
- package/dist/{isDynamicWaasEnabled-B75AeGiP.native.esm.js → isDynamicWaasEnabled-DkcnybRZ.native.esm.js} +34 -3
- package/dist/isDynamicWaasEnabled-DkcnybRZ.native.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-ncRFYLGn.esm.js → isMfaRequiredForAction-BOgi2PMg.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-ncRFYLGn.esm.js.map → isMfaRequiredForAction-BOgi2PMg.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-WmEokgKF.native.esm.js → isMfaRequiredForAction-DGfi_fNE.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-WmEokgKF.native.esm.js.map → isMfaRequiredForAction-DGfi_fNE.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-Dr44C3-l.cjs → isMfaRequiredForAction-DnUUklVz.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-Dr44C3-l.cjs.map → isMfaRequiredForAction-DnUUklVz.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-G6Hf8p_v.native.esm.js → isUserOnboardingComplete-C-VfVV0L.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-G6Hf8p_v.native.esm.js.map → isUserOnboardingComplete-C-VfVV0L.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-B9vzjs71.cjs → isUserOnboardingComplete-CIOYKiII.cjs} +3 -3
- package/dist/{isUserOnboardingComplete-B9vzjs71.cjs.map → isUserOnboardingComplete-CIOYKiII.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-B-J8O4KB.esm.js → isUserOnboardingComplete-Dg8M45Ba.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-B-J8O4KB.esm.js.map → isUserOnboardingComplete-Dg8M45Ba.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-fY2IrQgU.esm.js → migrateFromFireblocks-Ch5R5fWp.esm.js} +3 -3
- package/dist/{migrateFromFireblocks-fY2IrQgU.esm.js.map → migrateFromFireblocks-Ch5R5fWp.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-MbP1ajwI.cjs → migrateFromFireblocks-LZXyDEH6.cjs} +3 -3
- package/dist/{migrateFromFireblocks-MbP1ajwI.cjs.map → migrateFromFireblocks-LZXyDEH6.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-kFz_kyA5.native.esm.js → migrateFromFireblocks-zHTABzLP.native.esm.js} +3 -3
- package/dist/{migrateFromFireblocks-kFz_kyA5.native.esm.js.map → migrateFromFireblocks-zHTABzLP.native.esm.js.map} +1 -1
- package/dist/modules/apiClient/utils/clientErrorMapper/clientErrorMapper.d.ts.map +1 -1
- package/dist/modules/auth/social/social.types.d.ts +1 -1
- package/dist/modules/auth/social/social.types.d.ts.map +1 -1
- package/dist/modules/funding/coinbase/coinbase.consts.d.ts +74 -0
- package/dist/modules/funding/coinbase/coinbase.consts.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/coinbase.types.d.ts +150 -1
- package/dist/modules/funding/coinbase/coinbase.types.d.ts.map +1 -1
- package/dist/modules/funding/coinbase/createCoinbaseExchangeTransfer/createCoinbaseExchangeTransfer.d.ts +83 -0
- package/dist/modules/funding/coinbase/createCoinbaseExchangeTransfer/createCoinbaseExchangeTransfer.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/createCoinbaseExchangeTransfer/index.d.ts +3 -0
- package/dist/modules/funding/coinbase/createCoinbaseExchangeTransfer/index.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/getCoinbaseAccounts/getCoinbaseAccounts.d.ts +41 -0
- package/dist/modules/funding/coinbase/getCoinbaseAccounts/getCoinbaseAccounts.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/getCoinbaseAccounts/index.d.ts +3 -0
- package/dist/modules/funding/coinbase/getCoinbaseAccounts/index.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/utils/parseCoinbaseTravelRuleMissingFields/index.d.ts +2 -0
- package/dist/modules/funding/coinbase/utils/parseCoinbaseTravelRuleMissingFields/index.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/utils/parseCoinbaseTravelRuleMissingFields/parseCoinbaseTravelRuleMissingFields.d.ts +26 -0
- package/dist/modules/funding/coinbase/utils/parseCoinbaseTravelRuleMissingFields/parseCoinbaseTravelRuleMissingFields.d.ts.map +1 -0
- package/dist/modules/swap/utils/ensureCorrectActiveNetwork/ensureCorrectActiveNetwork.d.ts.map +1 -1
- package/dist/modules/waas/broadcastWaasTransaction/broadcastWaasTransaction.d.ts +18 -0
- package/dist/modules/waas/broadcastWaasTransaction/broadcastWaasTransaction.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.d.ts +11 -0
- package/dist/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/listBusinessAccounts/listBusinessAccounts.d.ts +14 -2
- package/dist/modules/waas/businessAccounts/listBusinessAccounts/listBusinessAccounts.d.ts.map +1 -1
- package/dist/modules/waas/createWaasOfflineRecoveryShares/createWaasOfflineRecoveryShares.d.ts +31 -0
- package/dist/modules/waas/createWaasOfflineRecoveryShares/createWaasOfflineRecoveryShares.d.ts.map +1 -0
- package/dist/modules/waas/createWaasOfflineRecoveryShares/index.d.ts +2 -0
- package/dist/modules/waas/createWaasOfflineRecoveryShares/index.d.ts.map +1 -0
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/hasDelegatedAccess/hasDelegatedAccess.d.ts.map +1 -1
- package/dist/modules/waas/transactionBroadcastErrorMapper/transactionBroadcastErrorMapper.d.ts +8 -0
- package/dist/modules/waas/transactionBroadcastErrorMapper/transactionBroadcastErrorMapper.d.ts.map +1 -0
- package/dist/modules/waas/waas.types.d.ts +20 -0
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/modules/wallets/walletProviderRegistry/index.d.ts +2 -1
- package/dist/modules/wallets/walletProviderRegistry/index.d.ts.map +1 -1
- package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.consts.d.ts +34 -0
- package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.consts.d.ts.map +1 -0
- package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.types.d.ts +5 -21
- package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.types.d.ts.map +1 -1
- package/dist/modules/yield/getYieldDetails/getYieldDetails.d.ts +36 -0
- package/dist/modules/yield/getYieldDetails/getYieldDetails.d.ts.map +1 -0
- package/dist/modules/yield/getYieldDetails/index.d.ts +3 -0
- package/dist/modules/yield/getYieldDetails/index.d.ts.map +1 -0
- package/dist/modules/yield/getYieldPosition/getYieldPosition.d.ts +37 -0
- package/dist/modules/yield/getYieldPosition/getYieldPosition.d.ts.map +1 -0
- package/dist/modules/yield/getYieldPosition/index.d.ts +3 -0
- package/dist/modules/yield/getYieldPosition/index.d.ts.map +1 -0
- package/dist/modules/yield/getYieldRewards/getYieldRewards.d.ts +39 -0
- package/dist/modules/yield/getYieldRewards/getYieldRewards.d.ts.map +1 -0
- package/dist/modules/yield/getYieldRewards/index.d.ts +3 -0
- package/dist/modules/yield/getYieldRewards/index.d.ts.map +1 -0
- package/dist/modules/yield/listYieldVaults/index.d.ts +2 -0
- package/dist/modules/yield/listYieldVaults/index.d.ts.map +1 -0
- package/dist/modules/yield/listYieldVaults/listYieldVaults.d.ts +23 -0
- package/dist/modules/yield/listYieldVaults/listYieldVaults.d.ts.map +1 -0
- package/dist/modules/yield/yield.types.d.ts +60 -0
- package/dist/modules/yield/yield.types.d.ts.map +1 -0
- package/dist/services/appForeground/appForeground.types.d.ts +36 -0
- package/dist/services/appForeground/appForeground.types.d.ts.map +1 -0
- package/dist/services/appForeground/createAppForegroundSubscriber/createAppForegroundSubscriber.d.ts +12 -0
- package/dist/services/appForeground/createAppForegroundSubscriber/createAppForegroundSubscriber.d.ts.map +1 -0
- package/dist/services/appForeground/createAppForegroundSubscriber/index.d.ts +2 -0
- package/dist/services/appForeground/createAppForegroundSubscriber/index.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{updateAuthFromVerifyResponse-WlGmt2v0.native.esm.js → updateAuthFromVerifyResponse-BIWu4Bis.native.esm.js} +20 -26
- package/dist/updateAuthFromVerifyResponse-BIWu4Bis.native.esm.js.map +1 -0
- package/dist/{updateAuthFromVerifyResponse-D9kFrAkK.cjs → updateAuthFromVerifyResponse-D1QJtRk1.cjs} +20 -26
- package/dist/updateAuthFromVerifyResponse-D1QJtRk1.cjs.map +1 -0
- package/dist/{updateAuthFromVerifyResponse-ZzU46s0t.esm.js → updateAuthFromVerifyResponse-DU4h_W6v.esm.js} +20 -26
- package/dist/updateAuthFromVerifyResponse-DU4h_W6v.esm.js.map +1 -0
- package/dist/utils/assertChainName/assertChainName.d.ts +15 -0
- package/dist/utils/assertChainName/assertChainName.d.ts.map +1 -0
- package/dist/utils/assertChainName/index.d.ts +2 -0
- package/dist/utils/assertChainName/index.d.ts.map +1 -0
- package/dist/waas.cjs +52 -9
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +52 -11
- package/dist/waas.esm.js.map +1 -1
- package/dist/waas.native.esm.js +52 -11
- package/dist/waas.native.esm.js.map +1 -1
- package/dist/waasCore.cjs +105 -6
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +106 -7
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +106 -7
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +4 -4
- package/dist/getNetworkProviderFromNetworkId-CN0fhJMJ.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-CtXKqsri.cjs.map +0 -1
- package/dist/isDynamicWaasEnabled-B75AeGiP.native.esm.js.map +0 -1
- package/dist/isDynamicWaasEnabled-BC2gR0R1.esm.js.map +0 -1
- package/dist/isDynamicWaasEnabled-BWvSMhAP.cjs.map +0 -1
- package/dist/updateAuthFromVerifyResponse-D9kFrAkK.cjs.map +0 -1
- package/dist/updateAuthFromVerifyResponse-WlGmt2v0.native.esm.js.map +0 -1
- package/dist/updateAuthFromVerifyResponse-ZzU46s0t.esm.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-
|
|
2
|
-
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-
|
|
3
|
-
const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-
|
|
4
|
-
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-
|
|
5
|
-
const require_getWalletProviderByKey = require('./getWalletProviderByKey-
|
|
6
|
-
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-
|
|
1
|
+
const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-D1QJtRk1.cjs');
|
|
2
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-DmLtSJC9.cjs');
|
|
3
|
+
const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-CMhy_gpM.cjs');
|
|
4
|
+
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-CIOYKiII.cjs');
|
|
5
|
+
const require_getWalletProviderByKey = require('./getWalletProviderByKey-CRTAETJR.cjs');
|
|
6
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-DnUUklVz.cjs');
|
|
7
7
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
8
8
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
9
9
|
let zod_mini = require("zod/mini");
|
|
@@ -978,6 +978,7 @@ const createCore = (config) => {
|
|
|
978
978
|
});
|
|
979
979
|
const fetch = config.coreConfig?.fetch ?? createWebFetch();
|
|
980
980
|
const openDeeplink = config.coreConfig?.openDeeplink ?? createDeeplinkOpener();
|
|
981
|
+
const subscribeToAppForeground = require_getNetworkProviderFromNetworkId.createAppForegroundSubscriber();
|
|
981
982
|
const openAuthSession = config.coreConfig?.openAuthSession;
|
|
982
983
|
const navigate = config.coreConfig?.navigate ?? createNavigationHandler();
|
|
983
984
|
const state = createObservableState(getInitialState);
|
|
@@ -1033,6 +1034,7 @@ const createCore = (config) => {
|
|
|
1033
1034
|
sdkSessionId,
|
|
1034
1035
|
state,
|
|
1035
1036
|
storage,
|
|
1037
|
+
subscribeToAppForeground,
|
|
1036
1038
|
transformers: config.transformers,
|
|
1037
1039
|
version: require_updateAuthFromVerifyResponse.version,
|
|
1038
1040
|
waas: config.waas
|
|
@@ -1158,6 +1160,150 @@ var CheckoutSessionTokenMissingError = class extends require_updateAuthFromVerif
|
|
|
1158
1160
|
}
|
|
1159
1161
|
};
|
|
1160
1162
|
|
|
1163
|
+
//#endregion
|
|
1164
|
+
//#region src/errors/CoinbaseTransferMfaFailedError.ts
|
|
1165
|
+
/**
|
|
1166
|
+
* Thrown when a {@link createCoinbaseExchangeTransfer} retry supplies an
|
|
1167
|
+
* `mfaCode` that Coinbase rejects -- the two-step verification code was
|
|
1168
|
+
* incorrect, or it expired before the retry was submitted. Coinbase's own
|
|
1169
|
+
* codes are short-lived, so this is expected to happen occasionally even
|
|
1170
|
+
* with correct user input; it does not mean the transfer itself is invalid.
|
|
1171
|
+
*
|
|
1172
|
+
* Coinbase does not automatically send a new code on this failure -- prompt
|
|
1173
|
+
* the user again and retry, which triggers
|
|
1174
|
+
* {@link CoinbaseTransferMfaRequiredError} again and, with it, a fresh code.
|
|
1175
|
+
*
|
|
1176
|
+
* @example
|
|
1177
|
+
* ```ts
|
|
1178
|
+
* const transferParams = { accountId, amount: 0.5, currency: 'USDC', to };
|
|
1179
|
+
* const submitWithMfaCode = (mfaCode: string) =>
|
|
1180
|
+
* createCoinbaseExchangeTransfer({ ...transferParams, mfaCode });
|
|
1181
|
+
*
|
|
1182
|
+
* try {
|
|
1183
|
+
* await submitWithMfaCode(mfaCode);
|
|
1184
|
+
* } catch (error) {
|
|
1185
|
+
* if (error instanceof CoinbaseTransferMfaFailedError) {
|
|
1186
|
+
* // wrong or expired code -- ask the user to try again
|
|
1187
|
+
* await createCoinbaseExchangeTransfer(transferParams);
|
|
1188
|
+
* }
|
|
1189
|
+
* }
|
|
1190
|
+
* ```
|
|
1191
|
+
* @see createCoinbaseExchangeTransfer
|
|
1192
|
+
* @see CoinbaseTransferMfaRequiredError
|
|
1193
|
+
*/
|
|
1194
|
+
var CoinbaseTransferMfaFailedError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1195
|
+
constructor({ cause }) {
|
|
1196
|
+
super({
|
|
1197
|
+
cause,
|
|
1198
|
+
code: "transfer_mfa_failed",
|
|
1199
|
+
docsUrl: null,
|
|
1200
|
+
name: "CoinbaseTransferMfaFailedError",
|
|
1201
|
+
shortMessage: "The Coinbase two-step verification code was incorrect or has expired. Retry createCoinbaseExchangeTransfer with a fresh 'mfaCode'."
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
};
|
|
1205
|
+
|
|
1206
|
+
//#endregion
|
|
1207
|
+
//#region src/errors/CoinbaseTransferMfaRequiredError.ts
|
|
1208
|
+
/**
|
|
1209
|
+
* Thrown when Coinbase rejects a {@link createCoinbaseExchangeTransfer} call
|
|
1210
|
+
* because the account holder's two-step verification ("2FA") is required to
|
|
1211
|
+
* authorize the transfer. This is unrelated to Dynamic's own step-up auth
|
|
1212
|
+
* (see {@link checkStepUpAuth}) -- it is a security requirement enforced by
|
|
1213
|
+
* Coinbase itself, on the Coinbase account being transferred from.
|
|
1214
|
+
*
|
|
1215
|
+
* The first `createCoinbaseExchangeTransfer` call for a transfer
|
|
1216
|
+
* automatically triggers Coinbase to send the account holder a verification
|
|
1217
|
+
* code (SMS, or push to an authenticator app such as Authy if one is
|
|
1218
|
+
* linked). Retry the *same* transfer with `mfaCode` set to that code before
|
|
1219
|
+
* it expires. If the code is wrong or has expired, the retry throws
|
|
1220
|
+
* {@link CoinbaseTransferMfaFailedError} instead, so a fresh code can be
|
|
1221
|
+
* requested and retried again.
|
|
1222
|
+
*
|
|
1223
|
+
* @example
|
|
1224
|
+
* ```ts
|
|
1225
|
+
* const transferParams = { accountId, amount: 0.5, currency: 'USDC', to };
|
|
1226
|
+
*
|
|
1227
|
+
* try {
|
|
1228
|
+
* await createCoinbaseExchangeTransfer(transferParams);
|
|
1229
|
+
* } catch (error) {
|
|
1230
|
+
* if (error instanceof CoinbaseTransferMfaRequiredError) {
|
|
1231
|
+
* // Coinbase already sent a code to the account holder -- prompt for it
|
|
1232
|
+
* const mfaCode = await promptUserForCoinbase2faCode();
|
|
1233
|
+
* await createCoinbaseExchangeTransfer({ ...transferParams, mfaCode });
|
|
1234
|
+
* }
|
|
1235
|
+
* }
|
|
1236
|
+
* ```
|
|
1237
|
+
* @see createCoinbaseExchangeTransfer
|
|
1238
|
+
* @see CoinbaseTransferMfaFailedError
|
|
1239
|
+
*/
|
|
1240
|
+
var CoinbaseTransferMfaRequiredError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1241
|
+
constructor({ cause }) {
|
|
1242
|
+
super({
|
|
1243
|
+
cause,
|
|
1244
|
+
code: "transfer_mfa_required",
|
|
1245
|
+
docsUrl: null,
|
|
1246
|
+
name: "CoinbaseTransferMfaRequiredError",
|
|
1247
|
+
shortMessage: "Coinbase requires a two-step verification code to complete this transfer. Coinbase has automatically sent the code to the account holder (SMS or authenticator app) -- retry createCoinbaseExchangeTransfer with 'mfaCode' set to that code before it expires."
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
//#endregion
|
|
1253
|
+
//#region src/errors/CoinbaseTravelRuleRequiredError.ts
|
|
1254
|
+
/**
|
|
1255
|
+
* Thrown when Coinbase rejects a {@link createCoinbaseExchangeTransfer} call
|
|
1256
|
+
* because it's missing "Travel Rule" information about the transfer's
|
|
1257
|
+
* recipient. The Travel Rule is a regulatory requirement on custodial
|
|
1258
|
+
* exchanges (like Coinbase) to collect basic counterparty information above
|
|
1259
|
+
* certain transfer thresholds -- which fields are required depends on the
|
|
1260
|
+
* sender's and recipient's jurisdictions and the transfer amount, so it can't
|
|
1261
|
+
* be predicted client-side; Coinbase reports the exact missing fields on
|
|
1262
|
+
* {@link missingFields}.
|
|
1263
|
+
*
|
|
1264
|
+
* Unlike {@link CoinbaseTransferMfaRequiredError}, retrying does not require
|
|
1265
|
+
* waiting for anything from Coinbase -- collect the listed fields (each has a
|
|
1266
|
+
* user-facing `description`) and retry the same transfer with
|
|
1267
|
+
* `travelRuleData` set.
|
|
1268
|
+
*
|
|
1269
|
+
* @example
|
|
1270
|
+
* ```ts
|
|
1271
|
+
* const transferParams = { accountId, amount: 0.5, currency: 'USDC', to };
|
|
1272
|
+
*
|
|
1273
|
+
* try {
|
|
1274
|
+
* await createCoinbaseExchangeTransfer(transferParams);
|
|
1275
|
+
* } catch (error) {
|
|
1276
|
+
* if (error instanceof CoinbaseTravelRuleRequiredError) {
|
|
1277
|
+
* // e.g. [{ name: 'BENEFICIARY_NAME', description: "The recipient's full legal name." }, ...]
|
|
1278
|
+
* console.log(error.missingFields);
|
|
1279
|
+
*
|
|
1280
|
+
* const travelRuleData = await promptUserForTravelRuleFields(
|
|
1281
|
+
* error.missingFields
|
|
1282
|
+
* );
|
|
1283
|
+
* await createCoinbaseExchangeTransfer({ ...transferParams, travelRuleData });
|
|
1284
|
+
* }
|
|
1285
|
+
* }
|
|
1286
|
+
* ```
|
|
1287
|
+
* @see createCoinbaseExchangeTransfer
|
|
1288
|
+
* @see CoinbaseTravelRuleData
|
|
1289
|
+
* @see CoinbaseTravelRuleFieldName
|
|
1290
|
+
* @see https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/travel-rule
|
|
1291
|
+
*/
|
|
1292
|
+
var CoinbaseTravelRuleRequiredError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1293
|
+
missingFields;
|
|
1294
|
+
constructor({ cause, missingFields }) {
|
|
1295
|
+
super({
|
|
1296
|
+
cause,
|
|
1297
|
+
code: "coinbase_travel_rule_required",
|
|
1298
|
+
docsUrl: "https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/travel-rule",
|
|
1299
|
+
metaMessages: missingFields.map(({ name: name$1, description }) => `- ${name$1}: ${description}`),
|
|
1300
|
+
name: "CoinbaseTravelRuleRequiredError",
|
|
1301
|
+
shortMessage: "Coinbase requires additional recipient information (Travel Rule compliance) before this transfer can complete."
|
|
1302
|
+
});
|
|
1303
|
+
this.missingFields = missingFields;
|
|
1304
|
+
}
|
|
1305
|
+
};
|
|
1306
|
+
|
|
1161
1307
|
//#endregion
|
|
1162
1308
|
//#region src/errors/DeeplinkConnectAndVerifyUnsupportedError.ts
|
|
1163
1309
|
var DeeplinkConnectAndVerifyUnsupportedError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
@@ -3150,8 +3296,9 @@ const ensureCorrectActiveNetwork = async ({ requiredNetworkId, walletProvider },
|
|
|
3150
3296
|
const { logger } = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3151
3297
|
if (!requiredNetworkId || !walletProvider.switchActiveNetwork) return;
|
|
3152
3298
|
logger.debug("[ensureCorrectActiveNetwork] Required network id", requiredNetworkId);
|
|
3299
|
+
let activeNetworkId;
|
|
3153
3300
|
try {
|
|
3154
|
-
|
|
3301
|
+
({networkId: activeNetworkId} = await walletProvider.getActiveNetworkId());
|
|
3155
3302
|
logger.debug("[ensureCorrectActiveNetwork] Check if should switch network", {
|
|
3156
3303
|
activeNetworkId,
|
|
3157
3304
|
requiredNetworkId
|
|
@@ -3162,7 +3309,7 @@ const ensureCorrectActiveNetwork = async ({ requiredNetworkId, walletProvider },
|
|
|
3162
3309
|
}
|
|
3163
3310
|
await walletProvider.switchActiveNetwork({ networkId: requiredNetworkId });
|
|
3164
3311
|
} catch (error) {
|
|
3165
|
-
logger.
|
|
3312
|
+
logger.warn(`[ensureCorrectActiveNetwork] Error getting active network id or switching network - skipping this step (activeNetworkId: ${activeNetworkId}, requiredNetworkId: ${requiredNetworkId})`, error);
|
|
3166
3313
|
}
|
|
3167
3314
|
};
|
|
3168
3315
|
|
|
@@ -3970,6 +4117,196 @@ const addCoinbaseOnrampOrderEventListener = ({ listener }, client = require_upda
|
|
|
3970
4117
|
};
|
|
3971
4118
|
};
|
|
3972
4119
|
|
|
4120
|
+
//#endregion
|
|
4121
|
+
//#region src/modules/funding/coinbase/coinbase.consts.ts
|
|
4122
|
+
/**
|
|
4123
|
+
* Whether the transfer's destination wallet is self-hosted (controlled
|
|
4124
|
+
* directly by its owner, with no custodial exchange in between) or held at
|
|
4125
|
+
* another exchange -- required by some jurisdictions' Travel Rule rules, see
|
|
4126
|
+
* {@link CoinbaseTravelRuleData}.
|
|
4127
|
+
*
|
|
4128
|
+
* @example
|
|
4129
|
+
* ```typescript
|
|
4130
|
+
* const walletType = CoinbaseBeneficiaryWalletType.SelfHosted;
|
|
4131
|
+
* ```
|
|
4132
|
+
* @see CoinbaseTravelRuleData
|
|
4133
|
+
* @see https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/travel-rule
|
|
4134
|
+
*/
|
|
4135
|
+
const CoinbaseBeneficiaryWalletType = {
|
|
4136
|
+
Exchange: "WALLET_TYPE_EXCHANGE",
|
|
4137
|
+
SelfHosted: "WALLET_TYPE_SELF_HOSTED"
|
|
4138
|
+
};
|
|
4139
|
+
/**
|
|
4140
|
+
* Whether the transfer's destination wallet also belongs to the sender --
|
|
4141
|
+
* required by some jurisdictions' Travel Rule rules, see
|
|
4142
|
+
* {@link CoinbaseTravelRuleData}.
|
|
4143
|
+
*
|
|
4144
|
+
* @example
|
|
4145
|
+
* ```typescript
|
|
4146
|
+
* const isSelfTransfer = CoinbaseIsSelfTransfer.SelfOwned;
|
|
4147
|
+
* ```
|
|
4148
|
+
* @see CoinbaseTravelRuleData
|
|
4149
|
+
* @see https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/travel-rule
|
|
4150
|
+
*/
|
|
4151
|
+
const CoinbaseIsSelfTransfer = {
|
|
4152
|
+
NotSelfOwned: "IS_SELF_FALSE",
|
|
4153
|
+
SelfOwned: "IS_SELF_TRUE"
|
|
4154
|
+
};
|
|
4155
|
+
/**
|
|
4156
|
+
* The individual Travel Rule fields Coinbase can require on a transfer.
|
|
4157
|
+
* Which of these are actually required depends on the sender's and
|
|
4158
|
+
* recipient's jurisdictions and the transfer amount -- Coinbase reports the
|
|
4159
|
+
* exact list that's missing for a given transfer via
|
|
4160
|
+
* {@link CoinbaseTravelRuleRequiredError.missingFields}.
|
|
4161
|
+
*
|
|
4162
|
+
* @example
|
|
4163
|
+
* ```typescript
|
|
4164
|
+
* const fieldName = CoinbaseTravelRuleFieldName.BeneficiaryName;
|
|
4165
|
+
* ```
|
|
4166
|
+
* @see CoinbaseTravelRuleRequiredError
|
|
4167
|
+
* @see https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/travel-rule
|
|
4168
|
+
*/
|
|
4169
|
+
const CoinbaseTravelRuleFieldName = {
|
|
4170
|
+
BeneficiaryAddress: "BENEFICIARY_ADDRESS",
|
|
4171
|
+
BeneficiaryCountry: "BENEFICIARY_COUNTRY",
|
|
4172
|
+
BeneficiaryFinancialInstitution: "BENEFICIARY_FINANCIAL_INSTITUTION",
|
|
4173
|
+
BeneficiaryName: "BENEFICIARY_NAME",
|
|
4174
|
+
BeneficiaryWalletType: "BENEFICIARY_WALLET_TYPE",
|
|
4175
|
+
IsSelf: "IS_SELF",
|
|
4176
|
+
TransferPurpose: "TRANSFER_PURPOSE"
|
|
4177
|
+
};
|
|
4178
|
+
/**
|
|
4179
|
+
* Human-readable description of a {@link CoinbaseTravelRuleFieldName},
|
|
4180
|
+
* written to be shown directly to an end user (for example, as helper text
|
|
4181
|
+
* next to the form field that collects it).
|
|
4182
|
+
*
|
|
4183
|
+
* @example
|
|
4184
|
+
* ```typescript
|
|
4185
|
+
* const description = COINBASE_TRAVEL_RULE_FIELD_DESCRIPTIONS.IS_SELF;
|
|
4186
|
+
* // "Whether the destination wallet also belongs to you."
|
|
4187
|
+
* ```
|
|
4188
|
+
* @see CoinbaseTravelRuleFieldName
|
|
4189
|
+
* @see CoinbaseTravelRuleRequiredError
|
|
4190
|
+
*/
|
|
4191
|
+
const COINBASE_TRAVEL_RULE_FIELD_DESCRIPTIONS = {
|
|
4192
|
+
BENEFICIARY_ADDRESS: "The recipient's postal address.",
|
|
4193
|
+
BENEFICIARY_COUNTRY: "The recipient's country, as an ISO 3166-1 alpha-2 code (e.g. \"US\", \"GB\").",
|
|
4194
|
+
BENEFICIARY_FINANCIAL_INSTITUTION: "The identifier (VASP ID) of the recipient exchange, required when the destination wallet is held at another exchange rather than self-hosted.",
|
|
4195
|
+
BENEFICIARY_NAME: "The recipient's full legal name.",
|
|
4196
|
+
BENEFICIARY_WALLET_TYPE: "Whether the destination wallet is self-hosted (the recipient controls it directly) or held at another exchange.",
|
|
4197
|
+
IS_SELF: "Whether the destination wallet also belongs to you.",
|
|
4198
|
+
TRANSFER_PURPOSE: "The reason for this transfer (e.g. \"Rent\", \"Gift\")."
|
|
4199
|
+
};
|
|
4200
|
+
|
|
4201
|
+
//#endregion
|
|
4202
|
+
//#region src/modules/funding/coinbase/utils/parseCoinbaseTravelRuleMissingFields/parseCoinbaseTravelRuleMissingFields.ts
|
|
4203
|
+
/**
|
|
4204
|
+
* Coinbase reports missing Travel Rule fields as a bracketed, comma-separated
|
|
4205
|
+
* list appended to its error message, e.g. `"... Param:
|
|
4206
|
+
* [BENEFICIARY_WALLET_TYPE, BENEFICIARY_NAME]"`.
|
|
4207
|
+
*/
|
|
4208
|
+
const TRAVEL_RULE_PARAM_LIST_REGEX = /Param:\s*\[([^\]]+)\]/;
|
|
4209
|
+
const isCoinbaseTravelRuleFieldName = (name$1) => Object.hasOwn(COINBASE_TRAVEL_RULE_FIELD_DESCRIPTIONS, name$1);
|
|
4210
|
+
/**
|
|
4211
|
+
* Extracts the list of missing Travel Rule fields from a Coinbase
|
|
4212
|
+
* `unknown_transfer_error` message, pairing each field with its user-facing
|
|
4213
|
+
* description. Returns an empty array if the message doesn't contain a
|
|
4214
|
+
* recognizable Travel Rule field list (i.e. this isn't a Travel Rule error).
|
|
4215
|
+
*
|
|
4216
|
+
* @param params.message - The raw `error` string from Coinbase's response body.
|
|
4217
|
+
* @returns The missing fields, or an empty array if none were found.
|
|
4218
|
+
* @example
|
|
4219
|
+
* ```typescript
|
|
4220
|
+
* const missingFields = parseCoinbaseTravelRuleMissingFields({
|
|
4221
|
+
* message: 'Incomplete travel rules information provided. Param: [BENEFICIARY_NAME, IS_SELF]',
|
|
4222
|
+
* });
|
|
4223
|
+
* // [
|
|
4224
|
+
* // { name: 'BENEFICIARY_NAME', description: "The recipient's full legal name." },
|
|
4225
|
+
* // { name: 'IS_SELF', description: 'Whether the destination wallet also belongs to you.' },
|
|
4226
|
+
* // ]
|
|
4227
|
+
* ```
|
|
4228
|
+
* @see CoinbaseTravelRuleRequiredError
|
|
4229
|
+
* @notInstrumented
|
|
4230
|
+
*/
|
|
4231
|
+
const parseCoinbaseTravelRuleMissingFields = ({ message }) => {
|
|
4232
|
+
const match = TRAVEL_RULE_PARAM_LIST_REGEX.exec(message);
|
|
4233
|
+
if (!match) return [];
|
|
4234
|
+
return match[1].split(",").map((name$1) => name$1.trim()).filter(isCoinbaseTravelRuleFieldName).map((name$1) => ({
|
|
4235
|
+
description: COINBASE_TRAVEL_RULE_FIELD_DESCRIPTIONS[name$1],
|
|
4236
|
+
name: name$1
|
|
4237
|
+
}));
|
|
4238
|
+
};
|
|
4239
|
+
|
|
4240
|
+
//#endregion
|
|
4241
|
+
//#region src/modules/funding/coinbase/createCoinbaseExchangeTransfer/createCoinbaseExchangeTransfer.ts
|
|
4242
|
+
/**
|
|
4243
|
+
* Creates a Coinbase exchange transfer to send crypto from a Coinbase account to an external address.
|
|
4244
|
+
*
|
|
4245
|
+
* Coinbase may reject the transfer for reasons that require a second attempt
|
|
4246
|
+
* rather than a hard failure:
|
|
4247
|
+
* - {@link CoinbaseTransferMfaRequiredError} / {@link CoinbaseTransferMfaFailedError} --
|
|
4248
|
+
* Coinbase's own two-step verification on the sending account.
|
|
4249
|
+
* - {@link CoinbaseTravelRuleRequiredError} -- missing recipient information
|
|
4250
|
+
* required by regulation for this transfer's jurisdictions/amount.
|
|
4251
|
+
*
|
|
4252
|
+
* @param transferParams - The parameters for the transfer including accountId.
|
|
4253
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4254
|
+
* @returns A promise resolving to the created exchange transfer.
|
|
4255
|
+
* @throws {CoinbaseTransferMfaRequiredError} When the API requires MFA for the transfer.
|
|
4256
|
+
* @throws {CoinbaseTransferMfaFailedError} When the provided MFA code is rejected.
|
|
4257
|
+
* @throws {CoinbaseTravelRuleRequiredError} When Coinbase requires additional recipient information for the transfer.
|
|
4258
|
+
* @throws {APIError} For any other API error returned by the exchange transfer request.
|
|
4259
|
+
* @example
|
|
4260
|
+
* ```typescript
|
|
4261
|
+
* // Include any known recipient info upfront -- see travelRuleData below for why.
|
|
4262
|
+
* const transferParams = {
|
|
4263
|
+
* accountId: accounts[0].id,
|
|
4264
|
+
* amount: 0.5,
|
|
4265
|
+
* currency: 'USDC',
|
|
4266
|
+
* to: '0x71C7656EC7ab88b098defB751B7401B5f6d8976F',
|
|
4267
|
+
* travelRuleData: { beneficiaryName: 'Jane Doe', beneficiaryCountry: 'US' },
|
|
4268
|
+
* };
|
|
4269
|
+
*
|
|
4270
|
+
* try {
|
|
4271
|
+
* const transfer = await createCoinbaseExchangeTransfer(transferParams);
|
|
4272
|
+
* } catch (error) {
|
|
4273
|
+
* if (error instanceof CoinbaseTravelRuleRequiredError) {
|
|
4274
|
+
* const travelRuleData = await promptUserForTravelRuleFields(error.missingFields);
|
|
4275
|
+
* await createCoinbaseExchangeTransfer({ ...transferParams, travelRuleData });
|
|
4276
|
+
* }
|
|
4277
|
+
* }
|
|
4278
|
+
* ```
|
|
4279
|
+
* @see getCoinbaseAccounts
|
|
4280
|
+
* @see CoinbaseTransferMfaRequiredError
|
|
4281
|
+
* @see CoinbaseTravelRuleRequiredError
|
|
4282
|
+
* @notInstrumented
|
|
4283
|
+
*/
|
|
4284
|
+
const createCoinbaseExchangeTransfer = async (transferParams, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4285
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4286
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client);
|
|
4287
|
+
const { accountId, ...createExchangeTransferRequest } = transferParams;
|
|
4288
|
+
try {
|
|
4289
|
+
return await apiClient.postExchangeAccountTransfer({
|
|
4290
|
+
accountId,
|
|
4291
|
+
createExchangeTransferRequest,
|
|
4292
|
+
environmentId: core.environmentId,
|
|
4293
|
+
exchangeKey: _dynamic_labs_sdk_api_core.ExchangeKeyEnum.Coinbase
|
|
4294
|
+
});
|
|
4295
|
+
} catch (error) {
|
|
4296
|
+
if (!(error instanceof require_updateAuthFromVerifyResponse.APIError)) throw error;
|
|
4297
|
+
if (error.code === "transfer_mfa_required") throw new CoinbaseTransferMfaRequiredError({ cause: error });
|
|
4298
|
+
if (error.code === "transfer_mfa_failed") throw new CoinbaseTransferMfaFailedError({ cause: error });
|
|
4299
|
+
if (error.code === "unknown_transfer_error") {
|
|
4300
|
+
const missingFields = parseCoinbaseTravelRuleMissingFields({ message: error.message });
|
|
4301
|
+
if (missingFields.length > 0) throw new CoinbaseTravelRuleRequiredError({
|
|
4302
|
+
cause: error,
|
|
4303
|
+
missingFields
|
|
4304
|
+
});
|
|
4305
|
+
}
|
|
4306
|
+
throw error;
|
|
4307
|
+
}
|
|
4308
|
+
};
|
|
4309
|
+
|
|
3973
4310
|
//#endregion
|
|
3974
4311
|
//#region src/modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder/getMissingVerificationForCoinbaseOnrampOrder.ts
|
|
3975
4312
|
/**
|
|
@@ -4091,6 +4428,59 @@ const __createCoinbaseOnrampOrder_wrapped = require_updateAuthFromVerifyResponse
|
|
|
4091
4428
|
}
|
|
4092
4429
|
});
|
|
4093
4430
|
|
|
4431
|
+
//#endregion
|
|
4432
|
+
//#region src/utils/assertChainName/assertChainName.ts
|
|
4433
|
+
const CHAIN_ENUM_VALUES = Object.values(_dynamic_labs_sdk_api_core.ChainEnum);
|
|
4434
|
+
/**
|
|
4435
|
+
* Validates that a chain name is a recognized ChainEnum value.
|
|
4436
|
+
*
|
|
4437
|
+
* Throws an {@link InvalidParamError} when the value is undefined or is not a
|
|
4438
|
+
* valid chain name.
|
|
4439
|
+
*
|
|
4440
|
+
* @category Extension Development
|
|
4441
|
+
*
|
|
4442
|
+
* @param chainName - The chain name to validate.
|
|
4443
|
+
* @throws {InvalidParamError} When chainName is undefined or not a valid ChainEnum value.
|
|
4444
|
+
* @notInstrumented
|
|
4445
|
+
*/
|
|
4446
|
+
const assertChainName = (chainName) => {
|
|
4447
|
+
if (chainName === void 0) throw new require_updateAuthFromVerifyResponse.InvalidParamError("chainName is required");
|
|
4448
|
+
if (!CHAIN_ENUM_VALUES.includes(chainName)) throw new require_updateAuthFromVerifyResponse.InvalidParamError(`Invalid chainName: ${chainName}`);
|
|
4449
|
+
};
|
|
4450
|
+
|
|
4451
|
+
//#endregion
|
|
4452
|
+
//#region src/modules/funding/coinbase/getCoinbaseAccounts/getCoinbaseAccounts.ts
|
|
4453
|
+
/**
|
|
4454
|
+
* Gets the Coinbase accounts (balances) for the authenticated user.
|
|
4455
|
+
*
|
|
4456
|
+
* @param [params] GetCoinbaseAccountsParams - Optional filters for the accounts.
|
|
4457
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4458
|
+
* @returns A promise resolving to an array of Coinbase accounts with balances.
|
|
4459
|
+
* @throws {InvalidParamError} When chainName is not a valid ChainEnum value or networkId is a non-integer or negative number.
|
|
4460
|
+
* @example
|
|
4461
|
+
* ```typescript
|
|
4462
|
+
* const accounts = await getCoinbaseAccounts({ chainName: 'EVM' });
|
|
4463
|
+
* console.log(accounts[0].balances);
|
|
4464
|
+
* ```
|
|
4465
|
+
* @see createCoinbaseExchangeTransfer
|
|
4466
|
+
* @see GetCoinbaseAccountsParams
|
|
4467
|
+
* @notInstrumented
|
|
4468
|
+
*/
|
|
4469
|
+
const getCoinbaseAccounts = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4470
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4471
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client);
|
|
4472
|
+
const chainName = params?.chainName;
|
|
4473
|
+
if (chainName !== void 0) assertChainName(chainName);
|
|
4474
|
+
const networkId = params?.networkId;
|
|
4475
|
+
if (networkId !== void 0 && (!Number.isInteger(networkId) || networkId < 0)) throw new require_updateAuthFromVerifyResponse.InvalidParamError(`Invalid networkId: ${networkId}`);
|
|
4476
|
+
return await apiClient.getUserAccounts({
|
|
4477
|
+
chainName,
|
|
4478
|
+
environmentId: core.environmentId,
|
|
4479
|
+
exchangeKey: _dynamic_labs_sdk_api_core.ExchangeKeyEnum.Coinbase,
|
|
4480
|
+
networkId
|
|
4481
|
+
});
|
|
4482
|
+
};
|
|
4483
|
+
|
|
4094
4484
|
//#endregion
|
|
4095
4485
|
//#region src/modules/funding/coinbase/getCoinbaseBuyUrl/getCoinbaseBuyUrl.ts
|
|
4096
4486
|
/**
|
|
@@ -9089,6 +9479,122 @@ const onWalletProviderEvent = ({ callback, event, walletProviderKey }, client =
|
|
|
9089
9479
|
};
|
|
9090
9480
|
};
|
|
9091
9481
|
|
|
9482
|
+
//#endregion
|
|
9483
|
+
//#region src/modules/yield/getYieldDetails/getYieldDetails.ts
|
|
9484
|
+
/**
|
|
9485
|
+
* Gets full details for one yield vault. Registry data merged with live
|
|
9486
|
+
* data from the underlying protocol (`netApy`, `netApyExcludingRewards`,
|
|
9487
|
+
* `tvlUsd`) on a best-effort basis — these fields may be omitted if that
|
|
9488
|
+
* data is temporarily unavailable.
|
|
9489
|
+
*
|
|
9490
|
+
* @example
|
|
9491
|
+
* ```ts
|
|
9492
|
+
* const details = await getYieldDetails({ vaultId });
|
|
9493
|
+
* console.log(details.netApy);
|
|
9494
|
+
* ```
|
|
9495
|
+
*
|
|
9496
|
+
* @param params GetYieldDetailsParams - The vault to look up.
|
|
9497
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
9498
|
+
* @returns The vault's full details.
|
|
9499
|
+
* @see listYieldVaults
|
|
9500
|
+
* @see getYieldPosition
|
|
9501
|
+
* @notInstrumented
|
|
9502
|
+
*/
|
|
9503
|
+
const getYieldDetails = async ({ vaultId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
9504
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
9505
|
+
return require_updateAuthFromVerifyResponse.createApiClient({}, client).getYieldVaultDetails({
|
|
9506
|
+
environmentId: core.environmentId,
|
|
9507
|
+
vaultId
|
|
9508
|
+
});
|
|
9509
|
+
};
|
|
9510
|
+
|
|
9511
|
+
//#endregion
|
|
9512
|
+
//#region src/modules/yield/getYieldPosition/getYieldPosition.ts
|
|
9513
|
+
/**
|
|
9514
|
+
* Gets a wallet's share balance and asset value in a yield vault. Reads
|
|
9515
|
+
* on-chain via the underlying protocol.
|
|
9516
|
+
*
|
|
9517
|
+
* @example
|
|
9518
|
+
* ```ts
|
|
9519
|
+
* const position = await getYieldPosition({ vaultId, walletAccount });
|
|
9520
|
+
* console.log(position.shares);
|
|
9521
|
+
* ```
|
|
9522
|
+
*
|
|
9523
|
+
* @param params GetYieldPositionParams - The vault and wallet account to read.
|
|
9524
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
9525
|
+
* @returns The wallet's share balance and asset value in the vault.
|
|
9526
|
+
* @see listYieldVaults
|
|
9527
|
+
* @see getYieldDetails
|
|
9528
|
+
* @notInstrumented
|
|
9529
|
+
*/
|
|
9530
|
+
const getYieldPosition = async ({ vaultId, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
9531
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
9532
|
+
return require_updateAuthFromVerifyResponse.createApiClient({}, client).getYieldVaultPosition({
|
|
9533
|
+
environmentId: core.environmentId,
|
|
9534
|
+
ownerAddress: walletAccount.address,
|
|
9535
|
+
vaultId
|
|
9536
|
+
});
|
|
9537
|
+
};
|
|
9538
|
+
|
|
9539
|
+
//#endregion
|
|
9540
|
+
//#region src/modules/yield/getYieldRewards/getYieldRewards.ts
|
|
9541
|
+
/**
|
|
9542
|
+
* Gets accrued rewards for a wallet in a yield vault. Returns an empty
|
|
9543
|
+
* array when the wallet has no accrued rewards in this vault. A vault can
|
|
9544
|
+
* have more than one concurrent reward campaign paying out in different
|
|
9545
|
+
* tokens, so each entry carries its own token address/symbol/decimals.
|
|
9546
|
+
*
|
|
9547
|
+
* @example
|
|
9548
|
+
* ```ts
|
|
9549
|
+
* const rewards = await getYieldRewards({ vaultId, walletAccount });
|
|
9550
|
+
* console.log(rewards[0]?.accrued);
|
|
9551
|
+
* ```
|
|
9552
|
+
*
|
|
9553
|
+
* @param params GetYieldRewardsParams - The vault and wallet account to read.
|
|
9554
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
9555
|
+
* @returns The wallet's accrued rewards in the vault.
|
|
9556
|
+
* @see listYieldVaults
|
|
9557
|
+
* @see getYieldPosition
|
|
9558
|
+
* @notInstrumented
|
|
9559
|
+
*/
|
|
9560
|
+
const getYieldRewards = async ({ vaultId, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
9561
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
9562
|
+
const { rewards } = await require_updateAuthFromVerifyResponse.createApiClient({}, client).getYieldVaultRewards({
|
|
9563
|
+
environmentId: core.environmentId,
|
|
9564
|
+
ownerAddress: walletAccount.address,
|
|
9565
|
+
vaultId
|
|
9566
|
+
});
|
|
9567
|
+
return rewards;
|
|
9568
|
+
};
|
|
9569
|
+
|
|
9570
|
+
//#endregion
|
|
9571
|
+
//#region src/modules/yield/listYieldVaults/listYieldVaults.ts
|
|
9572
|
+
/**
|
|
9573
|
+
* Lists the yield vaults available to the current environment. Public
|
|
9574
|
+
* vaults are returned for every caller; private vaults are included only
|
|
9575
|
+
* when they're scoped to this environment. Each vault is enriched with
|
|
9576
|
+
* live `netApy`/`tvlUsd` from the underlying protocol on a best-effort
|
|
9577
|
+
* basis — either field may be omitted if that data is temporarily
|
|
9578
|
+
* unavailable.
|
|
9579
|
+
*
|
|
9580
|
+
* @example
|
|
9581
|
+
* ```ts
|
|
9582
|
+
* const vaults = await listYieldVaults();
|
|
9583
|
+
* console.log(vaults[0].vaultId);
|
|
9584
|
+
* ```
|
|
9585
|
+
*
|
|
9586
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
9587
|
+
* @returns The yield vaults accessible to this environment.
|
|
9588
|
+
* @see getYieldDetails
|
|
9589
|
+
* @see getYieldPosition
|
|
9590
|
+
* @notInstrumented
|
|
9591
|
+
*/
|
|
9592
|
+
const listYieldVaults = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
9593
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
9594
|
+
const { vaults } = await require_updateAuthFromVerifyResponse.createApiClient({}, client).listYieldVaults({ environmentId: core.environmentId });
|
|
9595
|
+
return vaults;
|
|
9596
|
+
};
|
|
9597
|
+
|
|
9092
9598
|
//#endregion
|
|
9093
9599
|
//#region src/utils/appendConnectionUriToDeeplink/appendConnectionUriToDeeplink.ts
|
|
9094
9600
|
/**
|
|
@@ -9201,9 +9707,16 @@ const parseUserAgent = ({ userAgent }) => {
|
|
|
9201
9707
|
|
|
9202
9708
|
//#endregion
|
|
9203
9709
|
exports.BaseError = require_updateAuthFromVerifyResponse.BaseError;
|
|
9710
|
+
exports.COINBASE_TRAVEL_RULE_FIELD_DESCRIPTIONS = COINBASE_TRAVEL_RULE_FIELD_DESCRIPTIONS;
|
|
9204
9711
|
exports.CaptchaProviderEnum = CaptchaProviderEnum;
|
|
9205
9712
|
exports.CheckoutSessionTokenMissingError = CheckoutSessionTokenMissingError;
|
|
9206
9713
|
exports.ClientAlreadyInitializedError = ClientAlreadyInitializedError;
|
|
9714
|
+
exports.CoinbaseBeneficiaryWalletType = CoinbaseBeneficiaryWalletType;
|
|
9715
|
+
exports.CoinbaseIsSelfTransfer = CoinbaseIsSelfTransfer;
|
|
9716
|
+
exports.CoinbaseTransferMfaFailedError = CoinbaseTransferMfaFailedError;
|
|
9717
|
+
exports.CoinbaseTransferMfaRequiredError = CoinbaseTransferMfaRequiredError;
|
|
9718
|
+
exports.CoinbaseTravelRuleFieldName = CoinbaseTravelRuleFieldName;
|
|
9719
|
+
exports.CoinbaseTravelRuleRequiredError = CoinbaseTravelRuleRequiredError;
|
|
9207
9720
|
exports.DeeplinkConnectAndVerifyUnsupportedError = DeeplinkConnectAndVerifyUnsupportedError;
|
|
9208
9721
|
exports.DeviceRegistrationIdentityMismatchError = DeviceRegistrationIdentityMismatchError;
|
|
9209
9722
|
exports.FeeEstimationFailedError = FeeEstimationFailedError;
|
|
@@ -9257,6 +9770,7 @@ Object.defineProperty(exports, 'TokenScope', {
|
|
|
9257
9770
|
}
|
|
9258
9771
|
});
|
|
9259
9772
|
exports.TokenSwapError = TokenSwapError;
|
|
9773
|
+
exports.TransactionBroadcastError = require_isDynamicWaasEnabled.TransactionBroadcastError;
|
|
9260
9774
|
exports.UnauthorizedError = require_updateAuthFromVerifyResponse.UnauthorizedError;
|
|
9261
9775
|
exports.UnavailableInServerSideError = require_getNetworkProviderFromNetworkId.UnavailableInServerSideError;
|
|
9262
9776
|
exports.UnrecognizedNetworkError = UnrecognizedNetworkError;
|
|
@@ -9299,6 +9813,7 @@ exports.connectAndVerifyWithWalletProvider = __connectAndVerifyWithWalletProvide
|
|
|
9299
9813
|
exports.connectWithWalletProvider = __connectWithWalletProvider_wrapped;
|
|
9300
9814
|
exports.consumeMfaToken = require_isMfaRequiredForAction.__consumeMfaToken_wrapped;
|
|
9301
9815
|
exports.createCheckoutTransaction = __createCheckoutTransaction_wrapped;
|
|
9816
|
+
exports.createCoinbaseExchangeTransfer = createCoinbaseExchangeTransfer;
|
|
9302
9817
|
exports.createCoinbaseOnrampOrder = __createCoinbaseOnrampOrder_wrapped;
|
|
9303
9818
|
exports.createCryptoDotComPayment = __createCryptoDotComPayment_wrapped;
|
|
9304
9819
|
exports.createDynamicClient = __createDynamicClient_wrapped;
|
|
@@ -9323,6 +9838,7 @@ exports.getBalances = getBalances;
|
|
|
9323
9838
|
exports.getCaptchaSettings = getCaptchaSettings;
|
|
9324
9839
|
exports.getCheckoutTransaction = getCheckoutTransaction;
|
|
9325
9840
|
exports.getCheckoutTransactionQuote = getCheckoutTransactionQuote;
|
|
9841
|
+
exports.getCoinbaseAccounts = getCoinbaseAccounts;
|
|
9326
9842
|
exports.getCoinbaseBuyUrl = getCoinbaseBuyUrl;
|
|
9327
9843
|
exports.getConnectedAddresses = getConnectedAddresses;
|
|
9328
9844
|
exports.getDefaultClient = require_updateAuthFromVerifyResponse.getDefaultClient;
|
|
@@ -9361,6 +9877,9 @@ exports.getWalletConnectCatalog = getWalletConnectCatalog;
|
|
|
9361
9877
|
exports.getWalletConnectCatalogWalletByWalletProviderKey = getWalletConnectCatalogWalletByWalletProviderKey;
|
|
9362
9878
|
exports.getWalletOptionsCatalogue = getWalletOptionsCatalogue;
|
|
9363
9879
|
exports.getWalletProviderDataByKey = getWalletProviderDataByKey;
|
|
9880
|
+
exports.getYieldDetails = getYieldDetails;
|
|
9881
|
+
exports.getYieldPosition = getYieldPosition;
|
|
9882
|
+
exports.getYieldRewards = getYieldRewards;
|
|
9364
9883
|
exports.hasAllGoogleDriveBackupScopes = hasAllGoogleDriveBackupScopes;
|
|
9365
9884
|
exports.hasExtension = require_getNetworkProviderFromNetworkId.hasExtension;
|
|
9366
9885
|
exports.initializeClient = __initializeClient_wrapped;
|
|
@@ -9378,6 +9897,7 @@ exports.isSignedIn = require_updateAuthFromVerifyResponse.isSignedIn;
|
|
|
9378
9897
|
exports.isUserMissingMfaAuth = require_updateAuthFromVerifyResponse.isUserMissingMfaAuth;
|
|
9379
9898
|
exports.isUserOnboardingComplete = require_isUserOnboardingComplete.isUserOnboardingComplete;
|
|
9380
9899
|
exports.isWalletAccountVerified = isWalletAccountVerified;
|
|
9900
|
+
exports.listYieldVaults = listYieldVaults;
|
|
9381
9901
|
exports.logout = logout;
|
|
9382
9902
|
exports.matchWalletProvidersToCatalogGroup = matchWalletProvidersToCatalogGroup;
|
|
9383
9903
|
exports.mergeUserAccounts = mergeUserAccounts;
|