@crossmint/wallets-sdk 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/__tests__/constants.d.cts +1 -1
- package/dist/api/__tests__/constants.d.ts +1 -1
- package/dist/api/__tests__/test-utils.cjs +1 -1
- package/dist/api/__tests__/test-utils.d.cts +1 -1
- package/dist/api/__tests__/test-utils.d.ts +1 -1
- package/dist/api/__tests__/test-utils.js +1 -1
- package/dist/api/client.cjs +1 -1
- package/dist/api/client.d.cts +1 -1
- package/dist/api/client.d.ts +1 -1
- package/dist/api/client.js +1 -1
- package/dist/api/gen/types.gen.d.cts +4 -0
- package/dist/api/gen/types.gen.d.ts +4 -0
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/types.d.cts +1 -1
- package/dist/api/types.d.ts +1 -1
- package/dist/chains/chains.cjs +1 -1
- package/dist/chains/chains.js +1 -1
- package/dist/{chunk-W7LJS32A.js → chunk-2O6HQK34.js} +1 -1
- package/dist/{chunk-LBKX6JJV.js → chunk-3OY2R7OL.js} +1 -1
- package/dist/{chunk-GQHU6TH5.cjs → chunk-3VSFHDFH.cjs} +1 -1
- package/dist/chunk-5OYPWGMX.js +1 -0
- package/dist/{chunk-K5TQ4QU3.cjs → chunk-6EUBBDIV.cjs} +1 -1
- package/dist/{chunk-LGDJURYY.js → chunk-6LTDAENQ.js} +1 -1
- package/dist/{chunk-KPB77YNY.cjs → chunk-7EF275IG.cjs} +1 -1
- package/dist/{chunk-FMWVS32K.cjs → chunk-7WACXZXY.cjs} +1 -1
- package/dist/{chunk-TYVOOI35.js → chunk-A73HLVAF.js} +1 -1
- package/dist/{chunk-MVT4TQPN.js → chunk-ARF3OETV.js} +1 -1
- package/dist/chunk-BA36HJOM.js +1 -0
- package/dist/{chunk-2B2VKXMR.cjs → chunk-BQYPF4FS.cjs} +1 -1
- package/dist/{chunk-TTT6T3VE.js → chunk-C73NTGFV.js} +1 -1
- package/dist/{chunk-PR2M7QAF.js → chunk-CT65GLWK.js} +1 -1
- package/dist/{chunk-6EZCCLTK.cjs → chunk-E4EOD7MP.cjs} +1 -1
- package/dist/chunk-G4RVBYWJ.cjs +1 -0
- package/dist/{chunk-SRPDUX6H.cjs → chunk-GETUHEQB.cjs} +1 -1
- package/dist/{chunk-4O34QU74.cjs → chunk-IINCFP4K.cjs} +1 -1
- package/dist/{chunk-FFOVF23E.js → chunk-J2CTZ3KC.js} +1 -1
- package/dist/{chunk-KOO4IQ3M.js → chunk-JFGHOWZK.js} +1 -1
- package/dist/{chunk-YIO5XXQ4.js → chunk-JGWGYONV.js} +1 -1
- package/dist/chunk-KB32HFUC.js +3 -0
- package/dist/chunk-LPL33F57.js +1 -0
- package/dist/{chunk-JHE6LNLM.js → chunk-MILCZTHF.js} +1 -1
- package/dist/{chunk-YL6OIWBR.cjs → chunk-MXXBDP4U.cjs} +1 -1
- package/dist/{chunk-PE2ZTLGK.js → chunk-NFCZBR6G.js} +1 -1
- package/dist/{chunk-X2FNNYCG.cjs → chunk-NLO5MHPW.cjs} +1 -1
- package/dist/chunk-OWQZPI3U.cjs +1 -0
- package/dist/{chunk-4LWG7FIM.js → chunk-PL6OYURB.js} +1 -1
- package/dist/chunk-PMM7CHUU.js +1 -0
- package/dist/{chunk-F2TXDKPB.cjs → chunk-QJC54AML.cjs} +1 -1
- package/dist/{chunk-CCAPUWFB.cjs → chunk-QJV6W4U2.cjs} +1 -1
- package/dist/{chunk-2UQ3HUS6.js → chunk-RBSMBO4T.js} +1 -1
- package/dist/{chunk-P2IW4ZL6.cjs → chunk-TK2Z4EWO.cjs} +1 -1
- package/dist/{chunk-BMLREMLL.js → chunk-TM5CSXH4.js} +1 -1
- package/dist/chunk-VJEQU7S4.cjs +3 -0
- package/dist/{chunk-IMTOUORZ.cjs → chunk-VWHGZO7N.cjs} +1 -1
- package/dist/{chunk-LITEQGNE.cjs → chunk-WGDHVUGK.cjs} +1 -1
- package/dist/{chunk-RMKQ35ZD.cjs → chunk-XHVSF356.cjs} +1 -1
- package/dist/{chunk-2R7ORD74.cjs → chunk-YUVIKZL5.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- 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 +1 -1
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.js +1 -1
- package/dist/signers/device.d.cts +1 -1
- package/dist/signers/device.d.ts +1 -1
- package/dist/signers/evm-api-key.d.cts +1 -1
- package/dist/signers/evm-api-key.d.ts +1 -1
- package/dist/signers/evm-external-wallet.d.cts +1 -1
- package/dist/signers/evm-external-wallet.d.ts +1 -1
- package/dist/signers/external-wallet-signer.d.cts +1 -1
- package/dist/signers/external-wallet-signer.d.ts +1 -1
- package/dist/signers/index.cjs +1 -1
- package/dist/signers/index.d.cts +1 -1
- package/dist/signers/index.d.ts +1 -1
- package/dist/signers/index.js +1 -1
- package/dist/signers/non-custodial/index.cjs +1 -1
- package/dist/signers/non-custodial/index.d.cts +1 -1
- package/dist/signers/non-custodial/index.d.ts +1 -1
- 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 +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.d.ts +1 -1
- 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 +1 -1
- package/dist/signers/non-custodial/ncs-signer.d.ts +1 -1
- 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 +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.d.ts +1 -1
- 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 +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
- package/dist/signers/passkey.d.cts +1 -1
- package/dist/signers/passkey.d.ts +1 -1
- package/dist/signers/server/assemble-server-signer.cjs +1 -1
- package/dist/signers/server/assemble-server-signer.d.cts +1 -1
- package/dist/signers/server/assemble-server-signer.d.ts +1 -1
- package/dist/signers/server/assemble-server-signer.js +1 -1
- package/dist/signers/server/evm-server-signer.d.cts +1 -1
- package/dist/signers/server/evm-server-signer.d.ts +1 -1
- package/dist/signers/server/helpers/derive-server-signer.cjs +1 -1
- package/dist/signers/server/helpers/derive-server-signer.d.cts +1 -1
- package/dist/signers/server/helpers/derive-server-signer.d.ts +1 -1
- package/dist/signers/server/helpers/derive-server-signer.js +1 -1
- package/dist/signers/server/helpers/index.cjs +1 -1
- package/dist/signers/server/helpers/index.d.cts +1 -1
- package/dist/signers/server/helpers/index.d.ts +1 -1
- package/dist/signers/server/helpers/index.js +1 -1
- package/dist/signers/server/index.cjs +1 -1
- package/dist/signers/server/index.d.cts +1 -1
- package/dist/signers/server/index.d.ts +1 -1
- package/dist/signers/server/index.js +1 -1
- package/dist/signers/server/solana-server-signer.d.cts +1 -1
- package/dist/signers/server/solana-server-signer.d.ts +1 -1
- package/dist/signers/server/stellar-server-signer.d.cts +1 -1
- package/dist/signers/server/stellar-server-signer.d.ts +1 -1
- package/dist/signers/solana-api-key.d.cts +1 -1
- package/dist/signers/solana-api-key.d.ts +1 -1
- package/dist/signers/solana-external-wallet.cjs +1 -1
- package/dist/signers/solana-external-wallet.d.cts +1 -1
- package/dist/signers/solana-external-wallet.d.ts +1 -1
- package/dist/signers/solana-external-wallet.js +1 -1
- package/dist/signers/stellar-external-wallet.d.cts +1 -1
- package/dist/signers/stellar-external-wallet.d.ts +1 -1
- package/dist/signers/types.d.cts +1 -1
- package/dist/signers/types.d.ts +1 -1
- package/dist/{types-NmTwqiYW.d.ts → types-CtOIG5sn.d.ts} +1 -1
- package/dist/{types-Nc5kinaI.d.cts → types-DZWn68Po.d.cts} +1 -1
- package/dist/utils/constants.cjs +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -1
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -1
- package/dist/utils/device-signers/createDeviceSigner.d.cts +1 -1
- package/dist/utils/device-signers/createDeviceSigner.d.ts +1 -1
- package/dist/utils/device-signers/index.cjs +1 -1
- package/dist/utils/device-signers/index.d.cts +1 -1
- package/dist/utils/device-signers/index.d.ts +1 -1
- package/dist/utils/device-signers/index.js +1 -1
- package/dist/utils/errors.cjs +1 -1
- package/dist/utils/errors.d.cts +13 -2
- package/dist/utils/errors.d.ts +13 -2
- package/dist/utils/errors.js +1 -1
- package/dist/utils/signer-locator.d.cts +1 -1
- package/dist/utils/signer-locator.d.ts +1 -1
- package/dist/utils/signer-mapping.d.cts +1 -1
- package/dist/utils/signer-mapping.d.ts +1 -1
- package/dist/utils/signer-validation.cjs +1 -1
- package/dist/utils/signer-validation.js +1 -1
- package/dist/wallets/__tests__/test-helpers.cjs +1 -1
- package/dist/wallets/__tests__/test-helpers.d.cts +1 -1
- package/dist/wallets/__tests__/test-helpers.d.ts +1 -1
- package/dist/wallets/__tests__/test-helpers.js +1 -1
- package/dist/wallets/evm.cjs +1 -1
- package/dist/wallets/evm.d.cts +1 -1
- package/dist/wallets/evm.d.ts +1 -1
- package/dist/wallets/evm.js +1 -1
- package/dist/wallets/solana.cjs +1 -1
- package/dist/wallets/solana.d.cts +1 -1
- package/dist/wallets/solana.d.ts +1 -1
- package/dist/wallets/solana.js +1 -1
- package/dist/wallets/stellar.cjs +1 -1
- package/dist/wallets/stellar.d.cts +1 -1
- package/dist/wallets/stellar.d.ts +1 -1
- 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 +1 -1
- package/dist/wallets/wallet-factory.d.ts +1 -1
- package/dist/wallets/wallet-factory.js +1 -1
- package/dist/wallets/wallet.cjs +1 -1
- package/dist/wallets/wallet.d.cts +8 -1
- package/dist/wallets/wallet.d.ts +8 -1
- package/dist/wallets/wallet.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-EXC7TCGL.js +0 -1
- package/dist/chunk-GDRSDCM6.cjs +0 -3
- package/dist/chunk-K2OP3UKD.js +0 -3
- package/dist/chunk-KVTLS4H7.js +0 -1
- package/dist/chunk-PT356WGC.cjs +0 -1
- package/dist/chunk-RTS4N5HQ.js +0 -1
- package/dist/chunk-T3U46LK3.cjs +0 -1
- package/dist/chunk-VU63FANF.js +0 -1
|
@@ -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 _chunkTK2Z4EWOcjs = require('../../chunk-TK2Z4EWO.cjs');require('../../chunk-OWQZPI3U.cjs');require('../../chunk-QJV6W4U2.cjs');require('../../chunk-NLO5MHPW.cjs');var _chunk2GKPWQBQcjs = require('../../chunk-2GKPWQBQ.cjs');var _vitest = require('vitest');var P=({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=>P({data:e}),b= exports.createMockErrorResponse =(e,t=400,n="Bad Request")=>P({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, _chunkTK2Z4EWOcjs.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(b(n,s));let a=yield e();_vitest.expect.call(void 0, l(a)).toBe(!0),l(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 u={error:!0,message:g};t.mockResolvedValueOnce(b(u,c));let m=yield e();_vitest.expect.call(void 0, l(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 l(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function C(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, _chunkTK2Z4EWOcjs.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:u="default"}=n,m=g||`userId:integration-${u}-${Date.now()}`,f=yield e.createWallet(_chunk2GKPWQBQcjs.a.call(void 0, {chainType:o,type:c},g&&{owner:m}));if(C(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 C(s)&&t.addWallet(s.address),s})}function le(e,t){_vitest.expect.call(void 0, l(e)).toBe(!0),t&&_vitest.expect.call(void 0, e.message).toBeDefined()}function ue(e){_vitest.expect.call(void 0, C(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(l(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(l(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:""}))},h=yield e.approveTransaction(t,n,O);if(l(h))throw new Error(`Failed to approve transaction: ${h.message||"Unknown error"}`);yield x(_chunkJ33QM2IDcjs.j);continue}yield x(_chunkJ33QM2IDcjs.i)}let u=yield e.getTransaction(t,n);if(l(u))throw new Error(`Transaction not found after retries: ${u.message||"Unknown error"}`);if(!("status"in u))throw new Error("Transaction response missing status property");return u}),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(l(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 = b; exports.createMockResponse = P; 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 = le; exports.expectRequestBody = q; exports.expectRequestPath = N; exports.expectSuccessTransactionResponse = de; exports.expectSuccessWalletResponse = ue; exports.extractFetchCall = Y; exports.fundWallet = I; exports.fundWalletAndWait = me; exports.isErrorResponse = l; exports.isSuccessTransactionResponse = $; exports.isSuccessWalletResponse = C; 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,7 +1,7 @@
|
|
|
1
1
|
import { MockedFunction } from 'vitest';
|
|
2
2
|
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
3
3
|
import { ApiClient } from '../client.cjs';
|
|
4
|
-
import { a8 as WalletLocator, aa as GetTransactionResponse, ab as SendResponse, ac as CreateWalletResponse, ad as CreateWalletParams, a0 as FundWalletResponse } from '../../types-
|
|
4
|
+
import { a8 as WalletLocator, aa as GetTransactionResponse, ab as SendResponse, ac as CreateWalletResponse, ad as CreateWalletParams, a0 as FundWalletResponse } from '../../types-DZWn68Po.cjs';
|
|
5
5
|
import '../../chains/chains.cjs';
|
|
6
6
|
import 'viem';
|
|
7
7
|
import '../gen/types.gen.cjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MockedFunction } from 'vitest';
|
|
2
2
|
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
3
3
|
import { ApiClient } from '../client.js';
|
|
4
|
-
import { a8 as WalletLocator, aa as GetTransactionResponse, ab as SendResponse, ac as CreateWalletResponse, ad as CreateWalletParams, a0 as FundWalletResponse } from '../../types-
|
|
4
|
+
import { a8 as WalletLocator, aa as GetTransactionResponse, ab as SendResponse, ac as CreateWalletResponse, ad as CreateWalletParams, a0 as FundWalletResponse } from '../../types-CtOIG5sn.js';
|
|
5
5
|
import '../../chains/chains.js';
|
|
6
6
|
import 'viem';
|
|
7
7
|
import '../gen/types.gen.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as A,b as F,i as R,j as W,k as E,l as M,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 W,k as E,l as M,m as S}from"../../chunk-DIGDDKSF.js";import{a as w}from"../../chunk-6LTDAENQ.js";import"../../chunk-5OYPWGMX.js";import"../../chunk-C73NTGFV.js";import"../../chunk-BA36HJOM.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 P=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:y.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j=e=>P({data:e}),b=(e,t=400,n="Bad Request")=>P({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(b(n,s));let a=yield e();r(l(a)).toBe(!0),l(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 u={error:!0,message:g};t.mockResolvedValueOnce(b(u,c));let m=yield e();r(l(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:E.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 l(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function C(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:u="default"}=n,m=g||`userId:integration-${u}-${Date.now()}`,f=yield e.createWallet(p({chainType:o,type:c},g&&{owner:m}));if(C(f))return t.addWallet(f.address),f.address})}function le(e,t,n){return i(this,null,function*(){let s=yield e.createWallet(n);return C(s)&&t.addWallet(s.address),s})}function ue(e,t){r(l(e)).toBe(!0),t&&r(e.message).toBeDefined()}function de(e){r(C(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(l(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=M.APPROVE_TRANSACTION_MAX_RETRIES){var m;for(let f=0;f<s;f++){let d=yield e.getTransaction(t,n);if(l(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:""}))},h=yield e.approveTransaction(t,n,O);if(l(h))throw new Error(`Failed to approve transaction: ${h.message||"Unknown error"}`);yield x(W);continue}yield x(R)}let u=yield e.getTransaction(t,n);if(l(u))throw new Error(`Transaction not found after retries: ${u.message||"Unknown error"}`);if(!("status"in u))throw new Error("Transaction response missing status property");return u}),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(l(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,b as createMockErrorResponse,P as createMockResponse,re as createMockSendResponse,j as createMockSuccessResponse,oe as createMockWalletResponse,Y as createServerSideApiClient,L as createTestApiClient,le as createTestWallet,x as delay,pe as ensureWalletExists,Te as ensureWalletFunded,V as expectCommonHeaders,ue as expectErrorResponse,q as expectRequestBody,N as expectRequestPath,me as expectSuccessTransactionResponse,de as expectSuccessWalletResponse,z as extractFetchCall,I as fundWallet,fe as fundWalletAndWait,l as isErrorResponse,$ as isSuccessTransactionResponse,C 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 _chunkTK2Z4EWOcjs = require('../chunk-TK2Z4EWO.cjs');require('../chunk-OWQZPI3U.cjs');require('../chunk-QJV6W4U2.cjs');require('../chunk-NLO5MHPW.cjs');require('../chunk-2GKPWQBQ.cjs');exports.ApiClient = _chunkTK2Z4EWOcjs.a;
|
package/dist/api/client.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CrossmintApiClient, Crossmint, APIKeyEnvironmentPrefix } from '@crossmint/common-sdk-base';
|
|
2
|
-
import { ad as CreateWalletParams, ac as CreateWalletResponse, a8 as WalletLocator, ai as GetWalletResponse, aj as CreateTransactionParams, ak as CreateTransactionResponse, al as ApproveTransactionParams, am as ApproveTransactionResponse, aa as GetTransactionResponse, an as CreateSignatureParams, ao as CreateSignatureResponse, ap as ApproveSignatureParams, a9 as ApproveSignatureResponse, aq as GetSignatureResponse, a1 as GetTransactionsResponse, ar as GetTransfersResponse, as as GetBalanceResponse, at as FundWalletParams, a0 as FundWalletResponse, au as RegisterSignerParams, av as RegisterSignerResponse, aw as RemoveSignerParams, ax as RemoveSignerResponse, ay as GetSignerResponse, az as SendParams, ab as SendResponse } from '../types-
|
|
2
|
+
import { ad as CreateWalletParams, ac as CreateWalletResponse, a8 as WalletLocator, ai as GetWalletResponse, aj as CreateTransactionParams, ak as CreateTransactionResponse, al as ApproveTransactionParams, am as ApproveTransactionResponse, aa as GetTransactionResponse, an as CreateSignatureParams, ao as CreateSignatureResponse, ap as ApproveSignatureParams, a9 as ApproveSignatureResponse, aq as GetSignatureResponse, a1 as GetTransactionsResponse, ar as GetTransfersResponse, as as GetBalanceResponse, at as FundWalletParams, a0 as FundWalletResponse, au as RegisterSignerParams, av as RegisterSignerResponse, aw as RemoveSignerParams, ax as RemoveSignerResponse, ay as GetSignerResponse, az as SendParams, ab as SendResponse } from '../types-DZWn68Po.cjs';
|
|
3
3
|
import { Chain } from '../chains/chains.cjs';
|
|
4
4
|
import 'viem';
|
|
5
5
|
import './gen/types.gen.cjs';
|
package/dist/api/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CrossmintApiClient, Crossmint, APIKeyEnvironmentPrefix } from '@crossmint/common-sdk-base';
|
|
2
|
-
import { ad as CreateWalletParams, ac as CreateWalletResponse, a8 as WalletLocator, ai as GetWalletResponse, aj as CreateTransactionParams, ak as CreateTransactionResponse, al as ApproveTransactionParams, am as ApproveTransactionResponse, aa as GetTransactionResponse, an as CreateSignatureParams, ao as CreateSignatureResponse, ap as ApproveSignatureParams, a9 as ApproveSignatureResponse, aq as GetSignatureResponse, a1 as GetTransactionsResponse, ar as GetTransfersResponse, as as GetBalanceResponse, at as FundWalletParams, a0 as FundWalletResponse, au as RegisterSignerParams, av as RegisterSignerResponse, aw as RemoveSignerParams, ax as RemoveSignerResponse, ay as GetSignerResponse, az as SendParams, ab as SendResponse } from '../types-
|
|
2
|
+
import { ad as CreateWalletParams, ac as CreateWalletResponse, a8 as WalletLocator, ai as GetWalletResponse, aj as CreateTransactionParams, ak as CreateTransactionResponse, al as ApproveTransactionParams, am as ApproveTransactionResponse, aa as GetTransactionResponse, an as CreateSignatureParams, ao as CreateSignatureResponse, ap as ApproveSignatureParams, a9 as ApproveSignatureResponse, aq as GetSignatureResponse, a1 as GetTransactionsResponse, ar as GetTransfersResponse, as as GetBalanceResponse, at as FundWalletParams, a0 as FundWalletResponse, au as RegisterSignerParams, av as RegisterSignerResponse, aw as RemoveSignerParams, ax as RemoveSignerResponse, ay as GetSignerResponse, az as SendParams, ab as SendResponse } from '../types-CtOIG5sn.js';
|
|
3
3
|
import { Chain } from '../chains/chains.js';
|
|
4
4
|
import 'viem';
|
|
5
5
|
import './gen/types.gen.js';
|
package/dist/api/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-6LTDAENQ.js";import"../chunk-5OYPWGMX.js";import"../chunk-C73NTGFV.js";import"../chunk-BA36HJOM.js";import"../chunk-J3R36SGJ.js";export{a as ApiClient};
|
|
@@ -11403,6 +11403,10 @@ type WalletV1Alpha2ErrorDto = {
|
|
|
11403
11403
|
* Error message
|
|
11404
11404
|
*/
|
|
11405
11405
|
message: string;
|
|
11406
|
+
/**
|
|
11407
|
+
* Optional stable error code identifying the specific failure case. Present when the backend raises a structured error that consumers may want to detect programmatically.
|
|
11408
|
+
*/
|
|
11409
|
+
code?: string;
|
|
11406
11410
|
};
|
|
11407
11411
|
type WalletV1Alpha2TransactionErrorDto = {
|
|
11408
11412
|
/**
|
|
@@ -11403,6 +11403,10 @@ type WalletV1Alpha2ErrorDto = {
|
|
|
11403
11403
|
* Error message
|
|
11404
11404
|
*/
|
|
11405
11405
|
message: string;
|
|
11406
|
+
/**
|
|
11407
|
+
* Optional stable error code identifying the specific failure case. Present when the backend raises a structured error that consumers may want to detect programmatically.
|
|
11408
|
+
*/
|
|
11409
|
+
code?: string;
|
|
11406
11410
|
};
|
|
11407
11411
|
type WalletV1Alpha2TransactionErrorDto = {
|
|
11408
11412
|
/**
|
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 _chunkTK2Z4EWOcjs = require('../chunk-TK2Z4EWO.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-OWQZPI3U.cjs');require('../chunk-QJV6W4U2.cjs');require('../chunk-NLO5MHPW.cjs');require('../chunk-2GKPWQBQ.cjs');exports.ApiClient = _chunkTK2Z4EWOcjs.a;
|
package/dist/api/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ApiClient } from './client.cjs';
|
|
2
|
-
export { ap as ApproveSignatureParams, a9 as ApproveSignatureResponse, al as ApproveTransactionParams, am as ApproveTransactionResponse, an as CreateSignatureParams, ao as CreateSignatureResponse, aj as CreateTransactionParams, ak as CreateTransactionResponse, aA as CreateTransactionSuccessResponse, ad as CreateWalletParams, ac as CreateWalletResponse, at as FundWalletParams, a0 as FundWalletResponse, as as GetBalanceResponse, aB as GetBalanceSuccessResponse, aq as GetSignatureResponse, ay as GetSignerResponse, aC as GetSignersResponse, aa as GetTransactionResponse, a2 as GetTransactionSuccessResponse, a1 as GetTransactionsResponse, ar as GetTransfersResponse, ai as GetWalletResponse, aD as GetWalletSuccessResponse, aE as RecoverySignerConfig, aF as RegisterSignerChain, au as RegisterSignerParams, R as RegisterSignerPasskeyParams, av as RegisterSignerResponse, aw as RemoveSignerParams, ax as RemoveSignerResponse, az as SendParams, ab as SendResponse,
|
|
2
|
+
export { ap as ApproveSignatureParams, a9 as ApproveSignatureResponse, al as ApproveTransactionParams, am as ApproveTransactionResponse, an as CreateSignatureParams, ao as CreateSignatureResponse, aj as CreateTransactionParams, ak as CreateTransactionResponse, aA as CreateTransactionSuccessResponse, ad as CreateWalletParams, ac as CreateWalletResponse, at as FundWalletParams, a0 as FundWalletResponse, as as GetBalanceResponse, aB as GetBalanceSuccessResponse, aq as GetSignatureResponse, ay as GetSignerResponse, aC as GetSignersResponse, aa as GetTransactionResponse, a2 as GetTransactionSuccessResponse, a1 as GetTransactionsResponse, ar as GetTransfersResponse, ai as GetWalletResponse, aD as GetWalletSuccessResponse, aE as RecoverySignerConfig, aF as RegisterSignerChain, au as RegisterSignerParams, R as RegisterSignerPasskeyParams, av as RegisterSignerResponse, aw as RemoveSignerParams, ax as RemoveSignerResponse, az as SendParams, ab as SendResponse, O as Signer, x as Transfers, a8 as WalletLocator } from '../types-DZWn68Po.cjs';
|
|
3
3
|
import '@crossmint/common-sdk-base';
|
|
4
4
|
import '../chains/chains.cjs';
|
|
5
5
|
import 'viem';
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ApiClient } from './client.js';
|
|
2
|
-
export { ap as ApproveSignatureParams, a9 as ApproveSignatureResponse, al as ApproveTransactionParams, am as ApproveTransactionResponse, an as CreateSignatureParams, ao as CreateSignatureResponse, aj as CreateTransactionParams, ak as CreateTransactionResponse, aA as CreateTransactionSuccessResponse, ad as CreateWalletParams, ac as CreateWalletResponse, at as FundWalletParams, a0 as FundWalletResponse, as as GetBalanceResponse, aB as GetBalanceSuccessResponse, aq as GetSignatureResponse, ay as GetSignerResponse, aC as GetSignersResponse, aa as GetTransactionResponse, a2 as GetTransactionSuccessResponse, a1 as GetTransactionsResponse, ar as GetTransfersResponse, ai as GetWalletResponse, aD as GetWalletSuccessResponse, aE as RecoverySignerConfig, aF as RegisterSignerChain, au as RegisterSignerParams, R as RegisterSignerPasskeyParams, av as RegisterSignerResponse, aw as RemoveSignerParams, ax as RemoveSignerResponse, az as SendParams, ab as SendResponse,
|
|
2
|
+
export { ap as ApproveSignatureParams, a9 as ApproveSignatureResponse, al as ApproveTransactionParams, am as ApproveTransactionResponse, an as CreateSignatureParams, ao as CreateSignatureResponse, aj as CreateTransactionParams, ak as CreateTransactionResponse, aA as CreateTransactionSuccessResponse, ad as CreateWalletParams, ac as CreateWalletResponse, at as FundWalletParams, a0 as FundWalletResponse, as as GetBalanceResponse, aB as GetBalanceSuccessResponse, aq as GetSignatureResponse, ay as GetSignerResponse, aC as GetSignersResponse, aa as GetTransactionResponse, a2 as GetTransactionSuccessResponse, a1 as GetTransactionsResponse, ar as GetTransfersResponse, ai as GetWalletResponse, aD as GetWalletSuccessResponse, aE as RecoverySignerConfig, aF as RegisterSignerChain, au as RegisterSignerParams, R as RegisterSignerPasskeyParams, av as RegisterSignerResponse, aw as RemoveSignerParams, ax as RemoveSignerResponse, az as SendParams, ab as SendResponse, O as Signer, x as Transfers, a8 as WalletLocator } from '../types-CtOIG5sn.js';
|
|
3
3
|
import '@crossmint/common-sdk-base';
|
|
4
4
|
import '../chains/chains.js';
|
|
5
5
|
import 'viem';
|
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-6LTDAENQ.js";import"../chunk-KBJA7JDT.js";import"../chunk-5OYPWGMX.js";import"../chunk-C73NTGFV.js";import"../chunk-BA36HJOM.js";import"../chunk-J3R36SGJ.js";export{a as ApiClient};
|
package/dist/api/types.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'viem';
|
|
2
2
|
import './gen/types.gen.cjs';
|
|
3
|
-
export { ap as ApproveSignatureParams, a9 as ApproveSignatureResponse, al as ApproveTransactionParams, am as ApproveTransactionResponse, an as CreateSignatureParams, ao as CreateSignatureResponse, aj as CreateTransactionParams, ak as CreateTransactionResponse, aA as CreateTransactionSuccessResponse, ad as CreateWalletParams, ac as CreateWalletResponse, at as FundWalletParams, a0 as FundWalletResponse, as as GetBalanceResponse, aB as GetBalanceSuccessResponse, aq as GetSignatureResponse, ay as GetSignerResponse, aC as GetSignersResponse, aa as GetTransactionResponse, a2 as GetTransactionSuccessResponse, a1 as GetTransactionsResponse, ar as GetTransfersResponse, ai as GetWalletResponse, aD as GetWalletSuccessResponse, aE as RecoverySignerConfig, aF as RegisterSignerChain, au as RegisterSignerParams, R as RegisterSignerPasskeyParams, av as RegisterSignerResponse, aw as RemoveSignerParams, ax as RemoveSignerResponse, az as SendParams, ab as SendResponse,
|
|
3
|
+
export { ap as ApproveSignatureParams, a9 as ApproveSignatureResponse, al as ApproveTransactionParams, am as ApproveTransactionResponse, an as CreateSignatureParams, ao as CreateSignatureResponse, aj as CreateTransactionParams, ak as CreateTransactionResponse, aA as CreateTransactionSuccessResponse, ad as CreateWalletParams, ac as CreateWalletResponse, at as FundWalletParams, a0 as FundWalletResponse, as as GetBalanceResponse, aB as GetBalanceSuccessResponse, aq as GetSignatureResponse, ay as GetSignerResponse, aC as GetSignersResponse, aa as GetTransactionResponse, a2 as GetTransactionSuccessResponse, a1 as GetTransactionsResponse, ar as GetTransfersResponse, ai as GetWalletResponse, aD as GetWalletSuccessResponse, aE as RecoverySignerConfig, aF as RegisterSignerChain, au as RegisterSignerParams, R as RegisterSignerPasskeyParams, av as RegisterSignerResponse, aw as RemoveSignerParams, ax as RemoveSignerResponse, az as SendParams, ab as SendResponse, O as Signer, x as Transfers, a8 as WalletLocator } from '../types-DZWn68Po.cjs';
|
|
4
4
|
import '../chains/chains.cjs';
|
|
5
5
|
import 'ox';
|
|
6
6
|
import '@crossmint/client-sdk-window';
|
package/dist/api/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'viem';
|
|
2
2
|
import './gen/types.gen.js';
|
|
3
|
-
export { ap as ApproveSignatureParams, a9 as ApproveSignatureResponse, al as ApproveTransactionParams, am as ApproveTransactionResponse, an as CreateSignatureParams, ao as CreateSignatureResponse, aj as CreateTransactionParams, ak as CreateTransactionResponse, aA as CreateTransactionSuccessResponse, ad as CreateWalletParams, ac as CreateWalletResponse, at as FundWalletParams, a0 as FundWalletResponse, as as GetBalanceResponse, aB as GetBalanceSuccessResponse, aq as GetSignatureResponse, ay as GetSignerResponse, aC as GetSignersResponse, aa as GetTransactionResponse, a2 as GetTransactionSuccessResponse, a1 as GetTransactionsResponse, ar as GetTransfersResponse, ai as GetWalletResponse, aD as GetWalletSuccessResponse, aE as RecoverySignerConfig, aF as RegisterSignerChain, au as RegisterSignerParams, R as RegisterSignerPasskeyParams, av as RegisterSignerResponse, aw as RemoveSignerParams, ax as RemoveSignerResponse, az as SendParams, ab as SendResponse,
|
|
3
|
+
export { ap as ApproveSignatureParams, a9 as ApproveSignatureResponse, al as ApproveTransactionParams, am as ApproveTransactionResponse, an as CreateSignatureParams, ao as CreateSignatureResponse, aj as CreateTransactionParams, ak as CreateTransactionResponse, aA as CreateTransactionSuccessResponse, ad as CreateWalletParams, ac as CreateWalletResponse, at as FundWalletParams, a0 as FundWalletResponse, as as GetBalanceResponse, aB as GetBalanceSuccessResponse, aq as GetSignatureResponse, ay as GetSignerResponse, aC as GetSignersResponse, aa as GetTransactionResponse, a2 as GetTransactionSuccessResponse, a1 as GetTransactionsResponse, ar as GetTransfersResponse, ai as GetWalletResponse, aD as GetWalletSuccessResponse, aE as RecoverySignerConfig, aF as RegisterSignerChain, au as RegisterSignerParams, R as RegisterSignerPasskeyParams, av as RegisterSignerResponse, aw as RemoveSignerParams, ax as RemoveSignerResponse, az as SendParams, ab as SendResponse, O as Signer, x as Transfers, a8 as WalletLocator } from '../types-CtOIG5sn.js';
|
|
4
4
|
import '../chains/chains.js';
|
|
5
5
|
import 'ox';
|
|
6
6
|
import '@crossmint/client-sdk-window';
|
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 _chunkQJC54AMLcjs = require('../chunk-QJC54AML.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-OWQZPI3U.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-QJV6W4U2.cjs');require('../chunk-NLO5MHPW.cjs');require('../chunk-2GKPWQBQ.cjs');exports.isMainnetChain = _chunkQJC54AMLcjs.c; exports.isTestnetChain = _chunkQJC54AMLcjs.b; exports.isValidChain = _chunkQJC54AMLcjs.e; exports.mainnetToTestnet = _chunkQJC54AMLcjs.d; exports.toViemChain = _chunkQJC54AMLcjs.a; exports.validateChainForEnvironment = _chunkQJC54AMLcjs.f;
|
package/dist/chains/chains.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f}from"../chunk-MILCZTHF.js";import"../chunk-S3DYQVRD.js";import"../chunk-KUP7H7X2.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-5OYPWGMX.js";import"../chunk-455NK5LB.js";import"../chunk-C73NTGFV.js";import"../chunk-BA36HJOM.js";import"../chunk-J3R36SGJ.js";export{c as isMainnetChain,b as isTestnetChain,e as isValidChain,d as mainnetToTestnet,a as toViemChain,f as validateChainForEnvironment};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"./chunk-2YLRFJ66.js";import{
|
|
1
|
+
import{a as s}from"./chunk-2YLRFJ66.js";import{B as a}from"./chunk-5OYPWGMX.js";import{g as e}from"./chunk-J3R36SGJ.js";import{PublicKey as h,VersionedTransaction as f}from"@solana/web3.js";import o from"bs58";var l=class extends s{constructor(n){super(n),this.onSign=n.onSign}signMessage(){return e(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for solana external wallet signer"))})}signTransaction(n){return e(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=o.decode(n),g=f.deserialize(c),t=yield this.onSign(g),d=new h(this._address),i=t.message.staticAccountKeys.findIndex(m=>m.equals(d));if(i===-1)throw new a("Wallet public key not found in transaction signers");let r=t.signatures[i];if(r==null)throw new a("No valid signature found in the transaction");let u=new Uint8Array(Object.values(r));return{signature:o.encode(u)}})}};export{l as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,b as o}from"./chunk-
|
|
1
|
+
import{a as s,b as o}from"./chunk-A73HLVAF.js";import{a as r}from"./chunk-C73NTGFV.js";import{g as t}from"./chunk-J3R36SGJ.js";var a=class g extends s{constructor(n){super(n)}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(n){return t(this,null,function*(){var i;yield this.handleAuthRequired();let c=this.getJwtOrThrow();r.info("sign: sending request",{keyType:"ed25519"});let d=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:c,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:n,encoding:"base64"}},options:o});if(r.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-d}),(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");if(g.verifyPublicKeyFormat(e.publicKey),e.signature.encoding!=="base64")throw new Error("Wrong encoding for signature. Expected base64, got "+e.signature.encoding);return{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base64"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base64 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"strkey"}}};export{a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkENU3EKBGcjs = require('./chunk-ENU3EKBG.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkENU3EKBGcjs = require('./chunk-ENU3EKBG.cjs');var _chunk5FH7WFWLcjs = require('./chunk-5FH7WFWL.cjs');var _chunkYGL4ITFKcjs = require('./chunk-YGL4ITFK.cjs');var _accounts = require('viem/accounts');var _utils = require('@noble/hashes/utils');var _web3js = require('@solana/web3.js');function v(r,e){switch(_chunkENU3EKBGcjs.a.call(void 0, e)){case"evm":return _accounts.privateKeyToAccount.call(void 0, `0x${_utils.bytesToHex.call(void 0, r)}`).address;case"solana":return _web3js.Keypair.fromSeed(r).publicKey.toBase58();case"stellar":return _chunk5FH7WFWLcjs.a.call(void 0, _chunk5FH7WFWLcjs.b.call(void 0, r).publicKey)}}function C(r,e,i,a){if(typeof window!="undefined")throw new Error("Server signers can only be used from server-side code.");let p=typeof e=="string"?e:String(e),t=_chunkYGL4ITFKcjs.a.call(void 0, r.secret,i,a,p),c=v(t,e);return{derivedKeyBytes:t,derivedAddress:c}}exports.a = v; exports.b = C;
|
|
@@ -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)}},I=class extends t{constructor(s,r){super(s,e.WALLET_CREATION_FAILED,r)}},p=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)}},x=class extends t{constructor(s,r){super(s,e.WALLET_NOT_AVAILABLE,r)}},A=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)}},K="DEVICE_SIGNER_NOT_SUPPORTED",E=class extends t{constructor(s,r){super(s,e.SIGNER_INVALID,r)}},_=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)}},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.SIGNING_FAILED,r)}},d=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)}},S=class extends t{constructor(s,r){super(s,e.SIGNING_FAILED,r)}},R=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)}},C=class extends t{constructor(s,r){super(s,e.NO_TRANSACTION,r)}},G=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)}},F=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)}},W=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}},U=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,I as c,p as d,i as e,x as f,A as g,g as h,u as i,N as j,K as k,E as l,_ as m,L as n,T as o,l as p,a as q,d as r,D as s,S as t,R as u,O as v,C as w,G as x,V as y,F as z,P as A,W as B,U as C,m as D};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOWQZPI3Ucjs = require('./chunk-OWQZPI3U.cjs');var _commonsdkauth = require('@crossmint/common-sdk-auth');var m=(n,t,o)=>`Wallet signer configuration mismatch at "${n}" - expected "${o}" from existing wallet but found "${t}"`;function u(n){let o=n.toLowerCase().split("@"),r=o[1],i=r==="googlemail.com",e=(i||r==="gmail.com")&&o[0].includes(".");return i&&(o[1]="gmail.com"),e&&(o[0]=o[0].replace(/\./g,"")),`${o[0]}@${o[1]}`}function f(n){return/^0x[0-9a-fA-F]+$/.test(n)?BigInt(n).toString():n}function l(n,t=""){if(typeof n=="string"){if(_commonsdkauth.isEmailValid.call(void 0, n))return u(n);if(t.endsWith(".x")||t.endsWith(".y"))return f(n)}return n}function d(n,t,o=""){if(n!==t){if(n==null||t==null)throw new Error(`Cannot compare null or undefined signer configs at path: ${o}`);for(let r of Object.keys(n)){if(!(r in t))continue;let i=o?`${o}.${r}`:r,s=n[r],e=t[r];if(typeof s=="object"&&s!==null&&typeof e=="object"&&e!==null)d(s,e,i);else if(l(s,i)!==l(e,i))throw new (0, _chunkOWQZPI3Ucjs.g)(m(i,s,e))}}}exports.a = l; exports.b = d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-5OYPWGMX.js";import{a}from"./chunk-C73NTGFV.js";import{b as p,c}from"./chunk-BA36HJOM.js";import{g as t}from"./chunk-J3R36SGJ.js";import{APIKeyEnvironmentPrefix as d,APIKeyUsageOrigin as g,CrossmintApiClient as P}from"@crossmint/common-sdk-base";var h=class extends P{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:c,version:p}}});this.apiPrefix="api/2025-06-09/wallets";this.unstableApiPrefix="api/unstable/wallets"}createWallet(e){return t(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;a.info("wallets.api.createWallet",{chainType:e.chainType,walletType:e.type});let n=yield(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json();return"error"in n?a.error("wallets.api.createWallet.error",{error:n.error,chainType:e.chainType}):"address"in n&&a.info("wallets.api.createWallet.success",{address:n.address,chainType:e.chainType}),n})}getWallet(e){return t(this,null,function*(){a.info("wallets.api.getWallet",{locator:e});let r=yield(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json();return"error"in r?a.warn("wallets.api.getWallet.error",{locator:e,error:r.error}):"address"in r&&a.info("wallets.api.getWallet.success",{address:r.address,locator:e}),r})}createTransaction(e,s){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,r){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers})).json()})}getTransaction(e,s){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,r){return t(this,null,function*(){let n=yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers});return n.status===422?this.getSignature(e,s):n.json()})}getSignature(e,s){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}getNfts(e){return t(this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let r=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${r}/nfts?${s.toString()}`,{headers:this.headers})).json()})}getTransfers(e,s){return t(this,null,function*(){let r=new URLSearchParams;return r.append("chain",s.chain.toString()),s.tokens!=null&&r.append("tokens",s.tokens),r.append("status",s.status),(yield this.get(`${this.unstableApiPrefix}/${e}/transfers?${r.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return t(this,null,function*(){let r=new URLSearchParams;return r.append("tokens",s.tokens.join(",")),r.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${r.toString()}`,{headers:this.headers})).json()})}fundWallet(e,s){return t(this,null,function*(){if(this.environment===d.PRODUCTION)throw new Error("Funding wallets is only supported in staging environment");return(yield this.post(`api/v1-alpha2/wallets/${e}/balances`,{body:JSON.stringify(s),headers:this.headers})).json()})}registerSigner(e,s){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}removeSigner(e,s,r){return t(this,null,function*(){let n=encodeURIComponent(s),i=new URLSearchParams;r.chain&&i.append("chain",r.chain);let l=`${this.apiPrefix}/${e}/signers/${n}${i.size>0?`?${i.toString()}`:""}`;return(yield this.delete(l,{headers:this.headers})).json()})}getSigner(e,s){return t(this,null,function*(){let r=encodeURIComponent(s);return(yield this.get(`${this.apiPrefix}/${e}/signers/${r}`,{headers:this.headers})).json()})}send(e,s,r){return t(this,null,function*(){a.info("wallets.api.send",{walletLocator:e,tokenLocator:s,recipient:r.recipient});let i=yield(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(r),headers:this.headers})).json();return"error"in i?a.error("wallets.api.send.error",{walletLocator:e,tokenLocator:s,error:i.error}):"id"in i&&a.info("wallets.api.send.success",{walletLocator:e,transactionId:i.id}),i})}get isServerSide(){return this.parsedAPIKey.usageOrigin===g.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};export{h as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVJEQU7S4cjs = require('./chunk-VJEQU7S4.cjs');var _chunk3VSFHDFHcjs = require('./chunk-3VSFHDFH.cjs');var _chunkOWQZPI3Ucjs = require('./chunk-OWQZPI3U.cjs');var _chunkQJV6W4U2cjs = require('./chunk-QJV6W4U2.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var y=409,l=class l extends _chunkVJEQU7S4cjs.a{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:_chunkVJEQU7S4cjs.a.getOptions(e),alias:e.alias,recovery:_chunkVJEQU7S4cjs.a.getRecovery(e),signer:e.signer,signers:_chunkVJEQU7S4cjs.a.getInitialSigners(e)},_chunkVJEQU7S4cjs.a.getApiClient(e))}static from(e){if(!_commonsdkbase.isValidStellarAddress.call(void 0, e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var d;_chunkQJV6W4U2cjs.a.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let a=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return _chunkQJV6W4U2cjs.a.info("stellarWallet.sendTransaction.prepared",{transactionId:a.id}),{hash:void 0,explorerLink:void 0,transactionId:a.id};let r={},n=yield this.approveTransactionAndWait(a.id,r);return _chunkQJV6W4U2cjs.a.info("stellarWallet.sendTransaction.success",{transactionId:a.id,hash:n.hash}),n})}upgrade(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkQJV6W4U2cjs.a.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let a=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(a!=null){if(e!=null&&e.prepareOnly)return _chunkQJV6W4U2cjs.a.info("stellarWallet.upgrade.prepared",{transactionId:a}),{hash:void 0,explorerLink:void 0,transactionId:a};yield this.approveTransactionAndWait(a),_chunkQJV6W4U2cjs.a.info("stellarWallet.upgrade.phase1.success",{transactionId:a})}else _chunkQJV6W4U2cjs.a.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let r=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return _chunkQJV6W4U2cjs.a.info("stellarWallet.upgrade.success",{transactionId:r.transactionId,hash:r.hash}),r})}migrate(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkQJV6W4U2cjs.a.info("stellarWallet.migrate.start");let a=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(a==null)throw new (0, _chunkOWQZPI3Ucjs.v)("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return _chunkQJV6W4U2cjs.a.info("stellarWallet.migrate.prepared",{transactionId:a}),{hash:void 0,explorerLink:void 0,transactionId:a};let r=yield this.approveTransactionAndWait(a);return _chunkQJV6W4U2cjs.a.info("stellarWallet.migrate.success",{transactionId:a,hash:r.hash}),r})}createTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let{contractId:a,options:r}=e,n=this.resolveStellarSigner(r==null?void 0:r.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:a}:{type:"contract-call",contractId:a,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new (0, _chunkOWQZPI3Ucjs.v)(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,a){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let r=(a==null?void 0:a.signer)!=null?this.resolveStellarSigner(a.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:_chunk2GKPWQBQcjs.a.call(void 0, {transaction:{type:e}},r!=null?{signer:r}:{})});if("error"in n){if(e==="upgrade-wallet"&&S(n))return null;throw new (0, _chunkOWQZPI3Ucjs.v)(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.requireSigner().locator():typeof e=="string"?e:`server:${_chunk3VSFHDFHcjs.b.call(void 0, e,this.chain,this.apiClient.projectId,this.apiClient.environment).derivedAddress}`}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQJV6W4U2cjs.a,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQJV6W4U2cjs.a,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQJV6W4U2cjs.a,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var T=l;function S(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===y}exports.a = T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBQYPF4FScjs = require('./chunk-BQYPF4FS.cjs');var _chunkQJV6W4U2cjs = require('./chunk-QJV6W4U2.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _ox = require('ox');var _viem = require('viem');var c=class p extends _chunkBQYPF4FScjs.a{constructor(e){super(e)}signMessage(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let i=_viem.isHex.call(void 0, e)?e:_viem.toHex.call(void 0, e),r=_ox.PersonalMessage.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.sign(e)})}sign(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");_chunkQJV6W4U2cjs.a.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:_chunkBQYPF4FScjs.b});if(_chunkQJV6W4U2cjs.a.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"}}};exports.a = c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g}from"./chunk-O6VBO7KG.js";import{a as l}from"./chunk-6RX65NOA.js";import{a as o}from"./chunk-
|
|
1
|
+
import{a as g}from"./chunk-O6VBO7KG.js";import{a as l}from"./chunk-6RX65NOA.js";import{a as o}from"./chunk-C73NTGFV.js";import{c as m,g as h}from"./chunk-J3R36SGJ.js";import{validateAPIKey as p,WithLoggerContext as w}from"@crossmint/common-sdk-base";var f=class{constructor(i){this.config=i;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return h(this,null,function*(){try{if(this.config.clientTEEConnection==null){let i=p(this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new g({environment:i.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return h(this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return h(this,null,function*(){o.info("TEE connection not initialized, initializing now");let i=p(this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new g({environment:i.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");o.info("TEE connection initialized successfully")})}handleAuthRequired(){return h(this,null,function*(){var u;let i=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);o.info("get-status: sending request");let t=Date.now(),r=yield i.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(u=this.config.crossmint.jwt)!=null?u:"",apiKey:this.config.crossmint.apiKey}},options:d}),n=Date.now()-t;if((r==null?void 0:r.status)!=="success")throw o.error("get-status: failed",{status:r==null?void 0:r.status,error:r==null?void 0:r.error,durationMs:n}),new Error(r==null?void 0:r.error);if(o.info("get-status: response received",{signerStatus:r.signerStatus,durationMs:n}),r.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;o.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:a,resolve:s,reject:c}=this.createAuthPromise();if(this._authPromise={promise:a,resolve:s,reject:c},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>h(this,null,function*(){o.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new l)})),c(new l)}))}catch(e){o.error("handleAuthRequired error",{error:e}),c(e)}try{yield a}catch(e){throw o.error("handleAuthRequired promise error",{error:e}),e}})}ensureAuthenticated(){return h(this,null,function*(){yield this.handleAuthRequired()})}getJwtOrThrow(){let i=this.config.crossmint.jwt;if(i==null)throw new Error("JWT is required");return i}createAuthPromise(){let i,t;return{promise:new Promise((n,a)=>{i=n,t=a}),resolve:i,reject:t}}sendMessageWithOtp(){return h(this,null,function*(){var s,c;let i=yield this.getTEEConnection(),t=this.getAuthId();o.info("start-onboarding: sending request");let r=Date.now(),n=yield i.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{authId:t}},options:d}),a=Date.now()-r;if(o.info("start-onboarding: response received",{status:n==null?void 0:n.status,durationMs:a}),(n==null?void 0:n.status)==="success"&&n.signerStatus==="ready"){this._needsAuth=!1;return}(n==null?void 0:n.status)==="error"&&(o.error("start-onboarding: failed",{error:n.error}),(c=this._authPromise)==null||c.reject(new Error(n.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(i){return h(this,null,function*(){var a,s,c,u;let t;try{let e=yield this.getTEEConnection();o.info("complete-onboarding: sending request");let E=Date.now();t=yield e.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(a=this.config.crossmint.jwt)!=null?a:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:i}}},options:d}),o.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-E})}catch(e){throw o.error("complete-onboarding: error",{error:e}),this._needsAuth=!0,(s=this._authPromise)==null||s.reject(e),e}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new l)})),(c=this._authPromise)==null||c.resolve();return}o.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status}),this._needsAuth=!0;let r=(t==null?void 0:t.status)==="error"?t.error:"Failed to validate encrypted OTP",n=new Error(r);throw(u=this._authPromise)==null||u.reject(n),n})}_exportPrivateKey(i,t){return h(this,null,function*(){yield this.handleAuthRequired();let r=this.getJwtOrThrow(),{scheme:n,encoding:a}=this.getChainKeyParams();if(t!=null){let c=i.on("event:key-exported",u=>{i.off(c),u.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let s=yield i.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:r,apiKey:this.config.crossmint.apiKey},data:{scheme:n,encoding:a}},options:d});if((s==null?void 0:s.status)==="error")throw new Error(s.error||"Failed to export private key")})}};m([w({logger:o,methodName:"handleAuthRequired"})],f.prototype,"handleAuthRequired",1);var d={timeoutMs:3e4};export{f as a,d as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v}from"./chunk-IOSADDL5.js";import{a as l}from"./chunk-
|
|
1
|
+
import{a as v}from"./chunk-IOSADDL5.js";import{a as l}from"./chunk-C73NTGFV.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s="@crossmint/wallets-sdk",t="1.2.0";var c="WALLETS_SDK",r=t,a=s,d=500;export{c as a,r as b,a as c,d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJBP52JOHcjs = require('./chunk-JBP52JOH.cjs');var _chunkAS2YN2YCcjs = require('./chunk-AS2YN2YC.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJBP52JOHcjs = require('./chunk-JBP52JOH.cjs');var _chunkAS2YN2YCcjs = require('./chunk-AS2YN2YC.cjs');var _chunkQJV6W4U2cjs = require('./chunk-QJV6W4U2.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var f=class{constructor(i){this.config=i;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){try{if(this.config.clientTEEConnection==null){let i=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new (0, _chunkJBP52JOHcjs.a)({environment:i.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkQJV6W4U2cjs.a.info("TEE connection not initialized, initializing now");let i=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new (0, _chunkJBP52JOHcjs.a)({environment:i.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");_chunkQJV6W4U2cjs.a.info("TEE connection initialized successfully")})}handleAuthRequired(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var u;let i=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);_chunkQJV6W4U2cjs.a.info("get-status: sending request");let t=Date.now(),r=yield i.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(u=this.config.crossmint.jwt)!=null?u:"",apiKey:this.config.crossmint.apiKey}},options:d}),n=Date.now()-t;if((r==null?void 0:r.status)!=="success")throw _chunkQJV6W4U2cjs.a.error("get-status: failed",{status:r==null?void 0:r.status,error:r==null?void 0:r.error,durationMs:n}),new Error(r==null?void 0:r.error);if(_chunkQJV6W4U2cjs.a.info("get-status: response received",{signerStatus:r.signerStatus,durationMs:n}),r.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;_chunkQJV6W4U2cjs.a.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:a,resolve:s,reject:c}=this.createAuthPromise();if(this._authPromise={promise:a,resolve:s,reject:c},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkQJV6W4U2cjs.a.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new _chunkAS2YN2YCcjs.a)})),c(new _chunkAS2YN2YCcjs.a)}))}catch(e){_chunkQJV6W4U2cjs.a.error("handleAuthRequired error",{error:e}),c(e)}try{yield a}catch(e){throw _chunkQJV6W4U2cjs.a.error("handleAuthRequired promise error",{error:e}),e}})}ensureAuthenticated(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.handleAuthRequired()})}getJwtOrThrow(){let i=this.config.crossmint.jwt;if(i==null)throw new Error("JWT is required");return i}createAuthPromise(){let i,t;return{promise:new Promise((n,a)=>{i=n,t=a}),resolve:i,reject:t}}sendMessageWithOtp(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var s,c;let i=yield this.getTEEConnection(),t=this.getAuthId();_chunkQJV6W4U2cjs.a.info("start-onboarding: sending request");let r=Date.now(),n=yield i.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{authId:t}},options:d}),a=Date.now()-r;if(_chunkQJV6W4U2cjs.a.info("start-onboarding: response received",{status:n==null?void 0:n.status,durationMs:a}),(n==null?void 0:n.status)==="success"&&n.signerStatus==="ready"){this._needsAuth=!1;return}(n==null?void 0:n.status)==="error"&&(_chunkQJV6W4U2cjs.a.error("start-onboarding: failed",{error:n.error}),(c=this._authPromise)==null||c.reject(new Error(n.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(i){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var a,s,c,u;let t;try{let e=yield this.getTEEConnection();_chunkQJV6W4U2cjs.a.info("complete-onboarding: sending request");let E=Date.now();t=yield e.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(a=this.config.crossmint.jwt)!=null?a:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:i}}},options:d}),_chunkQJV6W4U2cjs.a.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-E})}catch(e){throw _chunkQJV6W4U2cjs.a.error("complete-onboarding: error",{error:e}),this._needsAuth=!0,(s=this._authPromise)==null||s.reject(e),e}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new _chunkAS2YN2YCcjs.a)})),(c=this._authPromise)==null||c.resolve();return}_chunkQJV6W4U2cjs.a.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status}),this._needsAuth=!0;let r=(t==null?void 0:t.status)==="error"?t.error:"Failed to validate encrypted OTP",n=new Error(r);throw(u=this._authPromise)==null||u.reject(n),n})}_exportPrivateKey(i,t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.handleAuthRequired();let r=this.getJwtOrThrow(),{scheme:n,encoding:a}=this.getChainKeyParams();if(t!=null){let c=i.on("event:key-exported",u=>{i.off(c),u.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let s=yield i.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:r,apiKey:this.config.crossmint.apiKey},data:{scheme:n,encoding:a}},options:d});if((s==null?void 0:s.status)==="error")throw new Error(s.error||"Failed to export private key")})}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQJV6W4U2cjs.a,methodName:"handleAuthRequired"})],f.prototype,"handleAuthRequired",1);var d={timeoutMs:3e4};exports.a = f; exports.b = d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as i}from"./chunk-
|
|
1
|
+
import{b as n,c as i}from"./chunk-BA36HJOM.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,b as o}from"./chunk-
|
|
1
|
+
import{a as s,b as o}from"./chunk-A73HLVAF.js";import{a as r}from"./chunk-C73NTGFV.js";import{g as t}from"./chunk-J3R36SGJ.js";import{VersionedTransaction as u}from"@solana/web3.js";import a from"bs58";var g=class c extends s{constructor(n){super(n)}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(n){return t(this,null,function*(){var i;yield this.handleAuthRequired();let d=this.getJwtOrThrow(),m=a.decode(n),y=u.deserialize(m).message.serialize();r.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:a.encode(new Uint8Array(y)),encoding:"base58"}},options:o});if(r.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"}}};export{g 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 _chunkOWQZPI3Ucjs = require('./chunk-OWQZPI3U.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, _chunkOWQZPI3Ucjs.B)("Wallet public key not found in transaction signers");let r=t.signatures[i];if(r==null)throw new (0, _chunkOWQZPI3Ucjs.B)("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
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6EUBBDIVcjs = require('./chunk-6EUBBDIV.cjs');var _chunkVJEQU7S4cjs = require('./chunk-VJEQU7S4.cjs');var _chunkYHV3672Rcjs = require('./chunk-YHV3672R.cjs');var _chunkNX256LAHcjs = require('./chunk-NX256LAH.cjs');var _chunk3VSFHDFHcjs = require('./chunk-3VSFHDFH.cjs');var _chunkQJC54AMLcjs = require('./chunk-QJC54AML.cjs');var _chunkOWQZPI3Ucjs = require('./chunk-OWQZPI3U.cjs');var _chunkQJV6W4U2cjs = require('./chunk-QJV6W4U2.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('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= exports.a =class{constructor(t){this.apiClient=t}getWallet(t,e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let i,a;if(typeof t=="string"){if(!this.apiClient.isServerSide)throw new (0, _chunkOWQZPI3Ucjs.g)("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(e==null)throw new (0, _chunkOWQZPI3Ucjs.g)("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");i=t,a=e}else{if(this.apiClient.isServerSide)throw new (0, _chunkOWQZPI3Ucjs.g)("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");a=t,i=this.getWalletLocator(a)}let n=_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},a),{chain:_chunkQJC54AMLcjs.f.call(void 0, a.chain,this.apiClient.environment)});_chunkQJV6W4U2cjs.a.info("walletFactory.getWallet.start");let r=yield this.apiClient.getWallet(i);if("error"in r)throw _chunkQJV6W4U2cjs.a.warn("walletFactory.getWallet.notFound",{error:r.error}),new (0, _chunkOWQZPI3Ucjs.e)(JSON.stringify(r));return _chunkQJV6W4U2cjs.a.info("walletFactory.getWallet.success",{address:r.address}),yield this.createWalletInstance(r,n)})}createWallet(t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var o,c,w,W,A,k,F,P;let e=_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},t),{chain:_chunkQJC54AMLcjs.f.call(void 0, t.chain,this.apiClient.environment)});if(yield(w=(c=(o=e.options)==null?void 0:o.callbacks)==null?void 0:c.onWalletCreationStart)==null?void 0:w.call(c),_chunkQJV6W4U2cjs.a.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&e.owner!=null)throw _chunkQJV6W4U2cjs.a.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new (0, _chunkOWQZPI3Ucjs.g)("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let a=((W=e.options)==null?void 0:W.deviceSignerKeyStorage)!=null&&e.chain!=="solana"?this.ensureDeviceSignerInSigners(e):(A=e.signers)!=null?A:[],n=yield this.registerSigners(a,e.chain,(k=e.options)==null?void 0:k.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:$}=_chunk3VSFHDFHcjs.b.call(void 0, e.recovery,e.chain,this.apiClient.projectId,this.apiClient.environment);r={type:"server",address:$}}else r=e.recovery;let s=yield this.apiClient.createWallet({type:"smart",chainType:this.getChainType(e.chain),config:_chunk2GKPWQBQcjs.a.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {adminSigner:r},e.plugins?{plugins:e.plugins}:{}),n!=null?{delegatedSigners:n}:{}),owner:(F=e.owner)!=null?F:void 0,alias:(P=e.alias)!=null?P:void 0});if("error"in s)throw _chunkQJV6W4U2cjs.a.error("walletFactory.createWallet.error",{error:s.error}),new (0, _chunkOWQZPI3Ucjs.g)(JSON.stringify(s));return _chunkQJV6W4U2cjs.a.info("walletFactory.createWallet.success",{address:s.address}),yield this.createWalletInstance(s,e)})}createWalletInstance(t,e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var o,c;this.validateExistingWalletConfig(t,e);let i=e,a=t.config.adminSigner,n=((o=i.recovery)==null?void 0:o.type)==="server"||((c=i.recovery)==null?void 0:c.type)==="external-wallet"?i.recovery:a,r=t.config.delegatedSigners;r!=null&&r.length===1&&(r[0].type==="server"||r[0].type==="external-wallet")&&(r=i.signers);let s=new (0, _chunkVJEQU7S4cjs.a)({chain:e.chain,address:t.address,owner:t.owner,options:e.options,alias:e.alias,recovery:n,signers:r!=null?r:[]},this.apiClient);return yield s.waitForInit(),s})}getWalletLocator(t){return`me:${this.getChainType(t.chain)}:smart`+(t.alias!=null?`:alias:${t.alias}`:"")}createPasskeySigner(t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var a;if(t.type!=="passkey")throw new Error("Signer is not a passkey");let e=(a=t.name)!=null?a:`Crossmint Wallet ${Date.now()}`,i=t.onCreatePasskey?yield t.onCreatePasskey(e):yield _ox.WebAuthnP256.createCredential({name:e});return{type:"passkey",id:i.id,name:e,publicKey:{x:i.publicKey.x.toString(),y:i.publicKey.y.toString()}}})}ensureDeviceSignerInSigners(t){var a;let e=(a=t.signers)!=null?a:[];return e.some(n=>n.type==="device")?e:[...e,{type:"device"}]}validateExistingWalletConfig(t,e){if(e.owner!=null&&t.owner!=null&&_chunk6EUBBDIVcjs.a.call(void 0, e.owner)!==_chunk6EUBBDIVcjs.a.call(void 0, t.owner))throw new (0, _chunkOWQZPI3Ucjs.g)("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 (0, _chunkOWQZPI3Ucjs.g)(`Wallet chain does not match existing wallet's chain. You must use chain: ${t.chainType}.`);if(t.type!=="smart")return;let i=e;if(i.recovery!=null||i.signers!=null){let a=t.config,n=a==null?void 0:a.adminSigner;if(i.recovery!=null&&n!=null){if(i.recovery.type!==n.type)throw new (0, _chunkOWQZPI3Ucjs.g)("The wallet recovery signer type does not match the existing wallet's recovery signer type");_chunk6EUBBDIVcjs.b.call(void 0, i.recovery,n)}let r=i.signers;r!=null&&this.validateSigners(t,r,e.chain)}}validateSigners(t,e,i){let a=t.config,n=a==null?void 0:a.delegatedSigners;if(e.length!==0){if(n==null||n.length===0)throw new (0, _chunkOWQZPI3Ucjs.g)(`${e.length} signer(s) specified, but wallet "${t.address}" has no signers. ${D}`);for(let r of e){let s=n.find(o=>{if(this.isMatchingPasskeySigner(r,o,a)||o.type==="device"&&r.type==="device")return!0;if(r.type==="server"){let{derivedAddress:c}=_chunk3VSFHDFHcjs.b.call(void 0, r,i,this.apiClient.projectId,this.apiClient.environment);return o.locator===`server:${c}`}return o.locator===_chunkNX256LAHcjs.a.call(void 0, r)});if(s==null){let o=n.map(c=>c.locator).join(", ");throw new (0, _chunkOWQZPI3Ucjs.g)(`Signer '${r.type}' does not exist in wallet "${t.address}". Available signers: ${o}. ${D}`)}_chunk6EUBBDIVcjs.b.call(void 0, r,s)}}}isMatchingPasskeySigner(t,e,i){var n,r;let a=((r=(n=i.delegatedSigners)==null?void 0:n.filter(s=>s.type==="passkey").length)!=null?r:0)+(i.adminSigner.type==="passkey"?1:0);if(t.type==="passkey"){if(t.id==null&&a===1)return e.type==="passkey";if(t.id==null&&a>1)throw new (0, _chunkOWQZPI3Ucjs.g)("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(t,e,i){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var a;return yield Promise.all((a=t==null?void 0:t.map(n=>_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(n.type==="passkey")return n.id==null?{signer:yield this.createPasskeySigner(n)}:{signer:n};if(n.type==="device"){if(n.publicKey!=null)return{signer:{type:"device",publicKey:n.publicKey,name:n.name}};if(n.locator!=null)return{signer:n.locator};if(i==null)throw new (0, _chunkOWQZPI3Ucjs.g)("Device signer key storage is required for device signers");let r=yield _chunkYHV3672Rcjs.a.call(void 0, i);return{signer:{type:"device",publicKey:r.publicKey,name:r.name}}}if(n.type==="server"&&e!=null){let{derivedAddress:r}=_chunk3VSFHDFHcjs.b.call(void 0, n,e,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${r}`}}return{signer:_chunkNX256LAHcjs.a.call(void 0, n)}})))!=null?a:[])})}getChainType(t){return t==="solana"?"solana":t==="stellar"?"stellar":"evm"}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQJV6W4U2cjs.a,methodName:"walletFactory.getWallet",buildContext(t,e){if(typeof e[0]=="string"){let a=e[1];return{walletLocator:e[0],chain:a==null?void 0:a.chain}}let i=e[0];return{chain:i==null?void 0:i.chain}}})],h.prototype,"getWallet",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQJV6W4U2cjs.a,methodName:"walletFactory.createWallet",buildContext(t,e){return{chain:e[0].chain}}})],h.prototype,"createWallet",1);exports.a = h;
|
|
@@ -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 _chunkVJEQU7S4cjs = require('./chunk-VJEQU7S4.cjs');var _chunk3VSFHDFHcjs = require('./chunk-3VSFHDFH.cjs');var _chunkE4EOD7MPcjs = require('./chunk-E4EOD7MP.cjs');var _chunkOWQZPI3Ucjs = require('./chunk-OWQZPI3U.cjs');var _chunkQJV6W4U2cjs = require('./chunk-QJV6W4U2.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 _chunkVJEQU7S4cjs.a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,options:_chunkVJEQU7S4cjs.a.getOptions(n),alias:n.alias,recovery:_chunkVJEQU7S4cjs.a.getRecovery(n),signer:n.signer,signers:_chunkVJEQU7S4cjs.a.getInitialSigners(n)},_chunkVJEQU7S4cjs.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;_chunkQJV6W4U2cjs.a.info("solanaWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let e=yield this.createTransaction(n);if((d=n.options)!=null&&d.prepareOnly)return _chunkQJV6W4U2cjs.a.info("solanaWallet.sendTransaction.prepared",{transactionId:e.id}),{hash:void 0,explorerLink:void 0,transactionId:e.id};let t={additionalSigners:(p=n.additionalSigners)==null?void 0:p.map(c=>new (0, _chunkE4EOD7MPcjs.a)({type:"external-wallet",address:c.publicKey.toString(),locator:`external-wallet:${c.publicKey.toString()}`,onSign:h=>(h.sign([c]),Promise.resolve(h))}))},a=yield this.approveTransactionAndWait(e.id,t);return _chunkQJV6W4U2cjs.a.info("solanaWallet.sendTransaction.success",{transactionId:e.id,hash:a.hash}),a})}createTransaction(n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var a;let e;((a=n.options)==null?void 0:a.signer)==null?e=this.requireSigner().locator():typeof n.options.signer=="string"?e=n.options.signer:e=`server:${_chunk3VSFHDFHcjs.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 t=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:s,signer:e}});if("error"in t)throw new (0, _chunkOWQZPI3Ucjs.v)(JSON.stringify(t));return t})}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQJV6W4U2cjs.a,methodName:"solanaWallet.sendTransaction",buildContext(n){return{chain:n.chain,address:n.address}}})],o.prototype,"sendTransaction",1);var S=o;exports.a = S;
|