@crossmint/wallets-sdk 1.0.0-beta.2 → 1.0.0-beta.3
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/api/__tests__/constants.d.cts +5 -5
- package/dist/api/__tests__/constants.d.ts +5 -5
- package/dist/api/__tests__/test-utils.cjs +1 -1
- package/dist/api/__tests__/test-utils.d.cts +4 -4
- package/dist/api/__tests__/test-utils.d.ts +4 -4
- package/dist/api/__tests__/test-utils.js +1 -1
- package/dist/api/client.cjs +1 -1
- package/dist/api/client.d.cts +7 -7
- package/dist/api/client.d.ts +7 -7
- package/dist/api/client.js +1 -1
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.d.cts +4 -4
- package/dist/api/index.d.ts +4 -4
- package/dist/api/index.js +1 -1
- package/dist/api/types.d.cts +4 -4
- package/dist/api/types.d.ts +4 -4
- package/dist/chains/chains.cjs +1 -1
- package/dist/chains/chains.d.cts +2 -1
- package/dist/chains/chains.d.ts +2 -1
- package/dist/chains/chains.js +1 -1
- package/dist/chunk-24JKRXBH.js +1 -0
- package/dist/{chunk-F6PYIH4E.cjs → chunk-2C3AOHCT.cjs} +1 -1
- package/dist/{chunk-MCBBBEJT.js → chunk-2JW6HKFK.js} +1 -1
- package/dist/chunk-2RNAWXXS.js +1 -0
- package/dist/{chunk-RN77IYDQ.js → chunk-36OMUNL3.js} +1 -1
- package/dist/{chunk-S4O54O4C.cjs → chunk-3OGAQBMG.cjs} +1 -1
- package/dist/{chunk-D5YDWSO5.cjs → chunk-3VYGTPRF.cjs} +1 -1
- package/dist/{chunk-5YG5A77Q.js → chunk-4GTMI5ZT.js} +1 -1
- package/dist/{chunk-YQQWKSNT.cjs → chunk-4JWRQRKA.cjs} +1 -1
- package/dist/chunk-575WRSRN.js +1 -0
- package/dist/{chunk-BFIHTTMM.cjs → chunk-6EZCCLTK.cjs} +1 -1
- package/dist/chunk-6FGJ3ICD.js +1 -0
- package/dist/{chunk-R3EQXI46.js → chunk-6TYV7ADO.js} +1 -1
- package/dist/chunk-E7B6R3GF.cjs +1 -0
- package/dist/chunk-EXC7TCGL.js +1 -0
- package/dist/chunk-F2KLBYRR.cjs +1 -0
- package/dist/{chunk-U7QSF6P7.cjs → chunk-FOINTZC5.cjs} +1 -1
- package/dist/{chunk-IFD3BVMM.js → chunk-HMELCNK6.js} +1 -1
- package/dist/chunk-IOSADDL5.js +1 -0
- package/dist/chunk-JDDMCB6P.js +1 -0
- package/dist/{chunk-JLT4EA2Z.js → chunk-JDTKL2XR.js} +1 -1
- package/dist/{chunk-YLRD3ANZ.cjs → chunk-JJ72GFYU.cjs} +1 -1
- package/dist/chunk-K5TQ4QU3.cjs +1 -0
- package/dist/{chunk-3HLCTEWX.js → chunk-LEALJLNK.js} +1 -1
- package/dist/chunk-LZNQBJEK.cjs +1 -0
- package/dist/{chunk-S3DMYMEQ.js → chunk-MTK3HWXV.js} +1 -1
- package/dist/{chunk-HOWDLODW.cjs → chunk-O5D3H7CZ.cjs} +1 -1
- package/dist/{chunk-NF7KU2ML.cjs → chunk-QBS76CBT.cjs} +1 -1
- package/dist/{chunk-YFAJXQAM.cjs → chunk-QY5OHQW4.cjs} +1 -1
- package/dist/{chunk-NCXMTHC4.js → chunk-RBKG6QLZ.js} +1 -1
- package/dist/{chunk-SP2YD44M.js → chunk-RR6DWIRN.js} +1 -1
- package/dist/{chunk-67Z4SJMH.js → chunk-SMADCELI.js} +1 -1
- package/dist/chunk-T3U46LK3.cjs +1 -0
- package/dist/{chunk-TFMNBTFK.cjs → chunk-USL4YOIR.cjs} +1 -1
- package/dist/chunk-VA26VSUQ.cjs +1 -0
- package/dist/{chunk-JUKCHXJ6.cjs → chunk-VV6374MW.cjs} +1 -1
- package/dist/chunk-W6V7WGBL.js +1 -0
- package/dist/{chunk-WYMBO52A.js → chunk-W7LJS32A.js} +1 -1
- package/dist/{chunk-BW27ZG6O.cjs → chunk-WP4V3OCS.cjs} +1 -1
- package/dist/chunk-YIO5XXQ4.js +1 -0
- package/dist/{chunk-S5KDZFZ7.cjs → chunk-YPHM2V2G.cjs} +1 -1
- package/dist/chunk-ZIFTCPCX.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +1 -1
- package/dist/logger/index.cjs +1 -1
- package/dist/logger/index.js +1 -1
- package/dist/logger/init.cjs +1 -1
- package/dist/logger/init.js +1 -1
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.d.cts +6 -6
- package/dist/sdk.d.ts +6 -6
- package/dist/sdk.js +1 -1
- package/dist/signers/device.d.cts +5 -5
- package/dist/signers/device.d.ts +5 -5
- package/dist/signers/evm-api-key.d.cts +5 -5
- package/dist/signers/evm-api-key.d.ts +5 -5
- package/dist/signers/evm-external-wallet.d.cts +5 -5
- package/dist/signers/evm-external-wallet.d.ts +5 -5
- package/dist/signers/external-wallet-signer.d.cts +4 -4
- package/dist/signers/external-wallet-signer.d.ts +4 -4
- package/dist/signers/index.cjs +1 -1
- package/dist/signers/index.d.cts +4 -4
- package/dist/signers/index.d.ts +4 -4
- package/dist/signers/index.js +1 -1
- package/dist/signers/non-custodial/index.cjs +1 -1
- package/dist/signers/non-custodial/index.d.cts +5 -5
- package/dist/signers/non-custodial/index.d.ts +5 -5
- package/dist/signers/non-custodial/index.js +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.d.cts +5 -5
- package/dist/signers/non-custodial/ncs-evm-signer.d.ts +5 -5
- package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-signer.d.cts +5 -5
- package/dist/signers/non-custodial/ncs-signer.d.ts +5 -5
- package/dist/signers/non-custodial/ncs-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.d.cts +5 -5
- package/dist/signers/non-custodial/ncs-solana-signer.d.ts +5 -5
- package/dist/signers/non-custodial/ncs-solana-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +5 -5
- package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +5 -5
- package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
- package/dist/signers/passkey.d.cts +5 -5
- package/dist/signers/passkey.d.ts +5 -5
- package/dist/signers/server/assemble-server-signer.d.cts +4 -4
- package/dist/signers/server/assemble-server-signer.d.ts +4 -4
- package/dist/signers/server/evm-server-signer.d.cts +5 -5
- package/dist/signers/server/evm-server-signer.d.ts +5 -5
- package/dist/signers/server/helpers/derive-server-signer.d.cts +4 -4
- package/dist/signers/server/helpers/derive-server-signer.d.ts +4 -4
- package/dist/signers/server/helpers/index.d.cts +4 -4
- package/dist/signers/server/helpers/index.d.ts +4 -4
- package/dist/signers/server/index.d.cts +4 -4
- package/dist/signers/server/index.d.ts +4 -4
- package/dist/signers/server/solana-server-signer.d.cts +5 -5
- package/dist/signers/server/solana-server-signer.d.ts +5 -5
- package/dist/signers/server/stellar-server-signer.d.cts +5 -5
- package/dist/signers/server/stellar-server-signer.d.ts +5 -5
- package/dist/signers/solana-api-key.d.cts +5 -5
- package/dist/signers/solana-api-key.d.ts +5 -5
- package/dist/signers/solana-external-wallet.cjs +1 -1
- package/dist/signers/solana-external-wallet.d.cts +5 -5
- package/dist/signers/solana-external-wallet.d.ts +5 -5
- package/dist/signers/solana-external-wallet.js +1 -1
- package/dist/signers/stellar-external-wallet.d.cts +5 -5
- package/dist/signers/stellar-external-wallet.d.ts +5 -5
- package/dist/signers/types.d.cts +2 -2
- package/dist/signers/types.d.ts +2 -2
- package/dist/{types-BDRS_MOb.d.ts → types-BaHy48kd.d.ts} +196 -194
- package/dist/{types-D-xASbms.d.cts → types-Dz8JNP4U.d.cts} +196 -194
- package/dist/utils/constants.cjs +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/device-signers/DeviceSignerKeyStorage.cjs +1 -1
- package/dist/utils/device-signers/DeviceSignerKeyStorage.d.cts +6 -0
- package/dist/utils/device-signers/DeviceSignerKeyStorage.d.ts +6 -0
- package/dist/utils/device-signers/DeviceSignerKeyStorage.js +1 -1
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -1
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.d.cts +3 -0
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.d.ts +3 -0
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -1
- package/dist/utils/device-signers/createDeviceSigner.cjs +1 -1
- package/dist/utils/device-signers/createDeviceSigner.d.cts +7 -6
- package/dist/utils/device-signers/createDeviceSigner.d.ts +7 -6
- package/dist/utils/device-signers/createDeviceSigner.js +1 -1
- package/dist/utils/device-signers/index.cjs +1 -1
- package/dist/utils/device-signers/index.d.cts +5 -5
- package/dist/utils/device-signers/index.d.ts +5 -5
- package/dist/utils/device-signers/index.js +1 -1
- package/dist/utils/errors.cjs +1 -1
- package/dist/utils/errors.d.cts +11 -2
- package/dist/utils/errors.d.ts +11 -2
- package/dist/utils/errors.js +1 -1
- package/dist/utils/signer-locator.d.cts +4 -4
- package/dist/utils/signer-locator.d.ts +4 -4
- package/dist/utils/signer-mapping.d.cts +5 -5
- package/dist/utils/signer-mapping.d.ts +5 -5
- package/dist/utils/signer-validation.cjs +1 -1
- package/dist/utils/signer-validation.d.cts +6 -4
- package/dist/utils/signer-validation.d.ts +6 -4
- package/dist/utils/signer-validation.js +1 -1
- package/dist/wallets/__tests__/setup.cjs +1 -1
- package/dist/wallets/__tests__/setup.js +1 -1
- package/dist/wallets/__tests__/test-helpers.cjs +1 -1
- package/dist/wallets/__tests__/test-helpers.d.cts +4 -4
- package/dist/wallets/__tests__/test-helpers.d.ts +4 -4
- package/dist/wallets/__tests__/test-helpers.js +1 -1
- package/dist/wallets/evm.cjs +1 -1
- package/dist/wallets/evm.d.cts +5 -5
- package/dist/wallets/evm.d.ts +5 -5
- package/dist/wallets/evm.js +1 -1
- package/dist/wallets/solana.cjs +1 -1
- package/dist/wallets/solana.d.cts +4 -4
- package/dist/wallets/solana.d.ts +4 -4
- package/dist/wallets/solana.js +1 -1
- package/dist/wallets/stellar.cjs +1 -1
- package/dist/wallets/stellar.d.cts +4 -4
- package/dist/wallets/stellar.d.ts +4 -4
- package/dist/wallets/stellar.js +1 -1
- package/dist/wallets/types.d.cts +1 -1
- package/dist/wallets/types.d.ts +1 -1
- package/dist/wallets/wallet-factory.cjs +1 -1
- package/dist/wallets/wallet-factory.d.cts +4 -4
- package/dist/wallets/wallet-factory.d.ts +4 -4
- package/dist/wallets/wallet-factory.js +1 -1
- package/dist/wallets/wallet.cjs +1 -1
- package/dist/wallets/wallet.d.cts +47 -14
- package/dist/wallets/wallet.d.ts +47 -14
- package/dist/wallets/wallet.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-6OXELDPD.js +0 -1
- package/dist/chunk-BEW7JDW6.cjs +0 -1
- package/dist/chunk-GDRKG42L.cjs +0 -1
- package/dist/chunk-ISXH7QXG.cjs +0 -1
- package/dist/chunk-NKR3UAMA.cjs +0 -1
- package/dist/chunk-NPCKXKQ7.js +0 -1
- package/dist/chunk-O4FVTK7X.cjs +0 -1
- package/dist/chunk-P6MB5P2F.js +0 -1
- package/dist/chunk-PHXT77LR.js +0 -1
- package/dist/chunk-PSXRNSOE.js +0 -1
- package/dist/chunk-RLAW2ERD.js +0 -1
- package/dist/chunk-SPVAZXRY.js +0 -1
- package/dist/chunk-TYFWX53A.js +0 -1
- package/dist/chunk-WTVI4AL4.js +0 -1
- package/dist/chunk-ZACCKNGY.cjs +0 -1
- package/dist/chunk-ZKL4RO4I.cjs +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { U as WalletLocator } from '../../types-
|
|
2
|
-
import '@solana/web3.js';
|
|
3
|
-
import '@crossmint/client-sdk-window';
|
|
4
|
-
import '@crossmint/client-signers';
|
|
1
|
+
import { U as WalletLocator } from '../../types-Dz8JNP4U.cjs';
|
|
5
2
|
import 'viem';
|
|
6
|
-
import 'abitype';
|
|
7
3
|
import '../gen/types.gen.cjs';
|
|
8
4
|
import 'ox';
|
|
5
|
+
import '@crossmint/client-sdk-window';
|
|
6
|
+
import '@crossmint/client-signers';
|
|
9
7
|
import '@crossmint/common-sdk-base';
|
|
10
8
|
import '../../chains/chains.cjs';
|
|
9
|
+
import '@solana/web3.js';
|
|
10
|
+
import 'abitype';
|
|
11
11
|
import '../../utils/device-signers/DeviceSignerKeyStorage.cjs';
|
|
12
12
|
|
|
13
13
|
declare const HTTP_ERROR_STATUSES: readonly [{
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { U as WalletLocator } from '../../types-
|
|
2
|
-
import '@solana/web3.js';
|
|
3
|
-
import '@crossmint/client-sdk-window';
|
|
4
|
-
import '@crossmint/client-signers';
|
|
1
|
+
import { U as WalletLocator } from '../../types-BaHy48kd.js';
|
|
5
2
|
import 'viem';
|
|
6
|
-
import 'abitype';
|
|
7
3
|
import '../gen/types.gen.js';
|
|
8
4
|
import 'ox';
|
|
5
|
+
import '@crossmint/client-sdk-window';
|
|
6
|
+
import '@crossmint/client-signers';
|
|
9
7
|
import '@crossmint/common-sdk-base';
|
|
10
8
|
import '../../chains/chains.js';
|
|
9
|
+
import '@solana/web3.js';
|
|
10
|
+
import 'abitype';
|
|
11
11
|
import '../../utils/device-signers/DeviceSignerKeyStorage.js';
|
|
12
12
|
|
|
13
13
|
declare const HTTP_ERROR_STATUSES: readonly [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJ33QM2IDcjs = require('../../chunk-J33QM2ID.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJ33QM2IDcjs = require('../../chunk-J33QM2ID.cjs');var _chunkF2KLBYRRcjs = require('../../chunk-F2KLBYRR.cjs');require('../../chunk-T3U46LK3.cjs');require('../../chunk-3OGAQBMG.cjs');require('../../chunk-FOINTZC5.cjs');var _chunk2GKPWQBQcjs = require('../../chunk-2GKPWQBQ.cjs');var _vitest = require('vitest');var b=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:_vitest.vi.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j= exports.createMockSuccessResponse =e=>b({data:e}),P= exports.createMockErrorResponse =(e,t=400,n="Bad Request")=>b({data:e,status:t,ok:!1,statusText:n}),B= exports.createMockCrossmint =(e={})=>{let t=_chunk2GKPWQBQcjs.a.call(void 0, {apiKey:_chunkJ33QM2IDcjs.m},e);return _chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},t),{setJwt:_vitest.vi.fn().mockReturnThis()})},L= exports.createTestApiClient =e=>new (0, _chunkF2KLBYRRcjs.a)(e||B()),K= exports.createServerSideApiClient =()=>{let e=L();return Object.defineProperty(e,"isServerSide",{get:()=>!0,configurable:!0}),e},Y= exports.extractFetchCall =e=>{let t=e.mock.calls;if(t.length===0)return;let n=t[t.length-1];return{path:n[0],options:n[1]}},N= exports.expectRequestPath =(e,t)=>{_vitest.expect.call(void 0, e==null?void 0:e.path).toBe(t)},V= exports.expectCommonHeaders =e=>{_vitest.expect.call(void 0, e["Content-Type"]).toBe("application/json")},q= exports.expectRequestBody =(e,t)=>{_vitest.expect.call(void 0, e.body).toBe(JSON.stringify(t))},z= exports.validateRequest =(e,t,n)=>{_vitest.expect.call(void 0, e).toBeDefined(),e&&(N(e,t),e.options.headers&&V(e.options.headers),n!==void 0&&e.options&&q(e.options,n))},X= exports.testHttpErrorResponse =(e,t,n,s)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){t.mockResolvedValue(P(n,s));let a=yield e();_vitest.expect.call(void 0, u(a)).toBe(!0),u(a)&&(_vitest.expect.call(void 0, a.error).toBe(!0),n.message&&_vitest.expect.call(void 0, a.message).toBe(n.message))}),Z= exports.testCommonHttpErrors =(s,a,...o)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,[s,a,...o],function*(e,t,n=[]){for(let{status:c,message:g}of _chunkJ33QM2IDcjs.a){if(n.includes(c))continue;let l={error:!0,message:g};t.mockResolvedValueOnce(P(l,c));let m=yield e();_vitest.expect.call(void 0, u(m)).toBe(!0)}}),Q= exports.testNetworkError =(e,t)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){t.mockRejectedValue(new Error("Network error")),yield _vitest.expect.call(void 0, e()).rejects.toThrow("Network error")}),ee= exports.testInvalidJsonResponse =(e,t)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){let n={json:_vitest.vi.fn().mockRejectedValue(new Error("Invalid JSON")),ok:!0,status:200};t.mockResolvedValue(n),yield _vitest.expect.call(void 0, e()).rejects.toThrow()}),te= exports.testTimeoutError =(e,t)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){t.mockImplementation(()=>new Promise((n,s)=>setTimeout(()=>s(new Error("Request timeout")),0))),yield _vitest.expect.call(void 0, e()).rejects.toThrow("Request timeout")}),ne= exports.testMalformedResponse =(e,t,n)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){t.mockResolvedValue(j(n));let s=yield e();_vitest.expect.call(void 0, s).toEqual(n)}),se= exports.createMockWalletResponse =(e={})=>_chunk2GKPWQBQcjs.a.call(void 0, {address:_chunkJ33QM2IDcjs.b.evmAddress,chainType:"evm",type:"smart",config:{adminSigner:{type:"external-wallet",address:_chunkJ33QM2IDcjs.k.EVM_TEST}}},e),oe= exports.createMockSendResponse =(e={})=>_chunk2GKPWQBQcjs.a.call(void 0, {id:"txn-123",status:"pending",chainType:"evm",walletType:"evm-smart-wallet",params:{transaction:"0x1234567890abcdef",signer:"api-key:test"},onChain:{txId:"0xabcdef1234567890abcdef1234567890abcdef12",explorerLink:"https://explorer.example.com/tx/0xabcdef1234567890abcdef1234567890abcdef12"},createdAt:Date.now()},e);function u(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function h(e){return typeof e=="object"&&e!==null&&"address"in e&&"chainType"in e&&"type"in e}function $(e){return typeof e=="object"&&e!==null&&"id"in e&&"status"in e&&"chainType"in e}var x=e=>new Promise(t=>setTimeout(t,e)),re= exports.isValidEthereumAddress =e=>/^0x[a-fA-F0-9]{40}$/.test(e),ae= exports.isValidSolanaAddress =e=>/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e),ie= exports.createIntegrationApiClient =(e,t,n={})=>{let s=_chunk2GKPWQBQcjs.a.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {apiKey:e},t&&{overrideBaseUrl:t}),n),a=_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},s),{setJwt:()=>a});return new (0, _chunkF2KLBYRRcjs.a)(a)},v= exports.TestDataFactory =class{constructor(){this.wallets=[];this.transactions=[]}addWallet(t){t&&!this.wallets.includes(t)&&this.wallets.push(t)}addTransaction(t){t&&!this.transactions.includes(t)&&this.transactions.push(t)}getWallet(t=0){return this.wallets[t]}getTransaction(t=0){return this.transactions[t]}hasWallets(){return this.wallets.length>0}clear(){this.wallets=[],this.transactions=[]}};function ce(s,a){return _chunk2GKPWQBQcjs.g.call(void 0, this,arguments,function*(e,t,n={}){if(t.hasWallets())return t.getWallet();let{chainType:o="evm",type:c="mpc",owner:g,testName:l="default"}=n,m=g||`userId:integration-${l}-${Date.now()}`,f=yield e.createWallet(_chunk2GKPWQBQcjs.a.call(void 0, {chainType:o,type:c},g&&{owner:m}));if(h(f))return t.addWallet(f.address),f.address})}function pe(e,t,n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let s=yield e.createWallet(n);return h(s)&&t.addWallet(s.address),s})}function ue(e,t){_vitest.expect.call(void 0, u(e)).toBe(!0),t&&_vitest.expect.call(void 0, e.message).toBeDefined()}function le(e){_vitest.expect.call(void 0, h(e)).toBe(!0)}function de(e){_vitest.expect.call(void 0, $(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(u(c))throw new Error(`Failed to fund wallet: ${c.message||"Unknown error"}`);return yield x(_chunkJ33QM2IDcjs.i),c}),U= exports.approveTransaction =(a,o,c,...g)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,[a,o,c,...g],function*(e,t,n,s=_chunkJ33QM2IDcjs.l.APPROVE_TRANSACTION_MAX_RETRIES){var m;for(let f=0;f<s;f++){let d=yield e.getTransaction(t,n);if(u(d))throw new Error(`Transaction not found: ${d.message||"Unknown error"}`);if("status"in d&&(d.status==="success"||d.status==="failed"))return d;let T="approvals"in d?(m=d.approvals)==null?void 0:m.pending:void 0;if(T&&T.length>0){let O={approvals:T.map(_=>({signer:_.signer.locator,signature:""}))},C=yield e.approveTransaction(t,n,O);if(u(C))throw new Error(`Failed to approve transaction: ${C.message||"Unknown error"}`);yield x(_chunkJ33QM2IDcjs.j);continue}yield x(_chunkJ33QM2IDcjs.i)}let l=yield e.getTransaction(t,n);if(u(l))throw new Error(`Transaction not found after retries: ${l.message||"Unknown error"}`);if(!("status"in l))throw new Error("Transaction response missing status property");return l}),me= exports.fundWalletAndWait =(e,t,n=1,s="usdxm",a="base-sepolia")=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){return I(e,t,n,s,a)}),fe= exports.sendTokenAndApprove =(e,t,n,s,a)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){let o=yield e.send(t,n,{recipient:s,amount:a});if(u(o))throw new Error(`Failed to send token: ${o.message||"Unknown error"}`);if(typeof o=="object"&&o!==null&&"id"in o&&typeof o.id=="string")return U(e,t,o.id);throw new Error("Transaction ID not found in send response")}),ge= exports.ensureWalletFunded =(e,t,n=1,s="usdxm",a="base-sepolia")=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){try{yield I(e,t,n,s,a)}catch(o){let c=o instanceof Error?o.message:String(o);if(!c.includes("already funded")&&!c.includes("insufficient"))throw o}});exports.TestDataFactory = v; exports.approveTransaction = U; exports.createIntegrationApiClient = ie; exports.createMockCrossmint = B; exports.createMockErrorResponse = P; exports.createMockResponse = b; exports.createMockSendResponse = oe; exports.createMockSuccessResponse = j; exports.createMockWalletResponse = se; exports.createServerSideApiClient = K; exports.createTestApiClient = L; exports.createTestWallet = pe; exports.delay = x; exports.ensureWalletExists = ce; exports.ensureWalletFunded = ge; exports.expectCommonHeaders = V; exports.expectErrorResponse = ue; exports.expectRequestBody = q; exports.expectRequestPath = N; exports.expectSuccessTransactionResponse = de; exports.expectSuccessWalletResponse = le; exports.extractFetchCall = Y; exports.fundWallet = I; exports.fundWalletAndWait = me; exports.isErrorResponse = u; exports.isSuccessTransactionResponse = $; exports.isSuccessWalletResponse = h; exports.isValidEthereumAddress = re; exports.isValidSolanaAddress = ae; exports.sendTokenAndApprove = fe; exports.testCommonHttpErrors = Z; exports.testHttpErrorResponse = X; exports.testInvalidJsonResponse = ee; exports.testMalformedResponse = ne; exports.testNetworkError = Q; exports.testTimeoutError = te; exports.validateRequest = z;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { MockedFunction } from 'vitest';
|
|
2
2
|
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
3
3
|
import { ApiClient } from '../client.cjs';
|
|
4
|
-
import { a5 as CreateWalletResponse, a6 as SendResponse, a7 as CreateWalletParams, U as WalletLocator, V as FundWalletResponse, a8 as GetTransactionResponse } from '../../types-
|
|
4
|
+
import { a5 as CreateWalletResponse, a6 as SendResponse, a7 as CreateWalletParams, U as WalletLocator, V as FundWalletResponse, a8 as GetTransactionResponse } from '../../types-Dz8JNP4U.cjs';
|
|
5
5
|
import '../../chains/chains.cjs';
|
|
6
6
|
import 'viem';
|
|
7
|
-
import '
|
|
7
|
+
import '../gen/types.gen.cjs';
|
|
8
|
+
import 'ox';
|
|
8
9
|
import '@crossmint/client-sdk-window';
|
|
9
10
|
import '@crossmint/client-signers';
|
|
11
|
+
import '@solana/web3.js';
|
|
10
12
|
import 'abitype';
|
|
11
|
-
import '../gen/types.gen.cjs';
|
|
12
|
-
import 'ox';
|
|
13
13
|
import '../../utils/device-signers/DeviceSignerKeyStorage.cjs';
|
|
14
14
|
|
|
15
15
|
type MockResponseOptions<T> = {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { MockedFunction } from 'vitest';
|
|
2
2
|
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
3
3
|
import { ApiClient } from '../client.js';
|
|
4
|
-
import { a5 as CreateWalletResponse, a6 as SendResponse, a7 as CreateWalletParams, U as WalletLocator, V as FundWalletResponse, a8 as GetTransactionResponse } from '../../types-
|
|
4
|
+
import { a5 as CreateWalletResponse, a6 as SendResponse, a7 as CreateWalletParams, U as WalletLocator, V as FundWalletResponse, a8 as GetTransactionResponse } from '../../types-BaHy48kd.js';
|
|
5
5
|
import '../../chains/chains.js';
|
|
6
6
|
import 'viem';
|
|
7
|
-
import '
|
|
7
|
+
import '../gen/types.gen.js';
|
|
8
|
+
import 'ox';
|
|
8
9
|
import '@crossmint/client-sdk-window';
|
|
9
10
|
import '@crossmint/client-signers';
|
|
11
|
+
import '@solana/web3.js';
|
|
10
12
|
import 'abitype';
|
|
11
|
-
import '../gen/types.gen.js';
|
|
12
|
-
import 'ox';
|
|
13
13
|
import '../../utils/device-signers/DeviceSignerKeyStorage.js';
|
|
14
14
|
|
|
15
15
|
type MockResponseOptions<T> = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as A,b as F,i as R,j as E,k as M,l as W,m as S}from"../../chunk-DIGDDKSF.js";import{a as w}from"../../chunk-
|
|
1
|
+
import{a as A,b as F,i as R,j as E,k as M,l as W,m as S}from"../../chunk-DIGDDKSF.js";import{a as w}from"../../chunk-RBKG6QLZ.js";import"../../chunk-EXC7TCGL.js";import"../../chunk-6TYV7ADO.js";import"../../chunk-W6V7WGBL.js";import{a as p,b as k,g as i}from"../../chunk-J3R36SGJ.js";import{expect as r,vi as y}from"vitest";var b=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:y.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j=e=>b({data:e}),P=(e,t=400,n="Bad Request")=>b({data:e,status:t,ok:!1,statusText:n}),B=(e={})=>{let t=p({apiKey:S},e);return k(p({},t),{setJwt:y.fn().mockReturnThis()})},L=e=>new w(e||B()),Y=()=>{let e=L();return Object.defineProperty(e,"isServerSide",{get:()=>!0,configurable:!0}),e},z=e=>{let t=e.mock.calls;if(t.length===0)return;let n=t[t.length-1];return{path:n[0],options:n[1]}},N=(e,t)=>{r(e==null?void 0:e.path).toBe(t)},V=e=>{r(e["Content-Type"]).toBe("application/json")},q=(e,t)=>{r(e.body).toBe(JSON.stringify(t))},X=(e,t,n)=>{r(e).toBeDefined(),e&&(N(e,t),e.options.headers&&V(e.options.headers),n!==void 0&&e.options&&q(e.options,n))},Z=(e,t,n,s)=>i(void 0,null,function*(){t.mockResolvedValue(P(n,s));let a=yield e();r(u(a)).toBe(!0),u(a)&&(r(a.error).toBe(!0),n.message&&r(a.message).toBe(n.message))}),Q=(s,a,...o)=>i(void 0,[s,a,...o],function*(e,t,n=[]){for(let{status:c,message:g}of A){if(n.includes(c))continue;let l={error:!0,message:g};t.mockResolvedValueOnce(P(l,c));let m=yield e();r(u(m)).toBe(!0)}}),ee=(e,t)=>i(void 0,null,function*(){t.mockRejectedValue(new Error("Network error")),yield r(e()).rejects.toThrow("Network error")}),te=(e,t)=>i(void 0,null,function*(){let n={json:y.fn().mockRejectedValue(new Error("Invalid JSON")),ok:!0,status:200};t.mockResolvedValue(n),yield r(e()).rejects.toThrow()}),ne=(e,t)=>i(void 0,null,function*(){t.mockImplementation(()=>new Promise((n,s)=>setTimeout(()=>s(new Error("Request timeout")),0))),yield r(e()).rejects.toThrow("Request timeout")}),se=(e,t,n)=>i(void 0,null,function*(){t.mockResolvedValue(j(n));let s=yield e();r(s).toEqual(n)}),oe=(e={})=>p({address:F.evmAddress,chainType:"evm",type:"smart",config:{adminSigner:{type:"external-wallet",address:M.EVM_TEST}}},e),re=(e={})=>p({id:"txn-123",status:"pending",chainType:"evm",walletType:"evm-smart-wallet",params:{transaction:"0x1234567890abcdef",signer:"api-key:test"},onChain:{txId:"0xabcdef1234567890abcdef1234567890abcdef12",explorerLink:"https://explorer.example.com/tx/0xabcdef1234567890abcdef1234567890abcdef12"},createdAt:Date.now()},e);function u(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function h(e){return typeof e=="object"&&e!==null&&"address"in e&&"chainType"in e&&"type"in e}function $(e){return typeof e=="object"&&e!==null&&"id"in e&&"status"in e&&"chainType"in e}var x=e=>new Promise(t=>setTimeout(t,e)),ae=e=>/^0x[a-fA-F0-9]{40}$/.test(e),ie=e=>/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e),ce=(e,t,n={})=>{let s=p(p({apiKey:e},t&&{overrideBaseUrl:t}),n),a=k(p({},s),{setJwt:()=>a});return new w(a)},v=class{constructor(){this.wallets=[];this.transactions=[]}addWallet(t){t&&!this.wallets.includes(t)&&this.wallets.push(t)}addTransaction(t){t&&!this.transactions.includes(t)&&this.transactions.push(t)}getWallet(t=0){return this.wallets[t]}getTransaction(t=0){return this.transactions[t]}hasWallets(){return this.wallets.length>0}clear(){this.wallets=[],this.transactions=[]}};function pe(s,a){return i(this,arguments,function*(e,t,n={}){if(t.hasWallets())return t.getWallet();let{chainType:o="evm",type:c="mpc",owner:g,testName:l="default"}=n,m=g||`userId:integration-${l}-${Date.now()}`,f=yield e.createWallet(p({chainType:o,type:c},g&&{owner:m}));if(h(f))return t.addWallet(f.address),f.address})}function ue(e,t,n){return i(this,null,function*(){let s=yield e.createWallet(n);return h(s)&&t.addWallet(s.address),s})}function le(e,t){r(u(e)).toBe(!0),t&&r(e.message).toBeDefined()}function de(e){r(h(e)).toBe(!0)}function me(e){r($(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(u(c))throw new Error(`Failed to fund wallet: ${c.message||"Unknown error"}`);return yield x(R),c}),U=(a,o,c,...g)=>i(void 0,[a,o,c,...g],function*(e,t,n,s=W.APPROVE_TRANSACTION_MAX_RETRIES){var m;for(let f=0;f<s;f++){let d=yield e.getTransaction(t,n);if(u(d))throw new Error(`Transaction not found: ${d.message||"Unknown error"}`);if("status"in d&&(d.status==="success"||d.status==="failed"))return d;let T="approvals"in d?(m=d.approvals)==null?void 0:m.pending:void 0;if(T&&T.length>0){let O={approvals:T.map(_=>({signer:_.signer.locator,signature:""}))},C=yield e.approveTransaction(t,n,O);if(u(C))throw new Error(`Failed to approve transaction: ${C.message||"Unknown error"}`);yield x(E);continue}yield x(R)}let l=yield e.getTransaction(t,n);if(u(l))throw new Error(`Transaction not found after retries: ${l.message||"Unknown error"}`);if(!("status"in l))throw new Error("Transaction response missing status property");return l}),fe=(e,t,n=1,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){return I(e,t,n,s,a)}),ge=(e,t,n,s,a)=>i(void 0,null,function*(){let o=yield e.send(t,n,{recipient:s,amount:a});if(u(o))throw new Error(`Failed to send token: ${o.message||"Unknown error"}`);if(typeof o=="object"&&o!==null&&"id"in o&&typeof o.id=="string")return U(e,t,o.id);throw new Error("Transaction ID not found in send response")}),Te=(e,t,n=1,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){try{yield I(e,t,n,s,a)}catch(o){let c=o instanceof Error?o.message:String(o);if(!c.includes("already funded")&&!c.includes("insufficient"))throw o}});export{v as TestDataFactory,U as approveTransaction,ce as createIntegrationApiClient,B as createMockCrossmint,P as createMockErrorResponse,b as createMockResponse,re as createMockSendResponse,j as createMockSuccessResponse,oe as createMockWalletResponse,Y as createServerSideApiClient,L as createTestApiClient,ue as createTestWallet,x as delay,pe as ensureWalletExists,Te as ensureWalletFunded,V as expectCommonHeaders,le as expectErrorResponse,q as expectRequestBody,N as expectRequestPath,me as expectSuccessTransactionResponse,de as expectSuccessWalletResponse,z as extractFetchCall,I as fundWallet,fe as fundWalletAndWait,u as isErrorResponse,$ as isSuccessTransactionResponse,h as isSuccessWalletResponse,ae as isValidEthereumAddress,ie as isValidSolanaAddress,ge as sendTokenAndApprove,Q as testCommonHttpErrors,Z as testHttpErrorResponse,te as testInvalidJsonResponse,se as testMalformedResponse,ee as testNetworkError,ne as testTimeoutError,X as validateRequest};
|
package/dist/api/client.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkF2KLBYRRcjs = require('../chunk-F2KLBYRR.cjs');require('../chunk-T3U46LK3.cjs');require('../chunk-3OGAQBMG.cjs');require('../chunk-FOINTZC5.cjs');require('../chunk-2GKPWQBQ.cjs');exports.ApiClient = _chunkF2KLBYRRcjs.a;
|
package/dist/api/client.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { CrossmintApiClient, Crossmint, APIKeyEnvironmentPrefix } from '@crossmint/common-sdk-base';
|
|
2
|
-
import { a7 as CreateWalletParams, a5 as CreateWalletResponse, U as WalletLocator, ad as GetWalletResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, a8 as GetTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, al as GetSignatureResponse, X as GetTransactionsResponse, am as GetTransfersResponse, an as GetBalanceResponse, ao as FundWalletParams, V as FundWalletResponse, ap as RegisterSignerParams, aq as RegisterSignerResponse, ar as GetSignerResponse, as as SendParams, a6 as SendResponse } from '../types-
|
|
2
|
+
import { a7 as CreateWalletParams, a5 as CreateWalletResponse, U as WalletLocator, ad as GetWalletResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, a8 as GetTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, al as GetSignatureResponse, X as GetTransactionsResponse, am as GetTransfersResponse, an as GetBalanceResponse, ao as FundWalletParams, V as FundWalletResponse, ap as RegisterSignerParams, aq as RegisterSignerResponse, ar as GetSignerResponse, as as SendParams, a6 as SendResponse } from '../types-Dz8JNP4U.cjs';
|
|
3
3
|
import { Chain } from '../chains/chains.cjs';
|
|
4
|
-
import '@solana/web3.js';
|
|
5
|
-
import '@crossmint/client-sdk-window';
|
|
6
|
-
import '@crossmint/client-signers';
|
|
7
4
|
import 'viem';
|
|
8
|
-
import 'abitype';
|
|
9
5
|
import './gen/types.gen.cjs';
|
|
10
6
|
import 'ox';
|
|
7
|
+
import '@crossmint/client-sdk-window';
|
|
8
|
+
import '@crossmint/client-signers';
|
|
9
|
+
import '@solana/web3.js';
|
|
10
|
+
import 'abitype';
|
|
11
11
|
import '../utils/device-signers/DeviceSignerKeyStorage.cjs';
|
|
12
12
|
|
|
13
13
|
declare class ApiClient extends CrossmintApiClient {
|
|
@@ -31,8 +31,8 @@ declare class ApiClient extends CrossmintApiClient {
|
|
|
31
31
|
}): Promise<unknown>;
|
|
32
32
|
getTransfers(walletLocator: WalletLocator, params: {
|
|
33
33
|
chain: Chain;
|
|
34
|
-
tokens
|
|
35
|
-
status
|
|
34
|
+
tokens?: string;
|
|
35
|
+
status?: "successful" | "failed";
|
|
36
36
|
}): Promise<GetTransfersResponse>;
|
|
37
37
|
getBalance(walletLocator: WalletLocator, params: {
|
|
38
38
|
chains: Chain[];
|
package/dist/api/client.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { CrossmintApiClient, Crossmint, APIKeyEnvironmentPrefix } from '@crossmint/common-sdk-base';
|
|
2
|
-
import { a7 as CreateWalletParams, a5 as CreateWalletResponse, U as WalletLocator, ad as GetWalletResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, a8 as GetTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, al as GetSignatureResponse, X as GetTransactionsResponse, am as GetTransfersResponse, an as GetBalanceResponse, ao as FundWalletParams, V as FundWalletResponse, ap as RegisterSignerParams, aq as RegisterSignerResponse, ar as GetSignerResponse, as as SendParams, a6 as SendResponse } from '../types-
|
|
2
|
+
import { a7 as CreateWalletParams, a5 as CreateWalletResponse, U as WalletLocator, ad as GetWalletResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, a8 as GetTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, al as GetSignatureResponse, X as GetTransactionsResponse, am as GetTransfersResponse, an as GetBalanceResponse, ao as FundWalletParams, V as FundWalletResponse, ap as RegisterSignerParams, aq as RegisterSignerResponse, ar as GetSignerResponse, as as SendParams, a6 as SendResponse } from '../types-BaHy48kd.js';
|
|
3
3
|
import { Chain } from '../chains/chains.js';
|
|
4
|
-
import '@solana/web3.js';
|
|
5
|
-
import '@crossmint/client-sdk-window';
|
|
6
|
-
import '@crossmint/client-signers';
|
|
7
4
|
import 'viem';
|
|
8
|
-
import 'abitype';
|
|
9
5
|
import './gen/types.gen.js';
|
|
10
6
|
import 'ox';
|
|
7
|
+
import '@crossmint/client-sdk-window';
|
|
8
|
+
import '@crossmint/client-signers';
|
|
9
|
+
import '@solana/web3.js';
|
|
10
|
+
import 'abitype';
|
|
11
11
|
import '../utils/device-signers/DeviceSignerKeyStorage.js';
|
|
12
12
|
|
|
13
13
|
declare class ApiClient extends CrossmintApiClient {
|
|
@@ -31,8 +31,8 @@ declare class ApiClient extends CrossmintApiClient {
|
|
|
31
31
|
}): Promise<unknown>;
|
|
32
32
|
getTransfers(walletLocator: WalletLocator, params: {
|
|
33
33
|
chain: Chain;
|
|
34
|
-
tokens
|
|
35
|
-
status
|
|
34
|
+
tokens?: string;
|
|
35
|
+
status?: "successful" | "failed";
|
|
36
36
|
}): Promise<GetTransfersResponse>;
|
|
37
37
|
getBalance(walletLocator: WalletLocator, params: {
|
|
38
38
|
chains: Chain[];
|
package/dist/api/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-RBKG6QLZ.js";import"../chunk-EXC7TCGL.js";import"../chunk-6TYV7ADO.js";import"../chunk-W6V7WGBL.js";import"../chunk-J3R36SGJ.js";export{a as ApiClient};
|
package/dist/api/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunkF2KLBYRRcjs = require('../chunk-F2KLBYRR.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-T3U46LK3.cjs');require('../chunk-3OGAQBMG.cjs');require('../chunk-FOINTZC5.cjs');require('../chunk-2GKPWQBQ.cjs');exports.ApiClient = _chunkF2KLBYRRcjs.a;
|
package/dist/api/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { ApiClient } from './client.cjs';
|
|
2
|
-
export { au as AdminSignerConfig, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, K as DelegatedSigner, ao as FundWalletParams, V as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, ay as GetDelegatedSignersResponse, al as GetSignatureResponse, ar as GetSignerResponse, a8 as GetTransactionResponse, Y as GetTransactionSuccessResponse, X as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, T as Transfers, U as WalletLocator } from '../types-
|
|
2
|
+
export { au as AdminSignerConfig, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, K as DelegatedSigner, ao as FundWalletParams, V as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, ay as GetDelegatedSignersResponse, al as GetSignatureResponse, ar as GetSignerResponse, a8 as GetTransactionResponse, Y as GetTransactionSuccessResponse, X as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, T as Transfers, U as WalletLocator } from '../types-Dz8JNP4U.cjs';
|
|
3
3
|
import '@crossmint/common-sdk-base';
|
|
4
4
|
import '../chains/chains.cjs';
|
|
5
5
|
import 'viem';
|
|
6
|
-
import '
|
|
6
|
+
import './gen/types.gen.cjs';
|
|
7
|
+
import 'ox';
|
|
7
8
|
import '@crossmint/client-sdk-window';
|
|
8
9
|
import '@crossmint/client-signers';
|
|
10
|
+
import '@solana/web3.js';
|
|
9
11
|
import 'abitype';
|
|
10
|
-
import './gen/types.gen.cjs';
|
|
11
|
-
import 'ox';
|
|
12
12
|
import '../utils/device-signers/DeviceSignerKeyStorage.cjs';
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { ApiClient } from './client.js';
|
|
2
|
-
export { au as AdminSignerConfig, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, K as DelegatedSigner, ao as FundWalletParams, V as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, ay as GetDelegatedSignersResponse, al as GetSignatureResponse, ar as GetSignerResponse, a8 as GetTransactionResponse, Y as GetTransactionSuccessResponse, X as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, T as Transfers, U as WalletLocator } from '../types-
|
|
2
|
+
export { au as AdminSignerConfig, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, K as DelegatedSigner, ao as FundWalletParams, V as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, ay as GetDelegatedSignersResponse, al as GetSignatureResponse, ar as GetSignerResponse, a8 as GetTransactionResponse, Y as GetTransactionSuccessResponse, X as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, T as Transfers, U as WalletLocator } from '../types-BaHy48kd.js';
|
|
3
3
|
import '@crossmint/common-sdk-base';
|
|
4
4
|
import '../chains/chains.js';
|
|
5
5
|
import 'viem';
|
|
6
|
-
import '
|
|
6
|
+
import './gen/types.gen.js';
|
|
7
|
+
import 'ox';
|
|
7
8
|
import '@crossmint/client-sdk-window';
|
|
8
9
|
import '@crossmint/client-signers';
|
|
10
|
+
import '@solana/web3.js';
|
|
9
11
|
import 'abitype';
|
|
10
|
-
import './gen/types.gen.js';
|
|
11
|
-
import 'ox';
|
|
12
12
|
import '../utils/device-signers/DeviceSignerKeyStorage.js';
|
package/dist/api/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-
|
|
1
|
+
import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-RBKG6QLZ.js";import"../chunk-KBJA7JDT.js";import"../chunk-EXC7TCGL.js";import"../chunk-6TYV7ADO.js";import"../chunk-W6V7WGBL.js";import"../chunk-J3R36SGJ.js";export{a as ApiClient};
|
package/dist/api/types.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import 'viem';
|
|
2
2
|
import './gen/types.gen.cjs';
|
|
3
|
-
export { au as AdminSignerConfig, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, K as DelegatedSigner, ao as FundWalletParams, V as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, ay as GetDelegatedSignersResponse, al as GetSignatureResponse, ar as GetSignerResponse, a8 as GetTransactionResponse, Y as GetTransactionSuccessResponse, X as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, T as Transfers, U as WalletLocator } from '../types-
|
|
3
|
+
export { au as AdminSignerConfig, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, K as DelegatedSigner, ao as FundWalletParams, V as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, ay as GetDelegatedSignersResponse, al as GetSignatureResponse, ar as GetSignerResponse, a8 as GetTransactionResponse, Y as GetTransactionSuccessResponse, X as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, T as Transfers, U as WalletLocator } from '../types-Dz8JNP4U.cjs';
|
|
4
4
|
import '../chains/chains.cjs';
|
|
5
|
-
import '
|
|
5
|
+
import 'ox';
|
|
6
6
|
import '@crossmint/client-sdk-window';
|
|
7
7
|
import '@crossmint/client-signers';
|
|
8
|
-
import 'abitype';
|
|
9
|
-
import 'ox';
|
|
10
8
|
import '@crossmint/common-sdk-base';
|
|
9
|
+
import '@solana/web3.js';
|
|
10
|
+
import 'abitype';
|
|
11
11
|
import '../utils/device-signers/DeviceSignerKeyStorage.cjs';
|
package/dist/api/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import 'viem';
|
|
2
2
|
import './gen/types.gen.js';
|
|
3
|
-
export { au as AdminSignerConfig, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, K as DelegatedSigner, ao as FundWalletParams, V as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, ay as GetDelegatedSignersResponse, al as GetSignatureResponse, ar as GetSignerResponse, a8 as GetTransactionResponse, Y as GetTransactionSuccessResponse, X as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, T as Transfers, U as WalletLocator } from '../types-
|
|
3
|
+
export { au as AdminSignerConfig, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, K as DelegatedSigner, ao as FundWalletParams, V as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, ay as GetDelegatedSignersResponse, al as GetSignatureResponse, ar as GetSignerResponse, a8 as GetTransactionResponse, Y as GetTransactionSuccessResponse, X as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, T as Transfers, U as WalletLocator } from '../types-BaHy48kd.js';
|
|
4
4
|
import '../chains/chains.js';
|
|
5
|
-
import '
|
|
5
|
+
import 'ox';
|
|
6
6
|
import '@crossmint/client-sdk-window';
|
|
7
7
|
import '@crossmint/client-signers';
|
|
8
|
-
import 'abitype';
|
|
9
|
-
import 'ox';
|
|
10
8
|
import '@crossmint/common-sdk-base';
|
|
9
|
+
import '@solana/web3.js';
|
|
10
|
+
import 'abitype';
|
|
11
11
|
import '../utils/device-signers/DeviceSignerKeyStorage.js';
|
package/dist/chains/chains.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVV6374MWcjs = require('../chunk-VV6374MW.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-T3U46LK3.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-3OGAQBMG.cjs');require('../chunk-FOINTZC5.cjs');require('../chunk-2GKPWQBQ.cjs');exports.isMainnetChain = _chunkVV6374MWcjs.c; exports.isTestnetChain = _chunkVV6374MWcjs.b; exports.isValidChain = _chunkVV6374MWcjs.e; exports.mainnetToTestnet = _chunkVV6374MWcjs.d; exports.toViemChain = _chunkVV6374MWcjs.a; exports.validateChainForEnvironment = _chunkVV6374MWcjs.f;
|
package/dist/chains/chains.d.cts
CHANGED
|
@@ -23,6 +23,7 @@ declare function mainnetToTestnet(chain: EVMSmartWalletMainnet): EVMSmartWalletT
|
|
|
23
23
|
* @param environment - The API key environment prefix
|
|
24
24
|
* @returns The validated (and potentially converted) chain
|
|
25
25
|
*/
|
|
26
|
+
declare function isValidChain(chain: string): chain is Chain;
|
|
26
27
|
declare function validateChainForEnvironment<C extends Chain>(chain: C, environment: APIKeyEnvironmentPrefix): C;
|
|
27
28
|
|
|
28
|
-
export { type Chain, type EVMChain, type EVMSmartWalletChain, type EVMSmartWalletMainnet, type EVMSmartWalletTestnet, type SolanaChain, type StellarChain, isMainnetChain, isTestnetChain, mainnetToTestnet, toViemChain, validateChainForEnvironment };
|
|
29
|
+
export { type Chain, type EVMChain, type EVMSmartWalletChain, type EVMSmartWalletMainnet, type EVMSmartWalletTestnet, type SolanaChain, type StellarChain, isMainnetChain, isTestnetChain, isValidChain, mainnetToTestnet, toViemChain, validateChainForEnvironment };
|
package/dist/chains/chains.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ declare function mainnetToTestnet(chain: EVMSmartWalletMainnet): EVMSmartWalletT
|
|
|
23
23
|
* @param environment - The API key environment prefix
|
|
24
24
|
* @returns The validated (and potentially converted) chain
|
|
25
25
|
*/
|
|
26
|
+
declare function isValidChain(chain: string): chain is Chain;
|
|
26
27
|
declare function validateChainForEnvironment<C extends Chain>(chain: C, environment: APIKeyEnvironmentPrefix): C;
|
|
27
28
|
|
|
28
|
-
export { type Chain, type EVMChain, type EVMSmartWalletChain, type EVMSmartWalletMainnet, type EVMSmartWalletTestnet, type SolanaChain, type StellarChain, isMainnetChain, isTestnetChain, mainnetToTestnet, toViemChain, validateChainForEnvironment };
|
|
29
|
+
export { type Chain, type EVMChain, type EVMSmartWalletChain, type EVMSmartWalletMainnet, type EVMSmartWalletTestnet, type SolanaChain, type StellarChain, isMainnetChain, isTestnetChain, isValidChain, mainnetToTestnet, toViemChain, validateChainForEnvironment };
|
package/dist/chains/chains.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f}from"../chunk-JDDMCB6P.js";import"../chunk-KUP7H7X2.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-EXC7TCGL.js";import"../chunk-455NK5LB.js";import"../chunk-6TYV7ADO.js";import"../chunk-W6V7WGBL.js";import"../chunk-J3R36SGJ.js";export{c as isMainnetChain,b as isTestnetChain,e as isValidChain,d as mainnetToTestnet,a as toViemChain,f as validateChainForEnvironment};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as S,b as w}from"./chunk-YIO5XXQ4.js";import{a as x}from"./chunk-2RNAWXXS.js";import{a as b}from"./chunk-6FGJ3ICD.js";import{a as u}from"./chunk-GOXB2RBF.js";import{b as C}from"./chunk-PKYRYRX4.js";import{f as m}from"./chunk-JDDMCB6P.js";import{e as P,g as s}from"./chunk-EXC7TCGL.js";import{a as o}from"./chunk-6TYV7ADO.js";import{a as d,b as y,c as f,g as p}from"./chunk-J3R36SGJ.js";import{WithLoggerContext as R}from"@crossmint/common-sdk-base";import{WebAuthnP256 as $}from"ox";var D="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",h=class{constructor(t){this.apiClient=t}getWallet(t,e){return p(this,null,function*(){let a,n;if(typeof t=="string"){if(!this.apiClient.isServerSide)throw new s("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(e==null)throw new s("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");a=t,n=e}else{if(this.apiClient.isServerSide)throw new s("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");n=t,a=this.getWalletLocator(n)}let r=y(d({},n),{chain:m(n.chain,this.apiClient.environment)});o.info("walletFactory.getWallet.start");let i=yield this.apiClient.getWallet(a);if("error"in i)throw o.warn("walletFactory.getWallet.notFound",{error:i.error}),new P(JSON.stringify(i));return o.info("walletFactory.getWallet.success",{address:i.address}),yield this.createWalletInstance(i,r)})}createWallet(t){return p(this,null,function*(){var c,l,g,v,W,A,k,F;let e=y(d({},t),{chain:m(t.chain,this.apiClient.environment)});if(yield(g=(l=(c=e.options)==null?void 0:c.callbacks)==null?void 0:l.onWalletCreationStart)==null?void 0:g.call(l),o.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&e.owner!=null)throw o.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new s("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let a=((v=e.options)==null?void 0:v.deviceSignerKeyStorage)!=null?this.ensureDeviceSignerInSigners(e):(W=e.signers)!=null?W:[],n=yield this.registerSigners(a,e.chain,(A=e.options)==null?void 0:A.deviceSignerKeyStorage),r;if(e.recovery.type==="passkey"&&e.recovery.id==null)r=yield this.createPasskeySigner(e.recovery);else if(e.recovery.type==="server"){let{derivedAddress:E}=C(e.recovery,e.chain,this.apiClient.projectId,this.apiClient.environment);r={type:"server",address:E}}else r=e.recovery;let i=yield this.apiClient.createWallet({type:"smart",chainType:this.getChainType(e.chain),config:d(d({adminSigner:r},e.plugins?{plugins:e.plugins}:{}),n!=null?{delegatedSigners:n}:{}),owner:(k=e.owner)!=null?k:void 0,alias:(F=e.alias)!=null?F:void 0});if("error"in i)throw o.error("walletFactory.createWallet.error",{error:i.error}),new s(JSON.stringify(i));return o.info("walletFactory.createWallet.success",{address:i.address}),yield this.createWalletInstance(i,e)})}createWalletInstance(t,e){var a;return this.validateExistingWalletConfig(t,e),new x({chain:e.chain,address:t.address,owner:t.owner,options:e.options,alias:e.alias,recovery:t.config.adminSigner,signers:(a=t.config.delegatedSigners)!=null?a:[]},this.apiClient)}getWalletLocator(t){return`me:${this.getChainType(t.chain)}:smart`+(t.alias!=null?`:alias:${t.alias}`:"")}createPasskeySigner(t){return p(this,null,function*(){var n;if(t.type!=="passkey")throw new Error("Signer is not a passkey");let e=(n=t.name)!=null?n:`Crossmint Wallet ${Date.now()}`,a=t.onCreatePasskey?yield t.onCreatePasskey(e):yield $.createCredential({name:e});return{type:"passkey",id:a.id,name:e,publicKey:{x:a.publicKey.x.toString(),y:a.publicKey.y.toString()}}})}ensureDeviceSignerInSigners(t){var n,r;if(t.chain==="solana")return(n=t.signers)!=null?n:[];let e=(r=t.signers)!=null?r:[];return e.some(i=>i.type==="device")?e:[...e,{type:"device"}]}validateExistingWalletConfig(t,e){if(e.owner!=null&&t.owner!=null&&S(e.owner)!==S(t.owner))throw new s("Wallet owner does not match existing wallet's linked user");if(e.chain==="solana"&&t.chainType!=="solana"||e.chain!=="solana"&&t.chainType==="solana"||e.chain==="stellar"&&t.chainType!=="stellar"||e.chain!=="stellar"&&t.chainType==="stellar")throw new s(`Wallet chain does not match existing wallet's chain. You must use chain: ${t.chainType}.`);if(t.type!=="smart")return;let a=e;if(a.recovery!=null||a.signers!=null){let n=t.config,r=n==null?void 0:n.adminSigner;if(a.recovery!=null&&r!=null){if(a.recovery.type!==r.type)throw new s("The wallet recovery signer type does not match the existing wallet's recovery signer type");w(a.recovery,r)}let i=a.signers;i!=null&&this.validateSigners(t,i,e.chain)}}validateSigners(t,e,a){let n=t.config,r=n==null?void 0:n.delegatedSigners;if(e.length!==0){if(r==null||r.length===0)throw new s(`${e.length} signer(s) specified, but wallet "${t.address}" has no signers. ${D}`);for(let i of e){let c=r.find(l=>{if(this.isMatchingPasskeySigner(i,l,n)||l.type==="device"&&i.type==="device")return!0;if(i.type==="server"){let{derivedAddress:g}=C(i,a,this.apiClient.projectId,this.apiClient.environment);return l.locator===`server:${g}`}return l.locator===u(i)});if(c==null){let l=r.map(g=>g.locator).join(", ");throw new s(`Signer '${i.type}' does not exist in wallet "${t.address}". Available signers: ${l}. ${D}`)}w(i,c)}}}isMatchingPasskeySigner(t,e,a){var r,i;let n=((i=(r=a.delegatedSigners)==null?void 0:r.filter(c=>c.type==="passkey").length)!=null?i:0)+(a.adminSigner.type==="passkey"?1:0);if(t.type==="passkey"){if(t.id==null&&n===1)return e.type==="passkey";if(t.id==null&&n>1)throw new s("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(t,e,a){return p(this,null,function*(){var n;return yield Promise.all((n=t==null?void 0:t.map(r=>p(this,null,function*(){if(r.type==="passkey")return r.id==null?{signer:yield this.createPasskeySigner(r)}:{signer:r};if(r.type==="device"){if(r.publicKey!=null)return{signer:{type:"device",publicKey:r.publicKey,name:r.name}};if(r.locator!=null)return{signer:r.locator};if(a==null)throw new s("Device signer key storage is required for device signers");let i=yield b(a);return{signer:{type:"device",publicKey:i.publicKey,name:i.name}}}if(r.type==="server"&&e!=null){let{derivedAddress:i}=C(r,e,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${i}`}}return{signer:u(r)}})))!=null?n:[])})}getChainType(t){return t==="solana"?"solana":t==="stellar"?"stellar":"evm"}};f([R({logger:o,methodName:"walletFactory.getWallet",buildContext(t,e){return typeof e[0]=="string"?{walletLocator:e[0],args:e[1]}:{args:e[0]}}})],h.prototype,"getWallet",1),f([R({logger:o,methodName:"walletFactory.createWallet",buildContext(t,e){return{chain:e[0].chain}}})],h.prototype,"createWallet",1);export{h as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkQY5OHQW4cjs = require('./chunk-QY5OHQW4.cjs');var _chunk3OGAQBMGcjs = require('./chunk-3OGAQBMG.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var g=class c extends _chunkQY5OHQW4cjs.a{constructor(n){super(n)}signMessage(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var i;yield this.handleAuthRequired();let d=this.getJwtOrThrow(),m=_bs582.default.decode(n),y=_web3js.VersionedTransaction.deserialize(m).message.serialize();_chunk3OGAQBMGcjs.a.info("sign: sending request",{keyType:"ed25519"});let l=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:d,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:_bs582.default.encode(new Uint8Array(y)),encoding:"base58"}},options:_chunkQY5OHQW4cjs.b});if(_chunk3OGAQBMGcjs.a.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-l}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(e.publicKey),{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base58"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"base58"}}};exports.a = g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S}from"./chunk-G5R6VQGJ.js";import{a as i}from"./chunk-
|
|
1
|
+
import{a as S}from"./chunk-G5R6VQGJ.js";import{a as i}from"./chunk-36OMUNL3.js";import{a as t}from"./chunk-LEALJLNK.js";import{a as l}from"./chunk-SMADCELI.js";import{a as C}from"./chunk-EE4ITUGS.js";import{a as u}from"./chunk-LB4V5KKI.js";import{a as p}from"./chunk-SH7KRBXV.js";import{a as s}from"./chunk-XS5B3TUE.js";import{a as m}from"./chunk-EIHK5TYE.js";import{a as g}from"./chunk-WBIKVPHW.js";import{a as o}from"./chunk-W7LJS32A.js";import{g as a}from"./chunk-EXC7TCGL.js";function V(r,e,n){switch(e.type){case"email":case"phone":return r==="solana"?new t(e):r==="stellar"?new l(e):new i(e);case"api-key":return r==="solana"?new g(e):new p(e);case"external-wallet":return r==="solana"?new o(e):r==="stellar"?new C(e):new s(e);case"server":return S(r,e);case"passkey":return new m(e);case"device":if(n==null)throw new a("Device signer key storage is required for device signers");return new u(e,n)}}export{V as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ae}from"./chunk-6FGJ3ICD.js";import{a as R}from"./chunk-GOXB2RBF.js";import{b as G,c as M}from"./chunk-N5WVT7QE.js";import{a as F}from"./chunk-2JW6HKFK.js";import{b as O}from"./chunk-PKYRYRX4.js";import{a as ne}from"./chunk-RR6DWIRN.js";import{f as ie}from"./chunk-JDDMCB6P.js";import{B as te,d as j,e as _,j as J,n as U,q,r as V,s as z,t as Q,u as H,v as X,w as Y,x as Z,y as ee,z as re}from"./chunk-EXC7TCGL.js";import{a}from"./chunk-6TYV7ADO.js";import{d as B}from"./chunk-W6V7WGBL.js";import{a as b,b as A,c as P,d as n,e as k,f,g}from"./chunk-J3R36SGJ.js";import{isValidAddress as se,WithLoggerContext as x}from"@crossmint/common-sdk-base";var m,C,h,E,$,T,N,D,W,I=class{constructor(e,r){k(this,m);k(this,C);k(this,h);k(this,E);k(this,$);k(this,T,!1);k(this,N,!1);k(this,D);k(this,W,null);let{chain:t,address:i,owner:l,options:p,alias:d,recovery:s,signers:o,signer:c}=e;f(this,h,r),this.chain=t,this.address=i,this.owner=l,f(this,C,p),this.alias=d,f(this,E,s),f(this,$,o!=null?o:[]),f(this,m,c),f(this,D,this.initDefaultSigner())}get signer(){return n(this,m)}initDeviceSigner(){return g(this,null,function*(){var i;let e=(i=n(this,C))==null?void 0:i.deviceSignerKeyStorage;if(e==null||this.chain==="solana")return;let r={type:"device"};try{yield this.resolveDeviceSignerAvailability(r)}catch(l){a.error("wallet.initDeviceSigner.error",{error:l}),f(this,T,!0);return}let t=this.buildInternalSignerConfig(r);f(this,m,F(this.chain,t,e))})}initDefaultSigner(){return g(this,null,function*(){var r,t;if(n(this,m)!=null||(yield this.initDeviceSigner(),n(this,m)!=null||n(this,T)))return;let e=n(this,$).filter(i=>i.type!=="server"&&i.type!=="api-key");try{if(e.length===0){if(n(this,E).type!=="server"&&n(this,E).type!=="api-key"){let i=this.buildInternalSignerConfig(n(this,E));f(this,m,F(this.chain,i,(r=n(this,C))==null?void 0:r.deviceSignerKeyStorage))}}else if(e.length===1){let i=this.buildInternalSignerConfig(e[0]);f(this,m,F(this.chain,i,(t=n(this,C))==null?void 0:t.deviceSignerKeyStorage))}}catch(i){}})}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}static getRecovery(e){return n(e,E)}get apiClient(){return n(this,h)}get options(){return n(this,C)}get recovery(){return n(this,E)}balances(e){return g(this,null,function*(){a.info("wallet.balances.start");let r=this.resolveChainForEnvironment(),t;switch(this.chain){case"solana":t="sol";break;case"stellar":t="xlm";break;default:t="eth";break}let i=[t,"usdc",...e!=null?e:[]],l=yield n(this,h).getBalance(this.address,{chains:[r],tokens:i});if("error"in l)throw a.error("wallet.balances.error",{error:l}),new Error(`Failed to get balances for wallet: ${JSON.stringify(l.message)}`);return a.info("wallet.balances.success"),this.transformBalanceResponse(l,t,e)})}stagingFund(e,r){return g(this,null,function*(){a.info("wallet.stagingFund.start",{amount:e,chain:r!=null?r:this.chain});let t=yield this.apiClient.fundWallet(this.address,{amount:e,token:"usdxm",chain:r!=null?r:this.chain});if("error"in t)throw a.error("wallet.stagingFund.error",{error:t}),new Error(`Failed to fund wallet: ${JSON.stringify(t.message)}`);return a.info("wallet.stagingFund.success"),t})}transformBalanceResponse(e,r,t){let i=o=>{var w,S,u,L,K;let c=(w=o.chains)==null?void 0:w[this.chain],v={};return this.chain==="solana"&&c!=null&&"mintHash"in c?v={mintHash:c.mintHash}:this.chain==="stellar"&&c!=null&&"contractId"in c?v={contractId:c.contractId}:c!=null&&"contractAddress"in c&&(v={contractAddress:c.contractAddress}),b({symbol:(S=o.symbol)!=null?S:"",name:(u=o.name)!=null?u:"",amount:(L=o.amount)!=null?L:"0",decimals:o.decimals,rawAmount:(K=o.rawAmount)!=null?K:"0"},v)},l=e.find(o=>o.symbol===r),p=e.find(o=>o.symbol==="usdc"),d=e.filter(o=>{var c;return o.symbol!==r&&o.symbol!=="usdc"&&(t==null||t.includes((c=o.symbol)!=null?c:""))}),s=o=>{let c={symbol:o,name:o,amount:"0",decimals:0,rawAmount:"0"},v={};return this.chain==="solana"?v={mintHash:void 0}:this.chain==="stellar"?v={contractId:void 0}:v={contractAddress:void 0},b(b({},c),v)};return{nativeToken:l!=null?i(l):s(r),usdc:p!=null?i(p):s("usdc"),tokens:d.map(i)}}nfts(e){return g(this,null,function*(){return yield n(this,h).getNfts(A(b({},e),{chain:this.chain,address:this.address}))})}transactions(){return g(this,null,function*(){let e=yield n(this,h).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}transaction(e){return g(this,null,function*(){let r=yield n(this,h).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}transfers(e){return g(this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield this.apiClient.getTransfers(this.walletLocator,{chain:r,tokens:e==null?void 0:e.tokens,status:e==null?void 0:e.status});if("error"in t)throw new Error(`Failed to get transfers: ${JSON.stringify(t.message)}`);return t})}send(e,r,t,i){return g(this,null,function*(){let l=this.resolveChainForEnvironment(),p=ce(e),d=de(r,l),s=Number(t);if(Number.isNaN(s)||!Number.isFinite(s)||s<=0)throw new z(`Invalid transfer amount: "${t}". Amount must be a positive number greater than zero.`);a.info("wallet.send.start",b({recipient:p,token:d,amount:t},(i==null?void 0:i.transactionType)!=null?{transactionType:i.transactionType}:{})),yield this.preAuthIfNeeded();let o=this.requireSigner(),c;(i==null?void 0:i.signer)==null?c=o.locator():typeof i.signer=="string"?c=i.signer:c=`server:${O(i.signer,this.chain,n(this,h).projectId,n(this,h).environment).derivedAddress}`;let v=b({recipient:p,amount:t,signer:c},(i==null?void 0:i.transactionType)!=null?{transactionType:i.transactionType}:{}),w=yield n(this,h).send(this.walletLocator,d,v);if("message"in w)throw a.error("wallet.send.error",{error:w}),new Q(`Failed to send token: ${JSON.stringify(w.message)}`);if((i==null?void 0:i.prepareOnly)===!0)return a.info("wallet.send.prepared",{transactionId:w.id}),{hash:void 0,explorerLink:void 0,transactionId:w.id};let S=yield this.approveTransactionAndWait(w.id);return a.info("wallet.send.success",{transactionId:w.id,hash:S.hash}),S})}approveTransaction(e){return g(this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(e)})}approve(e){return g(this,null,function*(){if(this.requireSigner(),a.info("wallet.approve.start",{transactionId:e.transactionId,signatureId:e.signatureId}),e.transactionId!=null){let r=yield this.approveTransactionAndWait(e.transactionId,e.options);return a.info("wallet.approve.success",{transactionId:e.transactionId}),r}if(e.signatureId!=null){let r=yield this.approveSignatureAndWait(e.signatureId,e.options);return a.info("wallet.approve.success",{signatureId:e.signatureId}),r}throw a.error("wallet.approve.error",{error:"Either transactionId or signatureId must be provided"}),new Error("Either transactionId or signatureId must be provided")})}addSigner(e,r){return g(this,null,function*(){var p,d,s,o,c;a.info("wallet.addSigner.start");let t=typeof e=="object"&&"type"in e&&e.type==="server"?`server:${O(e,this.chain,n(this,h).projectId,n(this,h).environment).derivedAddress}`:e,i=this.signer,l=A(b({},n(this,E)),{address:this.address,crossmint:n(this,h).crossmint,clientTEEConnection:(p=n(this,C))==null?void 0:p.clientTEEConnection,onAuthRequired:(s=(d=n(this,C))==null?void 0:d.callbacks)==null?void 0:s.onAuthRequired});f(this,m,F(this.chain,l,(o=n(this,C))==null?void 0:o.deviceSignerKeyStorage));try{let v=typeof t=="string"||t.type==="passkey"&&t.id==null?t:t.type==="device"&&"publicKey"in t&&t.publicKey!=null?{type:"device",publicKey:t.publicKey,name:t.name}:R(t),w=yield n(this,h).registerSigner(this.walletLocator,{signer:v,chain:this.chain==="solana"||this.chain==="stellar"?void 0:this.chain});if("error"in w)throw a.error("wallet.addSigner.error",{error:w}),new Error(`Failed to register signer: ${JSON.stringify(w.message)}`);let S=G(w,this.chain);if(this.chain==="solana"||this.chain==="stellar"){if(!("transaction"in w)||w.transaction==null)throw a.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");let u=w.transaction.id;if(S==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);return r!=null&&r.prepareOnly?(a.info("wallet.addSigner.prepared",{transactionId:u}),A(b({},S),{transactionId:u})):(yield this.approveTransactionAndWait(u),a.info("wallet.addSigner.success",{transactionId:u}),A(b({},S),{status:"success"}))}else{if(!("chains"in w))throw a.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");let u=(c=w.chains)==null?void 0:c[this.chain];if(S==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);if(r!=null&&r.prepareOnly){let L=(u==null?void 0:u.status)!=="success"?u==null?void 0:u.id:void 0;return a.info("wallet.addSigner.prepared",{signatureId:L}),A(b({},S),{signatureId:L})}if((u==null?void 0:u.status)==="awaiting-approval")yield this.approveSignatureAndWait(u.id),a.info("wallet.addSigner.success",{signatureId:u.id});else if((u==null?void 0:u.status)==="pending")yield this.waitForSignature(u.id),a.info("wallet.addSigner.success",{signatureId:u.id});else{if((u==null?void 0:u.status)==="failed")throw new Error(`Signer registration failed for chain ${this.chain}`);a.info("wallet.addSigner.success")}return A(b({},S),{status:"success"})}}finally{f(this,m,i)}})}useSigner(e){return g(this,null,function*(){var i;a.info("wallet.useSigner.start"),this.validateSignerInput(e),e.type==="device"?yield this.resolveDeviceSignerAvailability(e):yield this.resolveNonDeviceSigner(e);let r=this.buildInternalSignerConfig(e),t=R(e);f(this,m,F(this.chain,r,(i=n(this,C))==null?void 0:i.deviceSignerKeyStorage)),a.info("wallet.useSigner.success",{signerLocator:t})})}resolveNonDeviceSigner(e){return g(this,null,function*(){if(e.type==="passkey"&&this.isPasskeyMissingId(e)&&!(yield this.tryAutoSelectPasskey(e))){if(this.isRecoverySigner(e)){f(this,T,!1);return}throw new Error("No passkey signer is registered on this wallet.")}let r=this.resolveSignerLocator(e);if(yield this.signerIsRegistered(r)){f(this,T,!1);return}if(this.isRecoverySigner(e)){f(this,T,!1);return}throw new Error(`Signer "${r}" is not registered in this wallet.`)})}tryAutoSelectPasskey(e){return g(this,null,function*(){let t=(yield this.signers()).filter(i=>i.type==="passkey");if(t.length===0)return!1;if(t.length>1)throw new Error('Multiple passkey signers are registered on this wallet. Please specify the credential id: wallet.useSigner({ type: "passkey", id: "<credential-id>" })');return e.id=t[0].locator.replace("passkey:",""),!0})}resolveSignerLocator(e){if(e.type==="server"){let{derivedAddress:r}=O(e,this.chain,n(this,h).projectId,n(this,h).environment);return`server:${r}`}return R(e)}isPasskeyMissingId(e){return e.id==null||e.id===""}signerIsRegistered(e){return g(this,null,function*(){return(yield this.signers()).some(t=>t.locator===e)})}needsRecovery(){return n(this,T)}recover(){return g(this,null,function*(){var l,p;if(a.info("wallet.recover.start"),n(this,m)==null&&(yield this.initDeviceSigner()),((l=n(this,m))==null?void 0:l.type)!=="device"){a.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"});return}if(n(this,N)){a.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}let e=n(this,m).locator();if(yield this.signerIsRegistered(e)){a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),f(this,T,!1),f(this,N,!0);return}let t=(p=n(this,C))==null?void 0:p.deviceSignerKeyStorage;if(t==null)throw new Error("Device signer key storage is required to recover a device signer");let i=yield ae(t,this.address);try{yield this.addSigner(i)}catch(d){throw a.error("wallet.recover.device.error",{error:d}),yield t.deleteKey(this.address),d}f(this,m,F(this.chain,{type:"device",locator:i.locator,address:this.address},t)),a.info("wallet.recover.device.success",{signerLocator:i.locator}),f(this,T,!1),f(this,N,!0)})}signers(){return g(this,null,function*(){var l,p;a.info("wallet.signers.start");let e=yield n(this,h).getWallet(this.walletLocator);if("error"in e)throw a.error("wallet.signers.error",{error:e}),new _(JSON.stringify(e));if(e.type!=="smart"||e.chainType!=="evm"&&e.chainType!=="solana"&&e.chainType!=="stellar")throw a.error("wallet.signers.error",{error:`Wallet type ${e.type} not supported`}),new j(`Wallet type ${e.type} not supported`);let r=(p=(l=e==null?void 0:e.config)==null?void 0:l.delegatedSigners)!=null?p:[];if(this.chain==="solana"||this.chain==="stellar"){let d=r.map(s=>M(s,"success"));return a.info("wallet.signers.success",{count:d.length}),d}let i=(yield Promise.all(r.map(d=>g(this,null,function*(){if(d.locator.startsWith("device:"))return M(d,"success");try{let s=yield n(this,h).getSigner(this.walletLocator,d.locator);return"error"in s?null:G(s,this.chain)}catch(s){return null}})))).filter(d=>d!=null);return a.info("wallet.signers.success",{count:i.length}),i})}get walletLocator(){if(n(this,h).isServerSide)return this.address;{let e;switch(this.chain){case"stellar":e="me:stellar:smart";break;case"solana":e="me:solana:smart";break;default:e="me:evm:smart";break}let r=this.alias!=null?`:alias:${this.alias}`:"";return e+r}}requireSigner(){if(n(this,m)==null)throw new Error("This wallet is read-only because no signer was provided. Operations that require signing (send, approve, addSigner, etc.) are not available.");return n(this,m)}preAuthIfNeeded(){return g(this,null,function*(){yield n(this,D),n(this,W)==null&&f(this,W,this.recover());try{yield n(this,W)}finally{f(this,W,null)}let e=this.requireSigner();e instanceof ne&&(yield e.ensureAuthenticated())})}isRecoverySigner(e){let r=n(this,E);if(r==null||r.type!==e.type||e.type==="device")return!1;if(e.type==="passkey")return!0;if(e.type==="server"&&r.type==="server"){let t=O(e,this.chain,n(this,h).projectId,n(this,h).environment).derivedAddress,i="address"in r?r.address:null;return i==null?!1:t===i}return R(e)===R(r)}validateSignerInput(e){switch(e.type){case"email":if(!("email"in e)||e.email==null)throw new Error("Email signer requires an email address");break;case"phone":if(!("phone"in e)||e.phone==null)throw new Error("Phone signer requires a phone number");break;case"external-wallet":if(!("address"in e)||e.address==null)throw new Error("External wallet signer requires a wallet address");if(!("onSign"in e)||typeof e.onSign!="function")throw new Error("External wallet signer requires an onSign callback");break;case"passkey":case"device":case"api-key":break;default:break}}resolveDeviceSignerAvailability(e){return g(this,null,function*(){var p;let r=(p=n(this,C))==null?void 0:p.deviceSignerKeyStorage;if(r==null)throw new Error("Device signer key storage is required for device signers");let t=yield r.getKey(this.address);if(t!=null){e.locator=`device:${t}`;return}let l=(yield this.signers()).filter(d=>d.locator.startsWith("device:"));for(let d of l){let s=d.locator.replace("device:","");if(yield r.hasKey(s)){yield r.mapAddressToKey(this.address,s),e.locator=d.locator;return}}f(this,T,!0),f(this,N,!1)})}buildInternalSignerConfig(e){var r,t,i,l,p,d;switch(e.type){case"email":return{type:"email",email:e.email,locator:`email:${e.email}`,address:this.address,crossmint:n(this,h).crossmint,clientTEEConnection:(r=n(this,C))==null?void 0:r.clientTEEConnection,onAuthRequired:(i=(t=n(this,C))==null?void 0:t.callbacks)==null?void 0:i.onAuthRequired};case"phone":return{type:"phone",phone:e.phone,locator:`phone:${e.phone}`,address:this.address,crossmint:n(this,h).crossmint,clientTEEConnection:(l=n(this,C))==null?void 0:l.clientTEEConnection,onAuthRequired:(d=(p=n(this,C))==null?void 0:p.callbacks)==null?void 0:d.onAuthRequired};case"passkey":{let s="id"in e&&e.id?e.id:"";return{type:"passkey",id:s,locator:`passkey:${s}`,name:"name"in e?e.name:void 0,publicKey:"publicKey"in e?e.publicKey:void 0,onCreatePasskey:e.onCreatePasskey,onSignWithPasskey:e.onSignWithPasskey}}case"device":return{type:"device",locator:"locator"in e&&e.locator?e.locator:void 0,address:this.address};case"external-wallet":return A(b({},e),{locator:`external-wallet:${e.address}`});case"api-key":return{type:"api-key",locator:"api-key",address:this.address};case"server":{let{derivedKeyBytes:s,derivedAddress:o}=O(e,this.chain,n(this,h).projectId,n(this,h).environment);return{type:"server",derivedKeyBytes:s,locator:`server:${o}`,address:o}}default:throw new Error(`Unknown signer type: ${e==null?void 0:e.type}`)}}get isSolanaWallet(){return this.chain==="solana"}resolveChainForEnvironment(){let e=ie(this.chain,n(this,h).environment);return e!==this.chain&&(this.chain=e),this.chain}approveTransactionAndWait(e,r){return g(this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return g(this,null,function*(){let t=yield this.approveSignatureInternal(e,r);return!("error"in t)&&t.status==="success"&&t.outputSignature!=null?{signature:t.outputSignature,signatureId:e}:(yield this.sleep(1e3),yield this.waitForSignature(e))})}approveSignatureInternal(e,r){return g(this,null,function*(){var s,o;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=this.requireSigner(),i=yield n(this,h).getSignature(this.walletLocator,e);if("error"in i)throw new q(JSON.stringify(i));if(t.type==="api-key")return i;if((r==null?void 0:r.approval)!=null){let c=[r.approval];return yield this.executeApproveSignatureWithErrorHandling(e,c)}let l=(s=i.approvals)==null?void 0:s.pending;if(l==null)return i;let p=[...(o=r==null?void 0:r.additionalSigners)!=null?o:[],t],d=yield Promise.all(l.map(c=>g(this,null,function*(){let v=p.find(S=>S.locator()===c.signer.locator);if(v==null)throw new J(`Signer ${c.signer.locator} not found in pending approvals`);let w=yield v.signMessage(c.message);return A(b({},w),{signer:v.locator()})})));return yield this.executeApproveSignatureWithErrorHandling(e,d)})}approveTransactionInternal(e,r){return g(this,null,function*(){var s,o,c,v,w;let t=yield n(this,h).getTransaction(this.walletLocator,e);if("error"in t)throw new H(JSON.stringify(t));yield(c=(o=(s=n(this,C))==null?void 0:s.callbacks)==null?void 0:o.onTransactionStart)==null?void 0:c.call(o);let i=this.requireSigner();if(i.type==="api-key")return t;if((r==null?void 0:r.approval)!=null){let S=[r.approval];return yield this.executeApproveTransactionWithErrorHandling(e,S)}let l=(v=t.approvals)==null?void 0:v.pending;if(l==null)return t;let p=[...(w=r==null?void 0:r.additionalSigners)!=null?w:[],i],d=yield Promise.all(l.map(S=>g(this,null,function*(){let u=p.find(le=>le.locator()===S.signer.locator);if(u==null)throw new J(`Signer ${S.signer.locator} not found in pending approvals`);let L=u.type==="device",K=t.chainType==="solana"&&"transaction"in t.onChain&&!L?t.onChain.transaction:S.message,oe=yield u.signTransaction(K);return A(b({},oe),{signer:u.locator()})})));return yield this.executeApproveTransactionWithErrorHandling(e,d)})}executeApproveTransactionWithErrorHandling(e,r){return g(this,null,function*(){a.info("wallet.approve: submitting approval to API",{transactionId:e});let t=yield n(this,h).approveTransaction(this.walletLocator,e,{approvals:r});if(t.error)throw new re(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(e,r){return g(this,null,function*(){let t=yield n(this,h).approveSignature(this.walletLocator,e,{approvals:r});if(t.error)throw new V(JSON.stringify(t));return t})}waitForSignature(e){return g(this,null,function*(){let r=null;do if(yield new Promise(t=>setTimeout(t,B)),r=yield n(this,h).getSignature(this.walletLocator,e),"error"in r)throw new q(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new U("Signature signing failed");if(!r.outputSignature)throw new q("Signature not available");return{signature:r.outputSignature,signatureId:e}})}waitForTransaction(p){return g(this,arguments,function*(e,r=6e4,{backoffMultiplier:t=1.1,maxBackoffMs:i=2e3,initialBackoffMs:l=B}={}){var c;a.info("wallet.approve: waiting for transaction confirmation",{transactionId:e,timeoutMs:r});let d=Date.now(),s;do{if(Date.now()-d>r)throw new X("Transaction confirmation timeout");if(s=yield n(this,h).getTransaction(this.walletLocator,e),s.error)throw new H(JSON.stringify(s));yield this.sleep(l),l=Math.min(l*t,i)}while(s.status==="pending");if(s.status==="failed")throw new Y(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new Z("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let o=s.onChain.txId;if(o==null)throw new ee("Transaction hash not found on transaction response");return{hash:o,explorerLink:(c=s.onChain.explorerLink)!=null?c:"",transactionId:s.id}})}sleep(e){return g(this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};m=new WeakMap,C=new WeakMap,h=new WeakMap,E=new WeakMap,$=new WeakMap,T=new WeakMap,N=new WeakMap,D=new WeakMap,W=new WeakMap,P([x({logger:a,methodName:"wallet.balances",buildContext(e){return{chain:e.chain,address:e.address}}})],I.prototype,"balances",1),P([x({logger:a,methodName:"wallet.stagingFund",buildContext(e){return{chain:e.chain,address:e.address}}})],I.prototype,"stagingFund",1),P([x({logger:a,methodName:"wallet.send",buildContext(e){return{chain:e.chain,address:e.address}}})],I.prototype,"send",1),P([x({logger:a,methodName:"wallet.approve",buildContext(e){return{chain:e.chain,address:e.address}}})],I.prototype,"approve",1),P([x({logger:a,methodName:"wallet.addSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],I.prototype,"addSigner",1),P([x({logger:a,methodName:"wallet.useSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],I.prototype,"useSigner",1),P([x({logger:a,methodName:"wallet.recover",buildContext(e){return{chain:e.chain,address:e.address}}})],I.prototype,"recover",1),P([x({logger:a,methodName:"wallet.signers",buildContext(e){return{chain:e.chain,address:e.address}}})],I.prototype,"signers",1);function ce(y){if(typeof y=="string"){if(!se(y))throw new te(`Invalid recipient address: "${y}". Expected a valid EVM (0x...), Solana (base58), or Stellar (G.../C...) address.`);return y}if("email"in y)return`email:${y.email}`;if("x"in y)return`x:${y.x}`;if("twitter"in y)return`twitter:${y.twitter}`;if("phone"in y)return`phoneNumber:${y.phone}`;if("userId"in y)return`userId:${y.userId}`;throw new Error("Invalid recipient locator")}function de(y,e){return se(y)?`${e}:${y}`:`${e}:${y.toLowerCase()}`}export{I as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b as g}from"./chunk-
|
|
1
|
+
import{a,b as g}from"./chunk-RR6DWIRN.js";import{a as s}from"./chunk-6TYV7ADO.js";import{g as t}from"./chunk-J3R36SGJ.js";import{PersonalMessage as u}from"ox";import{isHex as h,toHex as l}from"viem";var c=class p extends a{constructor(e){super(e)}signMessage(e){return t(this,null,function*(){let i=h(e)?e:l(e),r=u.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return t(this,null,function*(){return yield this.sign(e)})}sign(e){return t(this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");s.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:g});if(s.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};export{c as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkFOINTZC5cjs = require('./chunk-FOINTZC5.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var t=new _commonsdkbase.SdkLogger;function v(s){let o=_commonsdkbase.detectPlatform.call(void 0, ),e=_commonsdkbase.validateAPIKey.call(void 0, s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:_chunkFOINTZC5cjs.c,packageVersion:_chunkFOINTZC5cjs.b,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new (0, _commonsdkbase.BrowserDatadogSink)(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new (0, _commonsdkbase.ServerDatadogSink)(a);t.addSink(r);break}default:break}}exports.a = t; exports.b = v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s=class{constructor(
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s=class{constructor(r){this.apiKey=r}};exports.a = s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-24JKRXBH.js";import{a as s}from"./chunk-6FGJ3ICD.js";import{a as l}from"./chunk-RBKG6QLZ.js";import{a,b as i}from"./chunk-6TYV7ADO.js";import{g as r}from"./chunk-J3R36SGJ.js";import{createCrossmint as C}from"@crossmint/common-sdk-base";import{WebAuthnP256 as p}from"ox";var o=class c{constructor(e){i(e.apiKey);let t=new l(e);this.walletFactory=new n(t),a.info("wallets.sdk.initialized")}static from(e){return new c(e)}getWallet(e,t){return r(this,null,function*(){if(typeof e=="string"){if(t==null)throw new Error("Args parameter is required when walletLocator is provided");return yield this.walletFactory.getWallet(e,t)}return yield this.walletFactory.getWallet(e)})}createWallet(e){return r(this,null,function*(){return yield this.walletFactory.createWallet(e)})}createDeviceSigner(e,t){return r(this,null,function*(){return yield s(e,t)})}createPasskeySigner(e){return r(this,null,function*(){let t=yield p.createCredential({name:e});return{type:"passkey",id:t.id,name:e,publicKey:{x:t.publicKey.x.toString(),y:t.publicKey.y.toString()}}})}};export{C as a,o as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkVA26VSUQcjs = require('./chunk-VA26VSUQ.cjs');var _chunk6MGMZ3SIcjs = require('./chunk-6MGMZ3SI.cjs');var _chunk6EZCCLTKcjs = require('./chunk-6EZCCLTK.cjs');var _chunkT3U46LK3cjs = require('./chunk-T3U46LK3.cjs');var _chunk3OGAQBMGcjs = require('./chunk-3OGAQBMG.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var o=class o extends _chunkVA26VSUQcjs.a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,options:_chunkVA26VSUQcjs.a.getOptions(n),alias:n.alias,recovery:_chunkVA26VSUQcjs.a.getRecovery(n),signer:n.signer},_chunkVA26VSUQcjs.a.getApiClient(n))}static from(n){if(!_commonsdkbase.isValidSolanaAddress.call(void 0, n.address))throw new Error("Wallet is not a Solana wallet");return new o(n)}sendTransaction(n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var d,p;_chunk3OGAQBMGcjs.a.info("solanaWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let e=yield this.createTransaction(n);if((d=n.options)!=null&&d.prepareOnly)return _chunk3OGAQBMGcjs.a.info("solanaWallet.sendTransaction.prepared",{transactionId:e.id}),{hash:void 0,explorerLink:void 0,transactionId:e.id};let i={additionalSigners:(p=n.additionalSigners)==null?void 0:p.map(l=>new (0, _chunk6EZCCLTKcjs.a)({type:"external-wallet",address:l.publicKey.toString(),locator:`external-wallet:${l.publicKey.toString()}`,onSign:h=>(h.sign([l]),Promise.resolve(h))}))},t=yield this.approveTransactionAndWait(e.id,i);return _chunk3OGAQBMGcjs.a.info("solanaWallet.sendTransaction.success",{transactionId:e.id,hash:t.hash}),t})}createTransaction(n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var t;let e;((t=n.options)==null?void 0:t.signer)==null?e=this.requireSigner().locator():typeof n.options.signer=="string"?e=n.options.signer:e=`server:${_chunk6MGMZ3SIcjs.b.call(void 0, n.options.signer,this.chain,this.apiClient.projectId,this.apiClient.environment).derivedAddress}`;let s;"serializedTransaction"in n?s=n.serializedTransaction:s=_bs582.default.encode(n.transaction.serialize());let i=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:s,signer:e}});if("error"in i)throw new (0, _chunkT3U46LK3cjs.t)(JSON.stringify(i));return i})}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk3OGAQBMGcjs.a,methodName:"solanaWallet.sendTransaction",buildContext(n){return{chain:n.chain,address:n.address}}})],o.prototype,"sendTransaction",1);var S=o;exports.a = S;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as v}from"./chunk-IOSADDL5.js";import{a as l}from"./chunk-6TYV7ADO.js";import{c as d,g as n}from"./chunk-J3R36SGJ.js";import{getEnvironmentForKey as E,APIKeyEnvironmentPrefix as h,WithLoggerContext as u}from"@crossmint/common-sdk-base";import{WebAuthnP256 as w}from"ox";var b={[h.DEVELOPMENT]:"https://development.devicekey.store",[h.STAGING]:"https://staging.devicekey.store",[h.PRODUCTION]:"https://devicekey.store"},P=6e4,K="indexeddb-fatal",c=class extends v{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;let r=E(e);if(r==null)throw new Error("Unable to determine environment from API key");this.iframeUrl=b[r]}setBiometricRequestHandler(e){this.biometricRequestHandler=e}generateKey(){return n(this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return n(this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return n(this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return n(this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return n(this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return n(this,null,function*(){yield this.rpc("deleteKey",{address:e})})}destroy(){this.biometricListener!=null&&(window.removeEventListener("message",this.biometricListener),this.biometricListener=null),this.iframePromise!=null&&(this.iframePromise.then(e=>e.remove()).catch(()=>{}),this.iframePromise=null)}rpc(e,r){return n(this,null,function*(){let i=yield this.sendRpc(e,r);if(i.fatal){l.warn(`[IframeDeviceSignerKeyStorage] Recoverable IDB error on "${e}", reloading iframe and retrying`),yield this.reloadIframe();let t=yield this.sendRpc(e,r);if(t.fatal)throw new Error(`Device signer IDB fatal error on "${e}" persisted after iframe reload`);return t.value}return i.value})}sendRpc(e,r){return n(this,null,function*(){let t=(yield this.getIframe()).contentWindow;if(t==null)throw new Error("Device signer iframe has no contentWindow");let g=crypto.randomUUID(),a=new URL(this.iframeUrl).origin;return new Promise((s,o)=>{let f=setTimeout(()=>{window.removeEventListener("message",p),o(new Error(`Device signer RPC "${e}" timed out after ${P}ms`))},P);function p(y){let m=y.data;m==null||m.id!==g||y.origin===a&&(clearTimeout(f),window.removeEventListener("message",p),m.type==="error"&&m.code===K?s({fatal:!0}):m.type==="error"?o(new Error(m.error)):s({value:m.result,fatal:!1}))}window.addEventListener("message",p),t.postMessage({type:e,id:g,payload:r},this.iframeUrl)})})}reloadIframe(){return n(this,null,function*(){if(this.reloading!=null)return this.reloading;let e=n(this,null,function*(){try{this.destroy(),yield this.getIframe()}finally{this.reloading=null}});return this.reloading=e,e})}setupBiometricListener(e){let r=new URL(this.iframeUrl).origin;this.biometricListener=i=>n(this,null,function*(){if(i.origin!==r)return;let t=i.data;if((t==null?void 0:t.type)!=="biometric-request")return;let g=e.contentWindow;if(g!=null)try{this.biometricRequestHandler!=null&&(yield this.biometricRequestHandler(t.action));let a=null;if(t.action==="createCredential"){let s=t.payload,o=yield w.createCredential({name:s.name});a={id:o.id,publicKey:{x:`0x${o.publicKey.x.toString(16)}`,y:`0x${o.publicKey.y.toString(16)}`}}}else if(t.action==="sign"){let s=t.payload,{signature:o,metadata:f}=yield w.sign({credentialId:s.credentialId,challenge:s.challenge});a={signature:{r:`0x${o.r.toString(16)}`,s:`0x${o.s.toString(16)}`},metadata:f}}g.postMessage({type:"biometric-response",id:t.id,result:a},this.iframeUrl)}catch(a){let s=a instanceof Error?a.message:"Unknown biometric error";g.postMessage({type:"biometric-response",id:t.id,error:s},this.iframeUrl)}}),window.addEventListener("message",this.biometricListener)}getIframe(){return this.iframePromise==null&&(this.iframePromise=this.createIframe().catch(e=>{throw this.iframePromise=null,e})),this.iframePromise}createIframe(){let e=document.createElement("iframe");return e.src=this.iframeUrl,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,i)=>{e.onload=()=>{this.setupBiometricListener(e),r(e)},e.onerror=()=>i(new Error("Failed to load device signer iframe")),document.body.appendChild(e)})}getDeviceName(){var t;if(typeof navigator=="undefined")return"Unknown Device";let e=navigator.userAgent,r=this.parseDevice(e),i=this.parseBrowser(e);return r!=null&&i!=null?`${i} on ${r}`:(t=r!=null?r:i)!=null?t:"Unknown Device"}parseDevice(e){return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":/Macintosh|Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"ChromeOS":null}parseBrowser(e){return/Edg\//.test(e)?"Edge":/OPR\/|Opera/.test(e)?"Opera":typeof navigator!="undefined"&&"brave"in navigator?"Brave":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)&&!/Chrome\//.test(e)?"Safari":/Firefox\//.test(e)?"Firefox":null}};d([u({logger:l,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);export{c as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkSCEPJO4Qcjs = require('./chunk-SCEPJO4Q.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkSCEPJO4Qcjs = require('./chunk-SCEPJO4Q.cjs');var _chunkT3U46LK3cjs = require('./chunk-T3U46LK3.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var l=class extends _chunkSCEPJO4Qcjs.a{constructor(n){super(n),this.onSign=n.onSign}signMessage(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for solana external wallet signer"))})}signTransaction(n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.onSign==null)throw new Error("[SolanaExternalWalletSigner] No onSign callback provided. Pass an onSign callback when configuring the external wallet signer.");let c=_bs582.default.decode(n),g=_web3js.VersionedTransaction.deserialize(c),t=yield this.onSign(g),d=new (0, _web3js.PublicKey)(this._address),i=t.message.staticAccountKeys.findIndex(m=>m.equals(d));if(i===-1)throw new (0, _chunkT3U46LK3cjs.z)("Wallet public key not found in transaction signers");let r=t.signatures[i];if(r==null)throw new (0, _chunkT3U46LK3cjs.z)("No valid signature found in the transaction");let u=new Uint8Array(Object.values(r));return{signature:_bs582.default.encode(u)}})}};exports.a = l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as c}from"./chunk-J3R36SGJ.js";import{decodeBase64 as p,encodeHex as n}from"@crossmint/client-signers-cryptography";function x(t,r){return c(this,null,function*(){let i=yield t.generateKey({address:r}),e=p(i);if(e.length!==65||e[0]!==4)throw new Error("Invalid uncompressed P-256 public key: expected 65 bytes starting with 0x04");let o=e.slice(1,33),s=e.slice(33,65),y=`0x${n(o)}`,g=`0x${n(s)}`,a=t.getDeviceName();return{type:"device",publicKey:{x:y,y:g},locator:`device:${i}`,name:a}})}export{x as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as i}from"./chunk-
|
|
1
|
+
import{b as n,c as i}from"./chunk-W6V7WGBL.js";import{SdkLogger as d,BrowserDatadogSink as k,detectPlatform as g,validateAPIKey as l,ServerDatadogSink as m}from"@crossmint/common-sdk-base";var t=new d;function f(s){let o=g(),e=l(s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:i,packageVersion:n,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new k(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new m(a);t.addSink(r);break}default:break}}export{t as a,f as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZIFTCPCXcjs = require('./chunk-ZIFTCPCX.cjs');var _chunkLZNQBJEKcjs = require('./chunk-LZNQBJEK.cjs');var _chunkF2KLBYRRcjs = require('./chunk-F2KLBYRR.cjs');var _chunk3OGAQBMGcjs = require('./chunk-3OGAQBMG.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var o=class c{constructor(e){_chunk3OGAQBMGcjs.b.call(void 0, e.apiKey);let t=new (0, _chunkF2KLBYRRcjs.a)(e);this.walletFactory=new (0, _chunkZIFTCPCXcjs.a)(t),_chunk3OGAQBMGcjs.a.info("wallets.sdk.initialized")}static from(e){return new c(e)}getWallet(e,t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(typeof e=="string"){if(t==null)throw new Error("Args parameter is required when walletLocator is provided");return yield this.walletFactory.getWallet(e,t)}return yield this.walletFactory.getWallet(e)})}createWallet(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.walletFactory.createWallet(e)})}createDeviceSigner(e,t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield _chunkLZNQBJEKcjs.a.call(void 0, e,t)})}createPasskeySigner(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let t=yield _ox.WebAuthnP256.createCredential({name:e});return{type:"passkey",id:t.id,name:e,publicKey:{x:t.publicKey.x.toString(),y:t.publicKey.y.toString()}}})}};exports.a = _commonsdkbase.createCrossmint; exports.b = o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CrossmintSDKError as t,WalletErrorCode as e}from"@crossmint/common-sdk-base";var o=class extends t{constructor(s,r){super(s,e.API_KEY_INVALID,r)}},c=class extends t{constructor(s,r){super(s,e.ENVIRONMENT_INVALID,r)}},p=class extends t{constructor(s,r){super(s,e.WALLET_CREATION_FAILED,r)}},A=class extends t{constructor(s,r){super(s,e.WALLET_TYPE_INVALID,r)}},I=class extends t{constructor(s,r){super(s,e.WALLET_NOT_AVAILABLE,r)}},i=class extends t{constructor(s,r){super(s,e.WALLET_NOT_AVAILABLE,r)}},x=class extends t{constructor(s,r){super(s,e.WALLET_CREATION_FAILED,r)}},g=class extends t{constructor(s,r){super(s,e.WALLET_TYPE_INVALID,r)}},u=class extends t{constructor(s,r){super(s,e.SIGNER_INVALID,r)}},N=class extends t{constructor(s,r){super(s,e.SIGNER_INVALID,r)}},E=class extends t{constructor(s,r){super(s,e.MESSAGE_INVALID,r)}},L=class extends t{constructor(s,r){super(s,e.MESSAGE_INVALID,r)}},_=class extends t{constructor(s,r){super(s,e.SIGNING_FAILED,r)}},T=class extends t{constructor(s,r){super(s,e.SIGNING_FAILED,r)}},l=class extends t{constructor(s,r){super(s,e.SIGNING_FAILED,r)}},a=class extends t{constructor(s,r){super(s,e.NO_SIGNATURE,r)}},d=class extends t{constructor(s,r){super(s,e.NO_SIGNATURE,r)}},D=class extends t{constructor(s,r){super(s,e.SIGNING_FAILED,r)}},S=class extends t{constructor(s,r){super(s,e.NO_TRANSACTION,r)}},O=class extends t{constructor(s,r){super(s,e.NO_TRANSACTION,r)}},R=class extends t{constructor(s,r){super(s,e.NO_TRANSACTION,r)}},C=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}},G=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}},F=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}},V=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}},W=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}},P=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}},m=class extends t{constructor(s,r){super(s,e.RECIPIENT_ADDRESS_INVALID,r)}};export{o as a,c as b,p as c,A as d,I as e,i as f,x as g,g as h,u as i,N as j,E as k,L as l,_ as m,T as n,l as o,a as p,d as q,D as r,S as s,O as t,R as u,C as v,G as w,F as x,V as y,W as z,P as A,m as B};
|