@dynamic-labs-sdk/client 0.1.0-alpha.33 → 0.1.0-alpha.34
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/CHANGELOG.md +6 -0
- package/constants.cjs.js +1 -1
- package/constants.esm.js +1 -1
- package/core.esm.js +1 -1
- package/getVerifiedCredentialForWalletAccount.esm.js +1 -1
- package/index.cjs.js +208 -0
- package/index.esm.js +208 -4
- package/package.json +2 -2
- package/src/errors/MissingUserVerificationError.d.ts +12 -0
- package/src/errors/MissingUserVerificationError.d.ts.map +1 -0
- package/src/exports/index.d.ts +5 -0
- package/src/exports/index.d.ts.map +1 -1
- package/src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/addCoinbaseOnrampOrderEventListener.d.ts +18 -0
- package/src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/addCoinbaseOnrampOrderEventListener.d.ts.map +1 -0
- package/src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/index.d.ts +2 -0
- package/src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/index.d.ts.map +1 -0
- package/src/modules/funding/coinbase/coinbase.types.d.ts +268 -0
- package/src/modules/funding/coinbase/coinbase.types.d.ts.map +1 -0
- package/src/modules/funding/coinbase/createCoinbaseOnrampOrder/createCoinbaseOnrampOrder.d.ts +11 -0
- package/src/modules/funding/coinbase/createCoinbaseOnrampOrder/createCoinbaseOnrampOrder.d.ts.map +1 -0
- package/src/modules/funding/coinbase/createCoinbaseOnrampOrder/index.d.ts +2 -0
- package/src/modules/funding/coinbase/createCoinbaseOnrampOrder/index.d.ts.map +1 -0
- package/src/modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder/getMissingVerificationForCoinbaseOnrampOrder.d.ts +23 -0
- package/src/modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder/getMissingVerificationForCoinbaseOnrampOrder.d.ts.map +1 -0
- package/src/modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder/index.d.ts +2 -0
- package/src/modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder/index.d.ts.map +1 -0
- package/src/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/index.d.ts +2 -0
- package/src/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/index.d.ts.map +1 -0
- package/src/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/validateUserCredentialsForCoinbaseOnrampOrder.d.ts +4 -0
- package/src/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/validateUserCredentialsForCoinbaseOnrampOrder.d.ts.map +1 -0
- package/src/modules/storageSync/hydrateStateWithStorage/hydrateStateWithStorage.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
package/constants.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
|
4
4
|
var buffer = require('buffer');
|
|
5
5
|
|
|
6
6
|
var name = "@dynamic-labs-sdk/client";
|
|
7
|
-
var version = "0.1.0-alpha.
|
|
7
|
+
var version = "0.1.0-alpha.34";
|
|
8
8
|
var dependencies = {
|
|
9
9
|
"@dynamic-labs/sdk-api-core": "0.0.831"};
|
|
10
10
|
|
package/constants.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AuthStorageEnum, SDKApi, Configuration } from '@dynamic-labs/sdk-api-co
|
|
|
2
2
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
3
3
|
|
|
4
4
|
var name = "@dynamic-labs-sdk/client";
|
|
5
|
-
var version = "0.1.0-alpha.
|
|
5
|
+
var version = "0.1.0-alpha.34";
|
|
6
6
|
var dependencies = {
|
|
7
7
|
"@dynamic-labs/sdk-api-core": "0.0.831"};
|
|
8
8
|
|
package/core.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ export { A as APIError, e as CHAINS_INFO_MAP, j as ClientNotFoundError, l as DYN
|
|
|
4
4
|
import { F as FETCH_PROJECT_SETTINGS_TRACKER_KEY, k as getNetworksData, c as createStorageKeySchema, p as getNetworkProviders, N as NoNetworkProvidersError } from './getNetworkProviderFromNetworkId.esm.js';
|
|
5
5
|
export { C as CannotTrackError, q as InvalidStorageSet, e as consumeCaptchaToken, d as createLocalStorageAdapter, a as createLogger, h as createSignInMessageStatement, b as createStorage, g as createVisit, j as formatSignInMessage, r as getNetworkProviderBuilderRegistry, l as getNetworkProviderFromNetworkId, o as hasExtension, n as setCaptchaToken, f as setUnverifiedWalletAccounts, s as subscribeWithSelector, u as updateWalletProviderKeysForVerifiedCredentials, v as verifySignInMessage } from './getNetworkProviderFromNetworkId.esm.js';
|
|
6
6
|
import { b as getWalletProviderByKey, l as createRuntimeServiceAccessKey } from './getVerifiedCredentialForWalletAccount.esm.js';
|
|
7
|
-
export { I as InvalidWalletProviderKeyError, N as NoWalletProviderFoundError, W as WalletProviderPriority, e as emitEvent,
|
|
7
|
+
export { I as InvalidWalletProviderKeyError, N as NoWalletProviderFoundError, W as WalletProviderPriority, e as emitEvent, d as emitWalletAccountsChangedEvent, f as formatWalletAccountId, m as formatWalletProviderKey, i as getVerifiedCredentialForWalletAccount, a as getWalletProviderFromWalletAccount, r as getWalletProviderRegistry, h as getWalletProviders, p as normalizeWalletNameWithChain, q as splitWalletProviderKey, u as updateAuthFromVerifyResponse } from './getVerifiedCredentialForWalletAccount.esm.js';
|
|
8
8
|
export { c as consumeMfaTokenIfRequiredForAction, g as getSignedSessionId } from './getSignedSessionId.esm.js';
|
|
9
9
|
import * as z from 'zod/mini';
|
|
10
10
|
import EventEmitter from 'eventemitter3';
|
|
@@ -488,4 +488,4 @@ const getVerifiedCredentialForWalletAccount = ({ walletAccount }, client)=>{
|
|
|
488
488
|
return (_client_user = client.user) == null ? void 0 : _client_user.verifiedCredentials.find((vc)=>vc.id === walletAccount.verifiedCredentialId);
|
|
489
489
|
};
|
|
490
490
|
|
|
491
|
-
export { DYNAMIC_AUTH_COOKIE_NAME as D, InvalidWalletProviderKeyError as I, NoWalletProviderFoundError as N, WalletProviderPriority as W, getWalletProviderFromWalletAccount as a, getWalletProviderByKey as b,
|
|
491
|
+
export { DYNAMIC_AUTH_COOKIE_NAME as D, InvalidWalletProviderKeyError as I, NoWalletProviderFoundError as N, WalletProviderPriority as W, getWalletProviderFromWalletAccount as a, getWalletProviderByKey as b, checkAndRaiseWalletAccountsChangedEvent as c, emitWalletAccountsChangedEvent as d, emitEvent as e, formatWalletAccountId as f, getWalletAccounts as g, getWalletProviders as h, getVerifiedCredentialForWalletAccount as i, onceEvent as j, onEvent as k, createRuntimeServiceAccessKey as l, formatWalletProviderKey as m, normalizeAddress as n, offEvent as o, normalizeWalletNameWithChain as p, splitWalletProviderKey as q, getWalletProviderRegistry as r, setCookie as s, updateAuthFromVerifyResponse as u };
|
package/index.cjs.js
CHANGED
|
@@ -422,6 +422,7 @@ const sessionStorageKeySchema = getNetworkProviderFromNetworkId.createStorageKey
|
|
|
422
422
|
|
|
423
423
|
const hydrateStateWithStorage = async (client)=>{
|
|
424
424
|
const core = constants.getCore(client);
|
|
425
|
+
const previousState = core.state.get();
|
|
425
426
|
const stateChanges = {};
|
|
426
427
|
// ================ TOKEN =================
|
|
427
428
|
const session = await core.storage.getItem(sessionStorageKeySchema);
|
|
@@ -454,6 +455,9 @@ const hydrateStateWithStorage = async (client)=>{
|
|
|
454
455
|
if (Object.keys(stateChanges).length > 0) {
|
|
455
456
|
core.state.set(stateChanges);
|
|
456
457
|
}
|
|
458
|
+
getVerifiedCredentialForWalletAccount.checkAndRaiseWalletAccountsChangedEvent({
|
|
459
|
+
previousState
|
|
460
|
+
}, client);
|
|
457
461
|
};
|
|
458
462
|
|
|
459
463
|
const syncStateWithStorage = (client)=>{
|
|
@@ -1024,6 +1028,19 @@ class MissingSocialUrlParamError extends constants.BaseError {
|
|
|
1024
1028
|
}
|
|
1025
1029
|
}
|
|
1026
1030
|
|
|
1031
|
+
class MissingUserVerificationError extends constants.BaseError {
|
|
1032
|
+
constructor({ informationToVerify, message }){
|
|
1033
|
+
super({
|
|
1034
|
+
cause: null,
|
|
1035
|
+
code: 'missing_user_verification_error',
|
|
1036
|
+
docsUrl: null,
|
|
1037
|
+
name: 'MissingUserVerificationError',
|
|
1038
|
+
shortMessage: message != null ? message : `The user is missing verification for ${informationToVerify}. Please verify the user's ${informationToVerify}`
|
|
1039
|
+
});
|
|
1040
|
+
this.informationToVerify = informationToVerify;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1027
1044
|
class NetworkSwitchingUnavailableError extends constants.BaseError {
|
|
1028
1045
|
constructor({ walletProviderKey, originalError, extraMessages }){
|
|
1029
1046
|
const cause = originalError instanceof Error ? originalError : null;
|
|
@@ -1653,6 +1670,193 @@ const providersRequiringPkce = [
|
|
|
1653
1670
|
return response.chainBalances;
|
|
1654
1671
|
};
|
|
1655
1672
|
|
|
1673
|
+
/**
|
|
1674
|
+
* Adds a listener for Coinbase onramp order events.
|
|
1675
|
+
*
|
|
1676
|
+
* @param params.listener - The listener function to call when an event is received.
|
|
1677
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1678
|
+
* @returns A function to remove the listener.
|
|
1679
|
+
* @throws {ValueMustBeDefinedError} If the window is not available.
|
|
1680
|
+
* @docs https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/apple-pay-onramp-api#events-names
|
|
1681
|
+
*/ const addCoinbaseOnrampOrderEventListener = ({ listener }, client = constants.getDefaultClient())=>{
|
|
1682
|
+
const core = constants.getCore(client);
|
|
1683
|
+
if (typeof window === 'undefined') {
|
|
1684
|
+
throw new constants.ValueMustBeDefinedError('Window is not available to listen for Coinbase onramp order events');
|
|
1685
|
+
}
|
|
1686
|
+
const handleMessageEvent = (event)=>{
|
|
1687
|
+
if (event.origin !== 'https://pay.coinbase.com') {
|
|
1688
|
+
return;
|
|
1689
|
+
}
|
|
1690
|
+
core.logger.debug('[addCoinbaseOnrampOrderEventListener] pay.coinbase.com event received', {
|
|
1691
|
+
event
|
|
1692
|
+
});
|
|
1693
|
+
try {
|
|
1694
|
+
var _coinbaseOnrampOrderEventData_eventName;
|
|
1695
|
+
const coinbaseOnrampOrderEventData = JSON.parse(event.data);
|
|
1696
|
+
if (!((_coinbaseOnrampOrderEventData_eventName = coinbaseOnrampOrderEventData.eventName) == null ? void 0 : _coinbaseOnrampOrderEventData_eventName.startsWith('onramp_api.'))) {
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
listener({
|
|
1700
|
+
data: coinbaseOnrampOrderEventData.data,
|
|
1701
|
+
eventName: coinbaseOnrampOrderEventData.eventName
|
|
1702
|
+
});
|
|
1703
|
+
} catch (error) {
|
|
1704
|
+
core.logger.debug('[addCoinbaseOnrampOrderEventListener] Failed to parse Coinbase onramp order event data', {
|
|
1705
|
+
error
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
};
|
|
1709
|
+
window.addEventListener('message', handleMessageEvent);
|
|
1710
|
+
return ()=>{
|
|
1711
|
+
window.removeEventListener('message', handleMessageEvent);
|
|
1712
|
+
};
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1715
|
+
function _object_without_properties_loose(source, excluded) {
|
|
1716
|
+
if (source == null) return {};
|
|
1717
|
+
var target = {};
|
|
1718
|
+
var sourceKeys = Object.keys(source);
|
|
1719
|
+
var key, i;
|
|
1720
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
1721
|
+
key = sourceKeys[i];
|
|
1722
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
1723
|
+
target[key] = source[key];
|
|
1724
|
+
}
|
|
1725
|
+
return target;
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
/**
|
|
1729
|
+
* This function is used to get a list of fields that are missing verification for a Coinbase onramp order
|
|
1730
|
+
*
|
|
1731
|
+
* - If the user is missing information for an email or phone number, the field will be returned with the error code MISSING_INFORMATION
|
|
1732
|
+
* - If the user is missing verification for an email or phone number, the field will be returned with the error code MISSING_VERIFICATION
|
|
1733
|
+
* and the existing unverified email or phone number will be included in the data field.
|
|
1734
|
+
* - If the user's phone number has not been verified in the last 60 days, the field will be returned with the error code VERIFICATION_EXPIRED
|
|
1735
|
+
* and the existing phone number will be included in the data field.
|
|
1736
|
+
*
|
|
1737
|
+
* @param params.paymentMethod - The payment method that will be used to create the onramp order
|
|
1738
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1739
|
+
* @returns FieldMissingVerificationForCoinbaseOnramp[] - An array of fields that are missing verification for a Coinbase onramp order
|
|
1740
|
+
* @throws {InvalidParamError} - If the payment method is not valid
|
|
1741
|
+
* @throws {ValueMustBeDefinedError} - If the user is not authenticated
|
|
1742
|
+
*/ const getMissingVerificationForCoinbaseOnrampOrder = ({ paymentMethod }, client = constants.getDefaultClient())=>{
|
|
1743
|
+
// adding the payment method as a param for now just so a user has to pass an object as the first param
|
|
1744
|
+
// that way, when we add more payment methods, we can easily add them to the param object
|
|
1745
|
+
// and not have to change the function signature
|
|
1746
|
+
if (paymentMethod !== 'GUEST_CHECKOUT_APPLE_PAY') {
|
|
1747
|
+
throw new InvalidParamError.InvalidParamError(`Invalid payment method: ${paymentMethod}`);
|
|
1748
|
+
}
|
|
1749
|
+
const { user } = client;
|
|
1750
|
+
constants.assertDefined(user, 'User is not authenticated');
|
|
1751
|
+
const fieldsMissingVerification = [];
|
|
1752
|
+
const emailVerifiedCredential = user.verifiedCredentials.find((credential)=>credential.format === sdkApiCore.JwtVerifiedCredentialFormatEnum.Email);
|
|
1753
|
+
if (!user.email) {
|
|
1754
|
+
// when user has no email at all (verified or not)
|
|
1755
|
+
fieldsMissingVerification.push({
|
|
1756
|
+
errorCode: 'MISSING_INFORMATION',
|
|
1757
|
+
field: 'email'
|
|
1758
|
+
});
|
|
1759
|
+
} else if (!emailVerifiedCredential) {
|
|
1760
|
+
// when user has an email but it is not verified
|
|
1761
|
+
fieldsMissingVerification.push({
|
|
1762
|
+
data: user.email,
|
|
1763
|
+
errorCode: 'MISSING_VERIFICATION',
|
|
1764
|
+
field: 'email'
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
const phoneVerifiedCredential = user.verifiedCredentials.find((credential)=>credential.format === sdkApiCore.JwtVerifiedCredentialFormatEnum.PhoneNumber);
|
|
1768
|
+
const phoneNumberVerifiedInPast60Days = (phoneVerifiedCredential == null ? void 0 : phoneVerifiedCredential.verifiedAt) && phoneVerifiedCredential.verifiedAt >= new Date(Date.now() - 60 * 24 * 60 * 60 * 1000);
|
|
1769
|
+
if (!user.phoneNumber) {
|
|
1770
|
+
// when user has no phone number at all (verified or not)
|
|
1771
|
+
fieldsMissingVerification.push({
|
|
1772
|
+
errorCode: 'MISSING_INFORMATION',
|
|
1773
|
+
field: 'phoneNumber'
|
|
1774
|
+
});
|
|
1775
|
+
} else if (!phoneVerifiedCredential) {
|
|
1776
|
+
// when user has a phone number but it is not verified
|
|
1777
|
+
fieldsMissingVerification.push({
|
|
1778
|
+
data: user.phoneNumber,
|
|
1779
|
+
errorCode: 'MISSING_VERIFICATION',
|
|
1780
|
+
field: 'phoneNumber'
|
|
1781
|
+
});
|
|
1782
|
+
} else if (!phoneNumberVerifiedInPast60Days) {
|
|
1783
|
+
// when user has a verified phone number but it is not verified in the last 60 days
|
|
1784
|
+
fieldsMissingVerification.push({
|
|
1785
|
+
data: user.phoneNumber,
|
|
1786
|
+
errorCode: 'VERIFICATION_EXPIRED',
|
|
1787
|
+
field: 'phoneNumber'
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
return fieldsMissingVerification;
|
|
1791
|
+
};
|
|
1792
|
+
|
|
1793
|
+
const validateUserCredentialsForCoinbaseOnrampOrder = (client)=>{
|
|
1794
|
+
const { user } = client;
|
|
1795
|
+
constants.assertDefined(user, 'User is not authenticated');
|
|
1796
|
+
const fieldsMissingVerification = getMissingVerificationForCoinbaseOnrampOrder({
|
|
1797
|
+
paymentMethod: 'GUEST_CHECKOUT_APPLE_PAY'
|
|
1798
|
+
}, client);
|
|
1799
|
+
const missingEmailVerification = fieldsMissingVerification.find((field)=>field.field === 'email');
|
|
1800
|
+
if (missingEmailVerification) {
|
|
1801
|
+
throw new MissingUserVerificationError({
|
|
1802
|
+
informationToVerify: 'email',
|
|
1803
|
+
message: 'User must have a verified email to create a Coinbase onramp order'
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
const missingPhoneNumberVerification = fieldsMissingVerification.find((field)=>field.field === 'phoneNumber');
|
|
1807
|
+
if (missingPhoneNumberVerification && missingPhoneNumberVerification.errorCode !== 'VERIFICATION_EXPIRED') {
|
|
1808
|
+
throw new MissingUserVerificationError({
|
|
1809
|
+
informationToVerify: 'phoneNumber',
|
|
1810
|
+
message: 'User must have a verified phone number to create a Coinbase onramp order'
|
|
1811
|
+
});
|
|
1812
|
+
}
|
|
1813
|
+
// this is a requirement for Coinbase Onramp
|
|
1814
|
+
// https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/create-an-onramp-order#body-phone-number-verified-at
|
|
1815
|
+
if (missingPhoneNumberVerification && missingPhoneNumberVerification.errorCode === 'VERIFICATION_EXPIRED') {
|
|
1816
|
+
throw new MissingUserVerificationError({
|
|
1817
|
+
informationToVerify: 'phoneNumber',
|
|
1818
|
+
message: "The user's phone number has not been verified in the last 60 days. Please re-verify the user's phone number"
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
return user;
|
|
1822
|
+
};
|
|
1823
|
+
|
|
1824
|
+
/**
|
|
1825
|
+
* Creates a Coinbase onramp order
|
|
1826
|
+
*
|
|
1827
|
+
* @param orderParams CoinbaseCreateOnrampOrderRequest - The parameters for the onramp order.
|
|
1828
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1829
|
+
* @returns The created order
|
|
1830
|
+
* @throws {MissingUserVerificationError} If the user is missing verification for email or phone
|
|
1831
|
+
*/ const createCoinbaseOnrampOrder = async (orderParams, client = constants.getDefaultClient())=>{
|
|
1832
|
+
const user = validateUserCredentialsForCoinbaseOnrampOrder(client);
|
|
1833
|
+
const core = constants.getCore(client);
|
|
1834
|
+
const apiClient = constants.createApiClient({
|
|
1835
|
+
includeMfaToken: true
|
|
1836
|
+
}, client);
|
|
1837
|
+
const { isSandbox } = orderParams, restOrderParams = _object_without_properties_loose(orderParams, [
|
|
1838
|
+
"isSandbox"
|
|
1839
|
+
]);
|
|
1840
|
+
var _orderParams_partnerUserRef;
|
|
1841
|
+
const orderResponse = await apiClient.createCoinbaseOnrampOrder({
|
|
1842
|
+
coinbaseOnrampOrderCreateRequest: constants._extends({}, restOrderParams, {
|
|
1843
|
+
// to create a sandbox order, we need to prefix the partner user ref with 'sandbox-'
|
|
1844
|
+
// https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/apple-pay-onramp-api#testing
|
|
1845
|
+
partnerUserRef: (_orderParams_partnerUserRef = orderParams.partnerUserRef) != null ? _orderParams_partnerUserRef : isSandbox ? `sandbox-${user.id}` : user.id,
|
|
1846
|
+
paymentMethod: orderParams.paymentMethod
|
|
1847
|
+
}),
|
|
1848
|
+
environmentId: core.environmentId
|
|
1849
|
+
});
|
|
1850
|
+
if (!isSandbox || !orderResponse.paymentLink) {
|
|
1851
|
+
return orderResponse;
|
|
1852
|
+
}
|
|
1853
|
+
return constants._extends({}, orderResponse, {
|
|
1854
|
+
paymentLink: constants._extends({}, orderResponse.paymentLink, {
|
|
1855
|
+
url: `${orderResponse.paymentLink.url}&useApplePaySandbox=true`
|
|
1856
|
+
})
|
|
1857
|
+
});
|
|
1858
|
+
};
|
|
1859
|
+
|
|
1656
1860
|
/**
|
|
1657
1861
|
* Allows waiting until all modules of the client have been properly initialized
|
|
1658
1862
|
* and are ready for use.
|
|
@@ -3799,6 +4003,7 @@ exports.ClientAlreadyInitializedError = ClientAlreadyInitializedError;
|
|
|
3799
4003
|
exports.InvalidRedirectStorageStateError = InvalidRedirectStorageStateError;
|
|
3800
4004
|
exports.MissingRedirectStorageStateError = MissingRedirectStorageStateError;
|
|
3801
4005
|
exports.MissingSocialUrlParamError = MissingSocialUrlParamError;
|
|
4006
|
+
exports.MissingUserVerificationError = MissingUserVerificationError;
|
|
3802
4007
|
exports.NetworkSwitchingUnavailableError = NetworkSwitchingUnavailableError;
|
|
3803
4008
|
exports.NoAddressFoundError = NoAddressFoundError;
|
|
3804
4009
|
exports.NoPasskeyCredentialsFoundError = NoPasskeyCredentialsFoundError;
|
|
@@ -3812,6 +4017,7 @@ exports.WalletAccountAlreadyVerifiedError = WalletAccountAlreadyVerifiedError;
|
|
|
3812
4017
|
exports.WalletAccountNotSelectedError = WalletAccountNotSelectedError;
|
|
3813
4018
|
exports.WalletProviderMethodUnavailableError = WalletProviderMethodUnavailableError;
|
|
3814
4019
|
exports.acknowledgeRecoveryCodes = acknowledgeRecoveryCodes;
|
|
4020
|
+
exports.addCoinbaseOnrampOrderEventListener = addCoinbaseOnrampOrderEventListener;
|
|
3815
4021
|
exports.assertWalletAccountSigningAvailability = assertWalletAccountSigningAvailability;
|
|
3816
4022
|
exports.assertWalletProviderMethodDefined = assertWalletProviderMethodDefined;
|
|
3817
4023
|
exports.authenticateMfaRecoveryCode = authenticateMfaRecoveryCode;
|
|
@@ -3821,6 +4027,7 @@ exports.authenticateWithSocial = authenticateWithSocial;
|
|
|
3821
4027
|
exports.completeSocialAuthentication = completeSocialAuthentication;
|
|
3822
4028
|
exports.connectAndVerifyWithWalletProvider = connectAndVerifyWithWalletProvider;
|
|
3823
4029
|
exports.connectWithWalletProvider = connectWithWalletProvider;
|
|
4030
|
+
exports.createCoinbaseOnrampOrder = createCoinbaseOnrampOrder;
|
|
3824
4031
|
exports.createDynamicClient = createDynamicClient;
|
|
3825
4032
|
exports.createNewMfaRecoveryCodes = createNewMfaRecoveryCodes;
|
|
3826
4033
|
exports.deleteMfaDevice = deleteMfaDevice;
|
|
@@ -3836,6 +4043,7 @@ exports.getBalanceForAddress = getBalanceForAddress;
|
|
|
3836
4043
|
exports.getConnectedAddresses = getConnectedAddresses;
|
|
3837
4044
|
exports.getMfaDevices = getMfaDevices;
|
|
3838
4045
|
exports.getMfaRecoveryCodes = getMfaRecoveryCodes;
|
|
4046
|
+
exports.getMissingVerificationForCoinbaseOnrampOrder = getMissingVerificationForCoinbaseOnrampOrder;
|
|
3839
4047
|
exports.getMultichainBalances = getMultichainBalances;
|
|
3840
4048
|
exports.getOwnerWalletAccountForSmartWalletAccount = getOwnerWalletAccountForSmartWalletAccount;
|
|
3841
4049
|
exports.getPasskeys = getPasskeys;
|
package/index.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';
|
|
2
|
-
import { B as BaseError, g as getDefaultClient, a as getCore, c as createApiClient, C as CLIENT_SDK_NAME, b as getBuffer, i as isCookieEnabled, S as SDK_API_CORE_VERSION, d as assertDefined, v as version, s as setDefaultClient, _ as _extends, r as randomString, e as CHAINS_INFO_MAP, n as name } from './constants.esm.js';
|
|
2
|
+
import { B as BaseError, g as getDefaultClient, a as getCore, c as createApiClient, C as CLIENT_SDK_NAME, b as getBuffer, i as isCookieEnabled, S as SDK_API_CORE_VERSION, d as assertDefined, v as version, s as setDefaultClient, _ as _extends, r as randomString, V as ValueMustBeDefinedError, e as CHAINS_INFO_MAP, n as name } from './constants.esm.js';
|
|
3
3
|
export { I as InvalidExternalAuthError, M as MfaInvalidOtpError, f as MfaRateLimitedError, h as SandboxMaximumThresholdReachedError } from './constants.esm.js';
|
|
4
4
|
import { JwtVerifiedCredentialFormatEnum, ProviderEnum, MfaBackupCodeAcknowledgement, AuthModeEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
export { MFAAction } from '@dynamic-labs/sdk-api-core';
|
|
6
6
|
import { c as createStorageKeySchema, s as subscribeWithSelector, i as isEqualShallow, I as INITIALIZE_STORAGE_SYNC_TRACKER_KEY, F as FETCH_PROJECT_SETTINGS_TRACKER_KEY, G as GENERATE_SESSION_KEYS_TRACKER_KEY, R as REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY, C as CannotTrackError, a as createLogger, b as createStorage, d as createLocalStorageAdapter, e as consumeCaptchaToken, f as setUnverifiedWalletAccounts, g as createVisit, h as createSignInMessageStatement, j as formatSignInMessage, v as verifySignInMessage, u as updateWalletProviderKeysForVerifiedCredentials, k as getNetworksData, l as getNetworkProviderFromNetworkId } from './getNetworkProviderFromNetworkId.esm.js';
|
|
7
7
|
export { N as NoNetworkProvidersError, W as WalletAlreadyLinkedToAnotherUserError, o as hasExtension, m as isCaptchaRequired, n as setCaptchaToken } from './getNetworkProviderFromNetworkId.esm.js';
|
|
8
|
-
import { g as getWalletAccounts, a as getWalletProviderFromWalletAccount, s as setCookie, e as emitEvent, D as DYNAMIC_AUTH_COOKIE_NAME, u as updateAuthFromVerifyResponse, b as getWalletProviderByKey, f as formatWalletAccountId,
|
|
8
|
+
import { g as getWalletAccounts, a as getWalletProviderFromWalletAccount, s as setCookie, e as emitEvent, D as DYNAMIC_AUTH_COOKIE_NAME, c as checkAndRaiseWalletAccountsChangedEvent, u as updateAuthFromVerifyResponse, b as getWalletProviderByKey, f as formatWalletAccountId, d as emitWalletAccountsChangedEvent, n as normalizeAddress, h as getWalletProviders, i as getVerifiedCredentialForWalletAccount, N as NoWalletProviderFoundError } from './getVerifiedCredentialForWalletAccount.esm.js';
|
|
9
9
|
export { o as offEvent, k as onEvent, j as onceEvent } from './getVerifiedCredentialForWalletAccount.esm.js';
|
|
10
10
|
import * as z from 'zod/mini';
|
|
11
11
|
import { b as bufferToHex } from './isMfaRequiredForAction.esm.js';
|
|
@@ -14,7 +14,7 @@ import { r as refreshUser } from './NotWaasWalletAccountError.esm.js';
|
|
|
14
14
|
export { N as NotWaasWalletAccountError } from './NotWaasWalletAccountError.esm.js';
|
|
15
15
|
import EventEmitter$1, { EventEmitter } from 'eventemitter3';
|
|
16
16
|
import { startRegistration, browserSupportsWebAuthn, startAuthentication } from '@simplewebauthn/browser';
|
|
17
|
-
|
|
17
|
+
import { I as InvalidParamError } from './InvalidParamError.esm.js';
|
|
18
18
|
import 'buffer';
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -407,6 +407,7 @@ const sessionStorageKeySchema = createStorageKeySchema({
|
|
|
407
407
|
|
|
408
408
|
const hydrateStateWithStorage = async (client)=>{
|
|
409
409
|
const core = getCore(client);
|
|
410
|
+
const previousState = core.state.get();
|
|
410
411
|
const stateChanges = {};
|
|
411
412
|
// ================ TOKEN =================
|
|
412
413
|
const session = await core.storage.getItem(sessionStorageKeySchema);
|
|
@@ -439,6 +440,9 @@ const hydrateStateWithStorage = async (client)=>{
|
|
|
439
440
|
if (Object.keys(stateChanges).length > 0) {
|
|
440
441
|
core.state.set(stateChanges);
|
|
441
442
|
}
|
|
443
|
+
checkAndRaiseWalletAccountsChangedEvent({
|
|
444
|
+
previousState
|
|
445
|
+
}, client);
|
|
442
446
|
};
|
|
443
447
|
|
|
444
448
|
const syncStateWithStorage = (client)=>{
|
|
@@ -1009,6 +1013,19 @@ class MissingSocialUrlParamError extends BaseError {
|
|
|
1009
1013
|
}
|
|
1010
1014
|
}
|
|
1011
1015
|
|
|
1016
|
+
class MissingUserVerificationError extends BaseError {
|
|
1017
|
+
constructor({ informationToVerify, message }){
|
|
1018
|
+
super({
|
|
1019
|
+
cause: null,
|
|
1020
|
+
code: 'missing_user_verification_error',
|
|
1021
|
+
docsUrl: null,
|
|
1022
|
+
name: 'MissingUserVerificationError',
|
|
1023
|
+
shortMessage: message != null ? message : `The user is missing verification for ${informationToVerify}. Please verify the user's ${informationToVerify}`
|
|
1024
|
+
});
|
|
1025
|
+
this.informationToVerify = informationToVerify;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1012
1029
|
class NetworkSwitchingUnavailableError extends BaseError {
|
|
1013
1030
|
constructor({ walletProviderKey, originalError, extraMessages }){
|
|
1014
1031
|
const cause = originalError instanceof Error ? originalError : null;
|
|
@@ -1638,6 +1655,193 @@ const providersRequiringPkce = [
|
|
|
1638
1655
|
return response.chainBalances;
|
|
1639
1656
|
};
|
|
1640
1657
|
|
|
1658
|
+
/**
|
|
1659
|
+
* Adds a listener for Coinbase onramp order events.
|
|
1660
|
+
*
|
|
1661
|
+
* @param params.listener - The listener function to call when an event is received.
|
|
1662
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1663
|
+
* @returns A function to remove the listener.
|
|
1664
|
+
* @throws {ValueMustBeDefinedError} If the window is not available.
|
|
1665
|
+
* @docs https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/apple-pay-onramp-api#events-names
|
|
1666
|
+
*/ const addCoinbaseOnrampOrderEventListener = ({ listener }, client = getDefaultClient())=>{
|
|
1667
|
+
const core = getCore(client);
|
|
1668
|
+
if (typeof window === 'undefined') {
|
|
1669
|
+
throw new ValueMustBeDefinedError('Window is not available to listen for Coinbase onramp order events');
|
|
1670
|
+
}
|
|
1671
|
+
const handleMessageEvent = (event)=>{
|
|
1672
|
+
if (event.origin !== 'https://pay.coinbase.com') {
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
core.logger.debug('[addCoinbaseOnrampOrderEventListener] pay.coinbase.com event received', {
|
|
1676
|
+
event
|
|
1677
|
+
});
|
|
1678
|
+
try {
|
|
1679
|
+
var _coinbaseOnrampOrderEventData_eventName;
|
|
1680
|
+
const coinbaseOnrampOrderEventData = JSON.parse(event.data);
|
|
1681
|
+
if (!((_coinbaseOnrampOrderEventData_eventName = coinbaseOnrampOrderEventData.eventName) == null ? void 0 : _coinbaseOnrampOrderEventData_eventName.startsWith('onramp_api.'))) {
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1684
|
+
listener({
|
|
1685
|
+
data: coinbaseOnrampOrderEventData.data,
|
|
1686
|
+
eventName: coinbaseOnrampOrderEventData.eventName
|
|
1687
|
+
});
|
|
1688
|
+
} catch (error) {
|
|
1689
|
+
core.logger.debug('[addCoinbaseOnrampOrderEventListener] Failed to parse Coinbase onramp order event data', {
|
|
1690
|
+
error
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
};
|
|
1694
|
+
window.addEventListener('message', handleMessageEvent);
|
|
1695
|
+
return ()=>{
|
|
1696
|
+
window.removeEventListener('message', handleMessageEvent);
|
|
1697
|
+
};
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1700
|
+
function _object_without_properties_loose(source, excluded) {
|
|
1701
|
+
if (source == null) return {};
|
|
1702
|
+
var target = {};
|
|
1703
|
+
var sourceKeys = Object.keys(source);
|
|
1704
|
+
var key, i;
|
|
1705
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
1706
|
+
key = sourceKeys[i];
|
|
1707
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
1708
|
+
target[key] = source[key];
|
|
1709
|
+
}
|
|
1710
|
+
return target;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* This function is used to get a list of fields that are missing verification for a Coinbase onramp order
|
|
1715
|
+
*
|
|
1716
|
+
* - If the user is missing information for an email or phone number, the field will be returned with the error code MISSING_INFORMATION
|
|
1717
|
+
* - If the user is missing verification for an email or phone number, the field will be returned with the error code MISSING_VERIFICATION
|
|
1718
|
+
* and the existing unverified email or phone number will be included in the data field.
|
|
1719
|
+
* - If the user's phone number has not been verified in the last 60 days, the field will be returned with the error code VERIFICATION_EXPIRED
|
|
1720
|
+
* and the existing phone number will be included in the data field.
|
|
1721
|
+
*
|
|
1722
|
+
* @param params.paymentMethod - The payment method that will be used to create the onramp order
|
|
1723
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1724
|
+
* @returns FieldMissingVerificationForCoinbaseOnramp[] - An array of fields that are missing verification for a Coinbase onramp order
|
|
1725
|
+
* @throws {InvalidParamError} - If the payment method is not valid
|
|
1726
|
+
* @throws {ValueMustBeDefinedError} - If the user is not authenticated
|
|
1727
|
+
*/ const getMissingVerificationForCoinbaseOnrampOrder = ({ paymentMethod }, client = getDefaultClient())=>{
|
|
1728
|
+
// adding the payment method as a param for now just so a user has to pass an object as the first param
|
|
1729
|
+
// that way, when we add more payment methods, we can easily add them to the param object
|
|
1730
|
+
// and not have to change the function signature
|
|
1731
|
+
if (paymentMethod !== 'GUEST_CHECKOUT_APPLE_PAY') {
|
|
1732
|
+
throw new InvalidParamError(`Invalid payment method: ${paymentMethod}`);
|
|
1733
|
+
}
|
|
1734
|
+
const { user } = client;
|
|
1735
|
+
assertDefined(user, 'User is not authenticated');
|
|
1736
|
+
const fieldsMissingVerification = [];
|
|
1737
|
+
const emailVerifiedCredential = user.verifiedCredentials.find((credential)=>credential.format === JwtVerifiedCredentialFormatEnum.Email);
|
|
1738
|
+
if (!user.email) {
|
|
1739
|
+
// when user has no email at all (verified or not)
|
|
1740
|
+
fieldsMissingVerification.push({
|
|
1741
|
+
errorCode: 'MISSING_INFORMATION',
|
|
1742
|
+
field: 'email'
|
|
1743
|
+
});
|
|
1744
|
+
} else if (!emailVerifiedCredential) {
|
|
1745
|
+
// when user has an email but it is not verified
|
|
1746
|
+
fieldsMissingVerification.push({
|
|
1747
|
+
data: user.email,
|
|
1748
|
+
errorCode: 'MISSING_VERIFICATION',
|
|
1749
|
+
field: 'email'
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1752
|
+
const phoneVerifiedCredential = user.verifiedCredentials.find((credential)=>credential.format === JwtVerifiedCredentialFormatEnum.PhoneNumber);
|
|
1753
|
+
const phoneNumberVerifiedInPast60Days = (phoneVerifiedCredential == null ? void 0 : phoneVerifiedCredential.verifiedAt) && phoneVerifiedCredential.verifiedAt >= new Date(Date.now() - 60 * 24 * 60 * 60 * 1000);
|
|
1754
|
+
if (!user.phoneNumber) {
|
|
1755
|
+
// when user has no phone number at all (verified or not)
|
|
1756
|
+
fieldsMissingVerification.push({
|
|
1757
|
+
errorCode: 'MISSING_INFORMATION',
|
|
1758
|
+
field: 'phoneNumber'
|
|
1759
|
+
});
|
|
1760
|
+
} else if (!phoneVerifiedCredential) {
|
|
1761
|
+
// when user has a phone number but it is not verified
|
|
1762
|
+
fieldsMissingVerification.push({
|
|
1763
|
+
data: user.phoneNumber,
|
|
1764
|
+
errorCode: 'MISSING_VERIFICATION',
|
|
1765
|
+
field: 'phoneNumber'
|
|
1766
|
+
});
|
|
1767
|
+
} else if (!phoneNumberVerifiedInPast60Days) {
|
|
1768
|
+
// when user has a verified phone number but it is not verified in the last 60 days
|
|
1769
|
+
fieldsMissingVerification.push({
|
|
1770
|
+
data: user.phoneNumber,
|
|
1771
|
+
errorCode: 'VERIFICATION_EXPIRED',
|
|
1772
|
+
field: 'phoneNumber'
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
return fieldsMissingVerification;
|
|
1776
|
+
};
|
|
1777
|
+
|
|
1778
|
+
const validateUserCredentialsForCoinbaseOnrampOrder = (client)=>{
|
|
1779
|
+
const { user } = client;
|
|
1780
|
+
assertDefined(user, 'User is not authenticated');
|
|
1781
|
+
const fieldsMissingVerification = getMissingVerificationForCoinbaseOnrampOrder({
|
|
1782
|
+
paymentMethod: 'GUEST_CHECKOUT_APPLE_PAY'
|
|
1783
|
+
}, client);
|
|
1784
|
+
const missingEmailVerification = fieldsMissingVerification.find((field)=>field.field === 'email');
|
|
1785
|
+
if (missingEmailVerification) {
|
|
1786
|
+
throw new MissingUserVerificationError({
|
|
1787
|
+
informationToVerify: 'email',
|
|
1788
|
+
message: 'User must have a verified email to create a Coinbase onramp order'
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
const missingPhoneNumberVerification = fieldsMissingVerification.find((field)=>field.field === 'phoneNumber');
|
|
1792
|
+
if (missingPhoneNumberVerification && missingPhoneNumberVerification.errorCode !== 'VERIFICATION_EXPIRED') {
|
|
1793
|
+
throw new MissingUserVerificationError({
|
|
1794
|
+
informationToVerify: 'phoneNumber',
|
|
1795
|
+
message: 'User must have a verified phone number to create a Coinbase onramp order'
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1798
|
+
// this is a requirement for Coinbase Onramp
|
|
1799
|
+
// https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/create-an-onramp-order#body-phone-number-verified-at
|
|
1800
|
+
if (missingPhoneNumberVerification && missingPhoneNumberVerification.errorCode === 'VERIFICATION_EXPIRED') {
|
|
1801
|
+
throw new MissingUserVerificationError({
|
|
1802
|
+
informationToVerify: 'phoneNumber',
|
|
1803
|
+
message: "The user's phone number has not been verified in the last 60 days. Please re-verify the user's phone number"
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
return user;
|
|
1807
|
+
};
|
|
1808
|
+
|
|
1809
|
+
/**
|
|
1810
|
+
* Creates a Coinbase onramp order
|
|
1811
|
+
*
|
|
1812
|
+
* @param orderParams CoinbaseCreateOnrampOrderRequest - The parameters for the onramp order.
|
|
1813
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1814
|
+
* @returns The created order
|
|
1815
|
+
* @throws {MissingUserVerificationError} If the user is missing verification for email or phone
|
|
1816
|
+
*/ const createCoinbaseOnrampOrder = async (orderParams, client = getDefaultClient())=>{
|
|
1817
|
+
const user = validateUserCredentialsForCoinbaseOnrampOrder(client);
|
|
1818
|
+
const core = getCore(client);
|
|
1819
|
+
const apiClient = createApiClient({
|
|
1820
|
+
includeMfaToken: true
|
|
1821
|
+
}, client);
|
|
1822
|
+
const { isSandbox } = orderParams, restOrderParams = _object_without_properties_loose(orderParams, [
|
|
1823
|
+
"isSandbox"
|
|
1824
|
+
]);
|
|
1825
|
+
var _orderParams_partnerUserRef;
|
|
1826
|
+
const orderResponse = await apiClient.createCoinbaseOnrampOrder({
|
|
1827
|
+
coinbaseOnrampOrderCreateRequest: _extends({}, restOrderParams, {
|
|
1828
|
+
// to create a sandbox order, we need to prefix the partner user ref with 'sandbox-'
|
|
1829
|
+
// https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/apple-pay-onramp-api#testing
|
|
1830
|
+
partnerUserRef: (_orderParams_partnerUserRef = orderParams.partnerUserRef) != null ? _orderParams_partnerUserRef : isSandbox ? `sandbox-${user.id}` : user.id,
|
|
1831
|
+
paymentMethod: orderParams.paymentMethod
|
|
1832
|
+
}),
|
|
1833
|
+
environmentId: core.environmentId
|
|
1834
|
+
});
|
|
1835
|
+
if (!isSandbox || !orderResponse.paymentLink) {
|
|
1836
|
+
return orderResponse;
|
|
1837
|
+
}
|
|
1838
|
+
return _extends({}, orderResponse, {
|
|
1839
|
+
paymentLink: _extends({}, orderResponse.paymentLink, {
|
|
1840
|
+
url: `${orderResponse.paymentLink.url}&useApplePaySandbox=true`
|
|
1841
|
+
})
|
|
1842
|
+
});
|
|
1843
|
+
};
|
|
1844
|
+
|
|
1641
1845
|
/**
|
|
1642
1846
|
* Allows waiting until all modules of the client have been properly initialized
|
|
1643
1847
|
* and are ready for use.
|
|
@@ -3754,4 +3958,4 @@ const isIPhone = ()=>typeof window === 'undefined' || typeof navigator === 'unde
|
|
|
3754
3958
|
|
|
3755
3959
|
assertPackageVersion(name, version);
|
|
3756
3960
|
|
|
3757
|
-
export { BaseError, ClientAlreadyInitializedError, InvalidRedirectStorageStateError, MissingRedirectStorageStateError, MissingSocialUrlParamError, NetworkSwitchingUnavailableError, NoAddressFoundError, NoPasskeyCredentialsFoundError, NoSmartWalletAccountSignerFoundError, NoWebAuthNSupportError, UnavailableInServerSideError, UnrecognizedNetworkError, UserNotAuthenticatedError, UserRejectedError, WalletAccountAlreadyVerifiedError, WalletAccountNotSelectedError, WalletProviderMethodUnavailableError, acknowledgeRecoveryCodes, assertWalletAccountSigningAvailability, assertWalletProviderMethodDefined, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, authenticateWithSocial, completeSocialAuthentication, connectAndVerifyWithWalletProvider, connectWithWalletProvider, createDynamicClient, createNewMfaRecoveryCodes, deleteMfaDevice, deletePasskey, deleteUser, detectOAuthRedirect, fetchProjectSettings, getActiveNetworkData, getActiveNetworkId, getAvailableWalletProvidersData, getBalance, getBalanceForAddress, getConnectedAddresses, getDefaultClient, getMfaDevices, getMfaRecoveryCodes, getMultichainBalances, getNetworksData, getOwnerWalletAccountForSmartWalletAccount, getPasskeys, getPrimaryWalletAccount, getUserSocialAccounts, getWalletAccountAddressByType, getWalletAccountFromAddress, getWalletAccounts, getWalletProviderDataByKey, initializeClient, isMobile, isPendingRecoveryCodesAcknowledgment, isProgrammaticNetworkSwitchAvailable, isSignedIn, isUserMissingMfaAuth, isWalletAccountVerified, logout, offWalletProviderEvent, onWalletProviderEvent, proveWalletAccountOwnership, refreshUser, registerPasskey, registerTotpMfaDevice, removeWalletAccount, selectPrimaryWalletAccount, sendEmailOTP, sendSmsOTP, setDefaultMfaDevice, signInWithExternalJwt, signInWithPasskey, signMessage, switchActiveNetwork, unlinkSocialAccount, updateUser, verifyOTP, verifyWalletAccount, waitForClientInitialized };
|
|
3961
|
+
export { BaseError, ClientAlreadyInitializedError, InvalidParamError, InvalidRedirectStorageStateError, MissingRedirectStorageStateError, MissingSocialUrlParamError, MissingUserVerificationError, NetworkSwitchingUnavailableError, NoAddressFoundError, NoPasskeyCredentialsFoundError, NoSmartWalletAccountSignerFoundError, NoWebAuthNSupportError, UnavailableInServerSideError, UnrecognizedNetworkError, UserNotAuthenticatedError, UserRejectedError, WalletAccountAlreadyVerifiedError, WalletAccountNotSelectedError, WalletProviderMethodUnavailableError, acknowledgeRecoveryCodes, addCoinbaseOnrampOrderEventListener, assertWalletAccountSigningAvailability, assertWalletProviderMethodDefined, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, authenticateWithSocial, completeSocialAuthentication, connectAndVerifyWithWalletProvider, connectWithWalletProvider, createCoinbaseOnrampOrder, createDynamicClient, createNewMfaRecoveryCodes, deleteMfaDevice, deletePasskey, deleteUser, detectOAuthRedirect, fetchProjectSettings, getActiveNetworkData, getActiveNetworkId, getAvailableWalletProvidersData, getBalance, getBalanceForAddress, getConnectedAddresses, getDefaultClient, getMfaDevices, getMfaRecoveryCodes, getMissingVerificationForCoinbaseOnrampOrder, getMultichainBalances, getNetworksData, getOwnerWalletAccountForSmartWalletAccount, getPasskeys, getPrimaryWalletAccount, getUserSocialAccounts, getWalletAccountAddressByType, getWalletAccountFromAddress, getWalletAccounts, getWalletProviderDataByKey, initializeClient, isMobile, isPendingRecoveryCodesAcknowledgment, isProgrammaticNetworkSwitchAvailable, isSignedIn, isUserMissingMfaAuth, isWalletAccountVerified, logout, offWalletProviderEvent, onWalletProviderEvent, proveWalletAccountOwnership, refreshUser, registerPasskey, registerTotpMfaDevice, removeWalletAccount, selectPrimaryWalletAccount, sendEmailOTP, sendSmsOTP, setDefaultMfaDevice, signInWithExternalJwt, signInWithPasskey, signMessage, switchActiveNetwork, unlinkSocialAccount, updateUser, verifyOTP, verifyWalletAccount, waitForClientInitialized };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-sdk/client",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"module": "./index.esm.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@dynamic-labs-sdk/assert-package-version": "0.1.0-alpha.
|
|
32
|
+
"@dynamic-labs-sdk/assert-package-version": "0.1.0-alpha.34",
|
|
33
33
|
"@dynamic-labs/sdk-api-core": "0.0.831",
|
|
34
34
|
"@dynamic-labs-wallet/browser-wallet-client": "0.0.211",
|
|
35
35
|
"@simplewebauthn/browser": "13.1.0",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { UserFields } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
import { BaseError } from './base';
|
|
3
|
+
type MissingUserVerificationErrorParams = {
|
|
4
|
+
informationToVerify: Extract<keyof UserFields, 'email' | 'phoneNumber'>;
|
|
5
|
+
message?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class MissingUserVerificationError extends BaseError {
|
|
8
|
+
readonly informationToVerify: MissingUserVerificationErrorParams['informationToVerify'];
|
|
9
|
+
constructor({ informationToVerify, message, }: MissingUserVerificationErrorParams);
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=MissingUserVerificationError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MissingUserVerificationError.d.ts","sourceRoot":"","sources":["../../../../../packages/client/src/errors/MissingUserVerificationError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,KAAK,kCAAkC,GAAG;IACxC,mBAAmB,EAAE,OAAO,CAAC,MAAM,UAAU,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qBAAa,4BAA6B,SAAQ,SAAS;IACzD,SAAgB,mBAAmB,EAAE,kCAAkC,CAAC,qBAAqB,CAAC,CAAC;gBAEnF,EACV,mBAAmB,EACnB,OAAO,GACR,EAAE,kCAAkC;CAatC"}
|
package/src/exports/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export { MfaInvalidOtpError } from '../errors/MfaInvalidOtpError';
|
|
|
26
26
|
export { MfaRateLimitedError } from '../errors/MfaRateLimitedError';
|
|
27
27
|
export { MissingRedirectStorageStateError } from '../errors/MissingRedirectStorageStateError';
|
|
28
28
|
export { MissingSocialUrlParamError } from '../errors/MissingSocialUrlParamError';
|
|
29
|
+
export { MissingUserVerificationError } from '../errors/MissingUserVerificationError';
|
|
29
30
|
export { NetworkSwitchingUnavailableError } from '../errors/NetworkSwitchingUnavailableError';
|
|
30
31
|
export { NoAddressFoundError } from '../errors/NoAddressFoundError';
|
|
31
32
|
export { NoNetworkProvidersError } from '../errors/NoNetworkProvidersError';
|
|
@@ -62,6 +63,10 @@ export type { Chain } from '../modules/chain';
|
|
|
62
63
|
export { offEvent, onceEvent, onEvent } from '../modules/clientEvents';
|
|
63
64
|
export type { DynamicEvents, OffEventParams, OnceEventParams, OnEventParams, } from '../modules/clientEvents/clientEvents.types';
|
|
64
65
|
export { hasExtension } from '../modules/extension/hasExtension';
|
|
66
|
+
export { addCoinbaseOnrampOrderEventListener } from '../modules/funding/coinbase/addCoinbaseOnrampOrderEventListener';
|
|
67
|
+
export type { CoinbaseCreateOnrampOrderRequest, CoinbaseOnrampFeeType, CoinbaseOnrampMissingVerificationErrorCode, CoinbaseOnrampOrderPaymentLinkType, CoinbaseOnrampOrderPaymentMethod, CoinbaseOnrampOrderResponse, CoinbaseOnrampOrderStatus, FieldMissingVerificationForCoinbaseOnramp, } from '../modules/funding/coinbase/coinbase.types';
|
|
68
|
+
export { createCoinbaseOnrampOrder } from '../modules/funding/coinbase/createCoinbaseOnrampOrder';
|
|
69
|
+
export { getMissingVerificationForCoinbaseOnrampOrder } from '../modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder';
|
|
65
70
|
export { initializeClient } from '../modules/initializeClient';
|
|
66
71
|
export type { DynamicInitStatus } from '../modules/initializeClient/state';
|
|
67
72
|
export { waitForClientInitialized } from '../modules/initializeClient/waitForClientInitialized';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/client/src/exports/index.ts"],"names":[],"mappings":"AAWA,OAAO,uBAAuB,CAAC;AAC/B,OAAO,0BAA0B,CAAC;AAClC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,sBAAsB,CAAC;AAC9B,OAAO,kCAAkC,CAAC;AAC1C,OAAO,8BAA8B,CAAC;AACtC,OAAO,mDAAmD,CAAC;AAC3D,OAAO,8DAA8D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AE,0BAA0B,EAAE,MAAM,oEAAoE,CAAC;AAChH,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,4DAA4D,CAAC;AAC/G,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,YAAY,EACV,aAAa,EACb,iBAAiB,GAClB,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EACV,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iEAAiE,CAAC;AACzG,OAAO,EAAE,qBAAqB,EAAE,MAAM,gEAAgE,CAAC;AACvG,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type AddCoinbaseOnrampOrderEventListenerParams = {
|
|
2
|
+
listener: (event: {
|
|
3
|
+
data: Record<string, unknown>;
|
|
4
|
+
eventName: string;
|
|
5
|
+
}) => void;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Adds a listener for Coinbase onramp order events.
|
|
9
|
+
*
|
|
10
|
+
* @param params.listener - The listener function to call when an event is received.
|
|
11
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
12
|
+
* @returns A function to remove the listener.
|
|
13
|
+
* @throws {ValueMustBeDefinedError} If the window is not available.
|
|
14
|
+
* @docs https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/apple-pay-onramp-api#events-names
|
|
15
|
+
*/
|
|
16
|
+
export declare const addCoinbaseOnrampOrderEventListener: ({ listener }: AddCoinbaseOnrampOrderEventListenerParams, client?: import("../../../../exports").DynamicClient) => VoidFunction;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=addCoinbaseOnrampOrderEventListener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addCoinbaseOnrampOrderEventListener.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/addCoinbaseOnrampOrderEventListener.ts"],"names":[],"mappings":"AAMA,KAAK,yCAAyC,GAAG;IAC/C,QAAQ,EAAE,CAAC,KAAK,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,SAAS,EAAE,MAAM,CAAC;KACnB,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mCAAmC,iBAChC,yCAAyC,2DAEtD,YA6CF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import type { CoinbaseOnrampFeeType as CoinbaseOnrampFeeTypeEnum, CoinbaseOnrampOrderPaymentLinkType as CoinbaseOnrampOrderPaymentLinkTypeEnum, CoinbaseOnrampOrderPaymentMethod as CoinbaseOnrampOrderPaymentMethodEnum, CoinbaseOnrampOrderStatus as CoinbaseOnrampOrderStatusEnum, UserFields } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
export type CoinbaseOnrampFeeType = `${CoinbaseOnrampFeeTypeEnum}`;
|
|
3
|
+
export type CoinbaseOnrampOrderPaymentLinkType = `${CoinbaseOnrampOrderPaymentLinkTypeEnum}`;
|
|
4
|
+
export type CoinbaseOnrampOrderPaymentMethod = `${CoinbaseOnrampOrderPaymentMethodEnum}`;
|
|
5
|
+
export type CoinbaseOnrampOrderStatus = `${CoinbaseOnrampOrderStatusEnum}`;
|
|
6
|
+
export type CoinbaseOnrampFee = {
|
|
7
|
+
/**
|
|
8
|
+
* The amount of the fee.
|
|
9
|
+
*
|
|
10
|
+
* @example "0.95"
|
|
11
|
+
*/
|
|
12
|
+
amount: string;
|
|
13
|
+
/**
|
|
14
|
+
* The currency of the fee.
|
|
15
|
+
*
|
|
16
|
+
* @example "USD"
|
|
17
|
+
*/
|
|
18
|
+
currency: string;
|
|
19
|
+
/**
|
|
20
|
+
* The type of the fee.
|
|
21
|
+
*
|
|
22
|
+
* @example "FEE_TYPE_NETWORK"
|
|
23
|
+
*/
|
|
24
|
+
type: CoinbaseOnrampFeeType;
|
|
25
|
+
};
|
|
26
|
+
export type CoinbaseOnrampOrderResponse = {
|
|
27
|
+
order: {
|
|
28
|
+
/**
|
|
29
|
+
* The date and time the order was created.
|
|
30
|
+
*
|
|
31
|
+
* @example "2025-04-24T00:00:00Z"
|
|
32
|
+
*/
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
/**
|
|
35
|
+
* The address the purchased crypto will be sent to.
|
|
36
|
+
*
|
|
37
|
+
* @example "0x71C7656EC7ab88b098defB751B7401B5f6d8976F"
|
|
38
|
+
*/
|
|
39
|
+
destinationAddress: string;
|
|
40
|
+
/**
|
|
41
|
+
* The network the purchased crypto will be sent on.
|
|
42
|
+
*
|
|
43
|
+
* @example "base"
|
|
44
|
+
*/
|
|
45
|
+
destinationNetwork: string;
|
|
46
|
+
/**
|
|
47
|
+
* The exchange rate used to convert fiat to crypto i.e. the crypto value of one fiat.
|
|
48
|
+
*
|
|
49
|
+
* @example "1"
|
|
50
|
+
*/
|
|
51
|
+
exchangeRate: string;
|
|
52
|
+
/**
|
|
53
|
+
* The fees associated with the order.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* [
|
|
57
|
+
* {
|
|
58
|
+
* "type": "FEE_TYPE_EXCHANGE",
|
|
59
|
+
* "amount": "0.5",
|
|
60
|
+
* "currency": "USD"
|
|
61
|
+
* },
|
|
62
|
+
* {
|
|
63
|
+
* "type": "FEE_TYPE_NETWORK",
|
|
64
|
+
* "amount": "0.25",
|
|
65
|
+
* "currency": "USD"
|
|
66
|
+
* }
|
|
67
|
+
* ]
|
|
68
|
+
*/
|
|
69
|
+
fees: CoinbaseOnrampFee[];
|
|
70
|
+
/**
|
|
71
|
+
* The ID of the onramp order.
|
|
72
|
+
*
|
|
73
|
+
* @example "123e4567-e89b-12d3-a456-426614174000"
|
|
74
|
+
*/
|
|
75
|
+
orderId: string;
|
|
76
|
+
/**
|
|
77
|
+
* The partner user reference ID.
|
|
78
|
+
*
|
|
79
|
+
* @example "user123"
|
|
80
|
+
*/
|
|
81
|
+
partnerUserRef?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The fiat currency to be converted to crypto.
|
|
84
|
+
*
|
|
85
|
+
* @example "USD"
|
|
86
|
+
*/
|
|
87
|
+
paymentCurrency: string;
|
|
88
|
+
/**
|
|
89
|
+
* The type of payment method to be used to complete an onramp order.
|
|
90
|
+
*
|
|
91
|
+
* @example "GUEST_CHECKOUT_APPLE_PAY"
|
|
92
|
+
*/
|
|
93
|
+
paymentMethod: CoinbaseOnrampOrderPaymentMethod;
|
|
94
|
+
/**
|
|
95
|
+
* The amount of fiat to be converted to crypto.
|
|
96
|
+
*
|
|
97
|
+
* @example "100"
|
|
98
|
+
*/
|
|
99
|
+
paymentSubtotal: string;
|
|
100
|
+
/**
|
|
101
|
+
* The total amount of fiat to be paid, inclusive of any fees.
|
|
102
|
+
*
|
|
103
|
+
* @example "100.75"
|
|
104
|
+
*/
|
|
105
|
+
paymentTotal: string;
|
|
106
|
+
/**
|
|
107
|
+
* The amount of crypto to be purchased.
|
|
108
|
+
*
|
|
109
|
+
* @example "100.000000"
|
|
110
|
+
*/
|
|
111
|
+
purchaseAmount: string;
|
|
112
|
+
/**
|
|
113
|
+
* The crypto currency to be purchased.
|
|
114
|
+
*
|
|
115
|
+
* @example "USDC"
|
|
116
|
+
*/
|
|
117
|
+
purchaseCurrency: string;
|
|
118
|
+
/**
|
|
119
|
+
* The status of an onramp order.
|
|
120
|
+
*
|
|
121
|
+
* @example "ONRAMP_ORDER_STATUS_COMPLETED"
|
|
122
|
+
*/
|
|
123
|
+
status: CoinbaseOnrampOrderStatus;
|
|
124
|
+
/**
|
|
125
|
+
* The transaction hash of the order (only available once crypto has been sent).
|
|
126
|
+
*
|
|
127
|
+
* @example "0x363cd3b3d4f49497cf5076150cd709307b90e9fc897fdd623546ea7b9313cecb"
|
|
128
|
+
*/
|
|
129
|
+
txHash?: string;
|
|
130
|
+
/**
|
|
131
|
+
* The date and time the order was last updated.
|
|
132
|
+
*
|
|
133
|
+
* @example "2025-04-24T00:00:00Z"
|
|
134
|
+
*/
|
|
135
|
+
updatedAt: Date;
|
|
136
|
+
};
|
|
137
|
+
paymentLink?: {
|
|
138
|
+
/**
|
|
139
|
+
* The type of payment link.
|
|
140
|
+
*
|
|
141
|
+
* @example "PAYMENT_LINK_TYPE_APPLE_PAY"
|
|
142
|
+
*/
|
|
143
|
+
paymentLinkType: CoinbaseOnrampOrderPaymentLinkType;
|
|
144
|
+
/**
|
|
145
|
+
* The URL to the hosted widget the user should be redirected to.
|
|
146
|
+
* For certain payment link types you can append your own redirect_url query parameter
|
|
147
|
+
* to this URL to ensure the user is redirected back to your app after the widget completes.
|
|
148
|
+
*
|
|
149
|
+
* @example "https://pay.coinbase.com/1234567890"
|
|
150
|
+
*/
|
|
151
|
+
url: string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
export type CoinbaseCreateOnrampOrderRequest = {
|
|
155
|
+
/**
|
|
156
|
+
* The timestamp of when the user acknowledged that by using Coinbase Onramp they are accepting the
|
|
157
|
+
* Coinbase Terms (https://www.coinbase.com/legal/guest-checkout/us), User Agreement (https://www.coinbase.com/legal/user_agreement),
|
|
158
|
+
* and Privacy Policy (https://www.coinbase.com/legal/privacy).
|
|
159
|
+
*
|
|
160
|
+
* @example "2025-04-24T00:00:00Z"
|
|
161
|
+
*/
|
|
162
|
+
agreementAcceptedAt: Date;
|
|
163
|
+
/**
|
|
164
|
+
* The address the purchased crypto will be sent to.
|
|
165
|
+
*
|
|
166
|
+
* @example "0x71C7656EC7ab88b098defB751B7401B5f6d8976F"
|
|
167
|
+
*/
|
|
168
|
+
destinationAddress: string;
|
|
169
|
+
/**
|
|
170
|
+
* The name of the crypto network the purchased currency will be sent on.
|
|
171
|
+
* Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-buy-options)
|
|
172
|
+
* to discover the supported networks for your user's location.
|
|
173
|
+
*
|
|
174
|
+
* @example "base"
|
|
175
|
+
*/
|
|
176
|
+
destinationNetwork: string;
|
|
177
|
+
/**
|
|
178
|
+
* The domain that the Apple Pay button will be rendered on.
|
|
179
|
+
* Required when embedding the payment link in an iframe.
|
|
180
|
+
*
|
|
181
|
+
* @example "pay.coinbase.com"
|
|
182
|
+
*/
|
|
183
|
+
domain?: string;
|
|
184
|
+
/**
|
|
185
|
+
* If true, this API will return a quote without creating any transaction.
|
|
186
|
+
*
|
|
187
|
+
* @default false
|
|
188
|
+
*/
|
|
189
|
+
isQuote?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Whether to create a sandbox order for testing.
|
|
192
|
+
*
|
|
193
|
+
* This value will be ignored if you provide a partnerUserRef parameter.
|
|
194
|
+
*
|
|
195
|
+
* @default false
|
|
196
|
+
*/
|
|
197
|
+
isSandbox?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* A unique string that represents the user in your app.
|
|
200
|
+
* This can be used to link individual transactions together so you can retrieve the transaction history for your users.
|
|
201
|
+
* Prefix this string with “sandbox-” (e.g. "sandbox-user-1234") to perform a sandbox transaction which will allow you to
|
|
202
|
+
* test your integration without any real transfer of funds.
|
|
203
|
+
*
|
|
204
|
+
* If you do not provide a partnerUserRef, the order will be created with the user's Dynamic user ID, and the order will be created in sandbox mode
|
|
205
|
+
* depending on the value of the isSandbox parameter.
|
|
206
|
+
*
|
|
207
|
+
* @example "user-1234"
|
|
208
|
+
*/
|
|
209
|
+
partnerUserRef?: string;
|
|
210
|
+
/**
|
|
211
|
+
* A string representing the amount of fiat the user wishes to pay in exchange for crypto.
|
|
212
|
+
* When using this parameter, the returned quote will be inclusive of fees i.e. the user will pay this exact amount of the payment currency.
|
|
213
|
+
*
|
|
214
|
+
* @example "100.00"
|
|
215
|
+
*/
|
|
216
|
+
paymentAmount?: string;
|
|
217
|
+
/**
|
|
218
|
+
* The fiat currency to be converted to crypto.
|
|
219
|
+
*
|
|
220
|
+
* @example "USD"
|
|
221
|
+
*/
|
|
222
|
+
paymentCurrency: string;
|
|
223
|
+
/**
|
|
224
|
+
* The type of payment method to be used to complete an onramp order.
|
|
225
|
+
*
|
|
226
|
+
* @example "GUEST_CHECKOUT_APPLE_PAY"
|
|
227
|
+
*/
|
|
228
|
+
paymentMethod: CoinbaseOnrampOrderPaymentMethod;
|
|
229
|
+
/**
|
|
230
|
+
* A string representing the amount of crypto the user wishes to purchase.
|
|
231
|
+
* When using this parameter the returned quote will be exclusive of fees i.e. the user will receive this exact amount of the purchase currency.
|
|
232
|
+
*
|
|
233
|
+
* @example "10.000000"
|
|
234
|
+
*/
|
|
235
|
+
purchaseAmount?: string;
|
|
236
|
+
/**
|
|
237
|
+
* The ticker (e.g. BTC, USDC, SOL) or the Coinbase UUID (e.g. d85dce9b-5b73-5c3c-8978-522ce1d1c1b4) of the crypto asset to be purchased.
|
|
238
|
+
*
|
|
239
|
+
* Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-buy-options) to discover the
|
|
240
|
+
* supported purchase currencies for your user's location.
|
|
241
|
+
*
|
|
242
|
+
* @example "USDC"
|
|
243
|
+
*/
|
|
244
|
+
purchaseCurrency: string;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* The error code for a missing verification for a Coinbase onramp order.
|
|
248
|
+
*
|
|
249
|
+
* - "MISSING_INFORMATION": The data still needs to be collected from the user.
|
|
250
|
+
* - "MISSING_VERIFICATION": The data has been collected from the user but it has not been verified.
|
|
251
|
+
* - "VERIFICATION_EXPIRED": The data has been collected from the user and has been verified in the past,
|
|
252
|
+
* but needs to be verified again.
|
|
253
|
+
*/
|
|
254
|
+
export type CoinbaseOnrampMissingVerificationErrorCode = 'MISSING_INFORMATION' | 'MISSING_VERIFICATION' | 'VERIFICATION_EXPIRED';
|
|
255
|
+
export type FieldMissingVerificationForCoinbaseOnramp = {
|
|
256
|
+
field: Extract<keyof UserFields, 'email' | 'phoneNumber'>;
|
|
257
|
+
} & ({
|
|
258
|
+
errorCode: 'MISSING_INFORMATION';
|
|
259
|
+
} | {
|
|
260
|
+
/**
|
|
261
|
+
* The data that is missing verification.
|
|
262
|
+
*
|
|
263
|
+
* @example "test@test.com"
|
|
264
|
+
*/
|
|
265
|
+
data: string;
|
|
266
|
+
errorCode: Exclude<CoinbaseOnrampMissingVerificationErrorCode, 'MISSING_INFORMATION'>;
|
|
267
|
+
});
|
|
268
|
+
//# sourceMappingURL=coinbase.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coinbase.types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/funding/coinbase/coinbase.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,IAAI,yBAAyB,EAClD,kCAAkC,IAAI,sCAAsC,EAC5E,gCAAgC,IAAI,oCAAoC,EACxE,yBAAyB,IAAI,6BAA6B,EAC1D,UAAU,EACX,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,qBAAqB,GAAG,GAAG,yBAAyB,EAAE,CAAC;AAEnE,MAAM,MAAM,kCAAkC,GAC5C,GAAG,sCAAsC,EAAE,CAAC;AAE9C,MAAM,MAAM,gCAAgC,GAC1C,GAAG,oCAAoC,EAAE,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gCAAgC,GAAG;IAC7C;;;;;;OAMG;IACH,mBAAmB,EAAE,IAAI,CAAC;IAC1B;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;;;OAMG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,aAAa,EAAE,gCAAgC,CAAC;IAChD;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;OAOG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,0CAA0C,GAClD,qBAAqB,GACrB,sBAAsB,GACtB,sBAAsB,CAAC;AAE3B,MAAM,MAAM,yCAAyC,GAAG;IACtD,KAAK,EAAE,OAAO,CAAC,MAAM,UAAU,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC;CAC3D,GAAG,CACA;IACE,SAAS,EAAE,qBAAqB,CAAC;CAClC,GACD;IACE;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAChB,0CAA0C,EAC1C,qBAAqB,CACtB,CAAC;CACH,CACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CoinbaseCreateOnrampOrderRequest, CoinbaseOnrampOrderResponse } from '../coinbase.types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Coinbase onramp order
|
|
4
|
+
*
|
|
5
|
+
* @param orderParams CoinbaseCreateOnrampOrderRequest - The parameters for the onramp order.
|
|
6
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7
|
+
* @returns The created order
|
|
8
|
+
* @throws {MissingUserVerificationError} If the user is missing verification for email or phone
|
|
9
|
+
*/
|
|
10
|
+
export declare const createCoinbaseOnrampOrder: (orderParams: CoinbaseCreateOnrampOrderRequest, client?: import("../../../../exports").DynamicClient) => Promise<CoinbaseOnrampOrderResponse>;
|
|
11
|
+
//# sourceMappingURL=createCoinbaseOnrampOrder.d.ts.map
|
package/src/modules/funding/coinbase/createCoinbaseOnrampOrder/createCoinbaseOnrampOrder.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCoinbaseOnrampOrder.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/funding/coinbase/createCoinbaseOnrampOrder/createCoinbaseOnrampOrder.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,gCAAgC,EAChC,2BAA2B,EAC5B,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,gBACvB,gCAAgC,2DAE5C,OAAO,CAAC,2BAA2B,CAiCrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/funding/coinbase/createCoinbaseOnrampOrder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CoinbaseOnrampOrderPaymentMethod, FieldMissingVerificationForCoinbaseOnramp } from '../coinbase.types';
|
|
2
|
+
type GetMissingVerificationForCoinbaseOnrampOrderResponse = FieldMissingVerificationForCoinbaseOnramp[];
|
|
3
|
+
type GetMissingVerificationForCoinbaseOnrampOrderParams = {
|
|
4
|
+
paymentMethod: CoinbaseOnrampOrderPaymentMethod;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* This function is used to get a list of fields that are missing verification for a Coinbase onramp order
|
|
8
|
+
*
|
|
9
|
+
* - If the user is missing information for an email or phone number, the field will be returned with the error code MISSING_INFORMATION
|
|
10
|
+
* - If the user is missing verification for an email or phone number, the field will be returned with the error code MISSING_VERIFICATION
|
|
11
|
+
* and the existing unverified email or phone number will be included in the data field.
|
|
12
|
+
* - If the user's phone number has not been verified in the last 60 days, the field will be returned with the error code VERIFICATION_EXPIRED
|
|
13
|
+
* and the existing phone number will be included in the data field.
|
|
14
|
+
*
|
|
15
|
+
* @param params.paymentMethod - The payment method that will be used to create the onramp order
|
|
16
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
17
|
+
* @returns FieldMissingVerificationForCoinbaseOnramp[] - An array of fields that are missing verification for a Coinbase onramp order
|
|
18
|
+
* @throws {InvalidParamError} - If the payment method is not valid
|
|
19
|
+
* @throws {ValueMustBeDefinedError} - If the user is not authenticated
|
|
20
|
+
*/
|
|
21
|
+
export declare const getMissingVerificationForCoinbaseOnrampOrder: ({ paymentMethod }: GetMissingVerificationForCoinbaseOnrampOrderParams, client?: import("../../../../exports").DynamicClient) => GetMissingVerificationForCoinbaseOnrampOrderResponse;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=getMissingVerificationForCoinbaseOnrampOrder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMissingVerificationForCoinbaseOnrampOrder.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder/getMissingVerificationForCoinbaseOnrampOrder.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,gCAAgC,EAChC,yCAAyC,EAC1C,MAAM,mBAAmB,CAAC;AAE3B,KAAK,oDAAoD,GACvD,yCAAyC,EAAE,CAAC;AAE9C,KAAK,kDAAkD,GAAG;IACxD,aAAa,EAAE,gCAAgC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,4CAA4C,sBACpC,kDAAkD,2DAEpE,oDAmEF,CAAC"}
|
package/src/modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4CAA4C,EAAE,MAAM,gDAAgD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6CAA6C,EAAE,MAAM,iDAAiD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type SdkUser } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
import type { DynamicClient } from '../../../../../client/types/DynamicClient';
|
|
3
|
+
export declare const validateUserCredentialsForCoinbaseOnrampOrder: (client: DynamicClient) => SdkUser;
|
|
4
|
+
//# sourceMappingURL=validateUserCredentialsForCoinbaseOnrampOrder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateUserCredentialsForCoinbaseOnrampOrder.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/validateUserCredentialsForCoinbaseOnrampOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAK/E,eAAO,MAAM,6CAA6C,WAChD,aAAa,KACpB,OAoDF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrateStateWithStorage.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/storageSync/hydrateStateWithStorage/hydrateStateWithStorage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"hydrateStateWithStorage.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/storageSync/hydrateStateWithStorage/hydrateStateWithStorage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAK3D,eAAO,MAAM,uBAAuB,WAC1B,aAAa,KACpB,OAAO,CAAC,IAAI,CAsDd,CAAC"}
|