@crossmint/wallets-sdk 0.10.14 → 0.10.16
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/README.md +3 -1
- package/dist/api/client.cjs +1 -1
- package/dist/api/client.js +1 -1
- package/dist/api/gen/types.gen.d.cts +13 -0
- package/dist/api/gen/types.gen.d.ts +13 -0
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.js +1 -1
- package/dist/chunk-3HZJR6A3.cjs +1 -0
- package/dist/chunk-4FM7WA5H.js +1 -0
- package/dist/{chunk-KZJILO3X.js → chunk-5777T43M.js} +1 -1
- package/dist/{chunk-EXY25K62.cjs → chunk-5KA7SYRH.cjs} +1 -1
- package/dist/chunk-5U4PVNPM.js +1 -0
- package/dist/chunk-77UQTNS7.cjs +1 -0
- package/dist/chunk-7OMPE56G.cjs +1 -0
- package/dist/chunk-AIH4VH3N.js +1 -0
- package/dist/chunk-IQB4HWD3.cjs +1 -0
- package/dist/{chunk-ZMPR4ZA2.cjs → chunk-M3EZNQE5.cjs} +1 -1
- package/dist/chunk-MLOSILO2.cjs +1 -0
- package/dist/chunk-NAI62DBY.cjs +1 -0
- package/dist/{chunk-XE47PVB5.cjs → chunk-PW4RFMOB.cjs} +1 -1
- package/dist/chunk-TXMD64BR.js +1 -0
- package/dist/chunk-U3KINSXQ.js +1 -0
- package/dist/{chunk-DAMUOJ6Q.js → chunk-UQPCW4TD.js} +1 -1
- package/dist/chunk-VRWKCVVK.js +1 -0
- package/dist/chunk-X7Y4HEDK.cjs +1 -0
- package/dist/chunk-XP4QXJGR.js +1 -0
- package/dist/{chunk-SYTKQKL7.cjs → chunk-XTGLXZAW.cjs} +1 -1
- package/dist/chunk-XXIW4AEP.js +1 -0
- package/dist/chunk-YNIO2LU5.js +1 -0
- 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/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/index.cjs +1 -1
- package/dist/signers/index.js +1 -1
- package/dist/signers/non-custodial/index.cjs +1 -0
- package/dist/signers/non-custodial/index.d.cts +10 -0
- package/dist/signers/non-custodial/index.d.ts +10 -0
- package/dist/signers/non-custodial/index.js +1 -0
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -0
- package/dist/signers/{email/evm-email-signer.d.cts → non-custodial/ncs-evm-signer.d.cts} +5 -6
- package/dist/signers/{email/evm-email-signer.d.ts → non-custodial/ncs-evm-signer.d.ts} +5 -6
- package/dist/signers/non-custodial/ncs-evm-signer.js +1 -0
- package/dist/signers/non-custodial/ncs-iframe-manager.cjs +1 -0
- package/dist/signers/{email/email-iframe-manager.d.cts → non-custodial/ncs-iframe-manager.d.cts} +2 -2
- package/dist/signers/{email/email-iframe-manager.d.ts → non-custodial/ncs-iframe-manager.d.ts} +2 -2
- package/dist/signers/non-custodial/ncs-iframe-manager.js +1 -0
- package/dist/signers/non-custodial/ncs-signer.cjs +1 -0
- package/dist/signers/{email/email-signer.d.cts → non-custodial/ncs-signer.d.cts} +8 -7
- package/dist/signers/{email/email-signer.d.ts → non-custodial/ncs-signer.d.ts} +8 -7
- package/dist/signers/non-custodial/ncs-signer.js +1 -0
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -0
- package/dist/signers/{email/solana-email-signer.d.cts → non-custodial/ncs-solana-signer.d.cts} +5 -5
- package/dist/signers/{email/solana-email-signer.d.ts → non-custodial/ncs-solana-signer.d.ts} +5 -5
- package/dist/signers/non-custodial/ncs-solana-signer.js +1 -0
- package/dist/signers/types.d.cts +13 -4
- package/dist/signers/types.d.ts +13 -4
- package/dist/utils/constants.cjs +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/wallets/evm.cjs +1 -1
- package/dist/wallets/evm.js +1 -1
- package/dist/wallets/solana.cjs +1 -1
- package/dist/wallets/solana.js +1 -1
- package/dist/wallets/types.d.cts +14 -2
- package/dist/wallets/types.d.ts +14 -2
- package/dist/wallets/wallet-factory.cjs +1 -1
- package/dist/wallets/wallet-factory.js +1 -1
- package/dist/wallets/wallet.cjs +1 -1
- package/dist/wallets/wallet.d.cts +23 -6
- package/dist/wallets/wallet.d.ts +23 -6
- package/dist/wallets/wallet.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-2ZWL2W3E.js +0 -1
- package/dist/chunk-7KHMZPZO.js +0 -1
- package/dist/chunk-BPUDXO56.js +0 -1
- package/dist/chunk-FGGK2EJD.js +0 -1
- package/dist/chunk-JBLEX3DQ.js +0 -1
- package/dist/chunk-JCXMSLR4.cjs +0 -1
- package/dist/chunk-KH5LXU3K.cjs +0 -1
- package/dist/chunk-LMDBWVPC.js +0 -1
- package/dist/chunk-NCS4FTLK.js +0 -1
- package/dist/chunk-NWOKSI3V.cjs +0 -1
- package/dist/chunk-OFA3KGPB.cjs +0 -1
- package/dist/chunk-QCMQO4YZ.cjs +0 -1
- package/dist/chunk-SHDM6MXU.js +0 -1
- package/dist/chunk-SLEKIJXX.cjs +0 -1
- package/dist/chunk-UKJYMCUP.js +0 -1
- package/dist/chunk-YBRPY7QN.cjs +0 -1
- package/dist/signers/email/email-iframe-manager.cjs +0 -1
- package/dist/signers/email/email-iframe-manager.js +0 -1
- package/dist/signers/email/email-signer.cjs +0 -1
- package/dist/signers/email/email-signer.js +0 -1
- package/dist/signers/email/evm-email-signer.cjs +0 -1
- package/dist/signers/email/evm-email-signer.js +0 -1
- package/dist/signers/email/index.cjs +0 -1
- package/dist/signers/email/index.d.cts +0 -10
- package/dist/signers/email/index.d.ts +0 -10
- package/dist/signers/email/index.js +0 -1
- package/dist/signers/email/solana-email-signer.cjs +0 -1
- package/dist/signers/email/solana-email-signer.js +0 -1
- /package/dist/{chunk-VMEGMTOD.cjs → chunk-3ABHUDKX.cjs} +0 -0
- /package/dist/{chunk-TN6YXWPL.js → chunk-7AFCY47Q.js} +0 -0
- /package/dist/{chunk-FWMSAG7V.cjs → chunk-U4S6GWMK.cjs} +0 -0
- /package/dist/{chunk-PPTGFYIV.js → chunk-Y5NVCPZ2.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Signer, EmailInternalSignerConfig, BaseSignResult } from '../types.cjs';
|
|
1
|
+
import { Signer, EmailInternalSignerConfig, PhoneInternalSignerConfig, BaseSignResult } from '../types.cjs';
|
|
2
2
|
import 'ox';
|
|
3
3
|
import '@crossmint/client-sdk-window';
|
|
4
4
|
import '@crossmint/client-signers';
|
|
@@ -6,12 +6,12 @@ import '@crossmint/common-sdk-base';
|
|
|
6
6
|
import '../../chains/chains.cjs';
|
|
7
7
|
import 'viem';
|
|
8
8
|
|
|
9
|
-
declare abstract class
|
|
10
|
-
protected config: EmailInternalSignerConfig;
|
|
11
|
-
type: "email";
|
|
9
|
+
declare abstract class NonCustodialSigner implements Signer {
|
|
10
|
+
protected config: EmailInternalSignerConfig | PhoneInternalSignerConfig;
|
|
11
|
+
readonly type: "email" | "phone";
|
|
12
12
|
private _needsAuth;
|
|
13
13
|
private _authPromise;
|
|
14
|
-
constructor(config: EmailInternalSignerConfig);
|
|
14
|
+
constructor(config: EmailInternalSignerConfig | PhoneInternalSignerConfig);
|
|
15
15
|
abstract locator(): string;
|
|
16
16
|
abstract signMessage(message: string): Promise<BaseSignResult>;
|
|
17
17
|
private initialize;
|
|
@@ -21,7 +21,8 @@ declare abstract class EmailSigner implements Signer {
|
|
|
21
21
|
protected handleAuthRequired(): Promise<void>;
|
|
22
22
|
protected getJwtOrThrow(): string;
|
|
23
23
|
private createAuthPromise;
|
|
24
|
-
private
|
|
24
|
+
private sendMessageWithOtp;
|
|
25
|
+
private getAuthId;
|
|
25
26
|
private verifyOtp;
|
|
26
27
|
}
|
|
27
28
|
declare const DEFAULT_EVENT_OPTIONS: {
|
|
@@ -29,4 +30,4 @@ declare const DEFAULT_EVENT_OPTIONS: {
|
|
|
29
30
|
intervalMs: number;
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
export { DEFAULT_EVENT_OPTIONS,
|
|
33
|
+
export { DEFAULT_EVENT_OPTIONS, NonCustodialSigner };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Signer, EmailInternalSignerConfig, BaseSignResult } from '../types.js';
|
|
1
|
+
import { Signer, EmailInternalSignerConfig, PhoneInternalSignerConfig, BaseSignResult } from '../types.js';
|
|
2
2
|
import 'ox';
|
|
3
3
|
import '@crossmint/client-sdk-window';
|
|
4
4
|
import '@crossmint/client-signers';
|
|
@@ -6,12 +6,12 @@ import '@crossmint/common-sdk-base';
|
|
|
6
6
|
import '../../chains/chains.js';
|
|
7
7
|
import 'viem';
|
|
8
8
|
|
|
9
|
-
declare abstract class
|
|
10
|
-
protected config: EmailInternalSignerConfig;
|
|
11
|
-
type: "email";
|
|
9
|
+
declare abstract class NonCustodialSigner implements Signer {
|
|
10
|
+
protected config: EmailInternalSignerConfig | PhoneInternalSignerConfig;
|
|
11
|
+
readonly type: "email" | "phone";
|
|
12
12
|
private _needsAuth;
|
|
13
13
|
private _authPromise;
|
|
14
|
-
constructor(config: EmailInternalSignerConfig);
|
|
14
|
+
constructor(config: EmailInternalSignerConfig | PhoneInternalSignerConfig);
|
|
15
15
|
abstract locator(): string;
|
|
16
16
|
abstract signMessage(message: string): Promise<BaseSignResult>;
|
|
17
17
|
private initialize;
|
|
@@ -21,7 +21,8 @@ declare abstract class EmailSigner implements Signer {
|
|
|
21
21
|
protected handleAuthRequired(): Promise<void>;
|
|
22
22
|
protected getJwtOrThrow(): string;
|
|
23
23
|
private createAuthPromise;
|
|
24
|
-
private
|
|
24
|
+
private sendMessageWithOtp;
|
|
25
|
+
private getAuthId;
|
|
25
26
|
private verifyOtp;
|
|
26
27
|
}
|
|
27
28
|
declare const DEFAULT_EVENT_OPTIONS: {
|
|
@@ -29,4 +30,4 @@ declare const DEFAULT_EVENT_OPTIONS: {
|
|
|
29
30
|
intervalMs: number;
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
export { DEFAULT_EVENT_OPTIONS,
|
|
33
|
+
export { DEFAULT_EVENT_OPTIONS, NonCustodialSigner };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"../../chunk-YNIO2LU5.js";import"../../chunk-Y5NVCPZ2.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{b as DEFAULT_EVENT_OPTIONS,a as NonCustodialSigner};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5KA7SYRHcjs = require('../../chunk-5KA7SYRH.cjs');require('../../chunk-MLOSILO2.cjs');require('../../chunk-U4S6GWMK.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.SolanaNonCustodialSigner = _chunk5KA7SYRHcjs.a;
|
package/dist/signers/{email/solana-email-signer.d.cts → non-custodial/ncs-solana-signer.d.cts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EmailInternalSignerConfig } from '../types.cjs';
|
|
2
|
-
import {
|
|
1
|
+
import { EmailInternalSignerConfig, PhoneInternalSignerConfig } from '../types.cjs';
|
|
2
|
+
import { NonCustodialSigner } from './ncs-signer.cjs';
|
|
3
3
|
import 'ox';
|
|
4
4
|
import '@crossmint/client-sdk-window';
|
|
5
5
|
import '@crossmint/client-signers';
|
|
@@ -7,8 +7,8 @@ import '@crossmint/common-sdk-base';
|
|
|
7
7
|
import '../../chains/chains.cjs';
|
|
8
8
|
import 'viem';
|
|
9
9
|
|
|
10
|
-
declare class
|
|
11
|
-
constructor(config: EmailInternalSignerConfig);
|
|
10
|
+
declare class SolanaNonCustodialSigner extends NonCustodialSigner {
|
|
11
|
+
constructor(config: EmailInternalSignerConfig | PhoneInternalSignerConfig);
|
|
12
12
|
locator(): string;
|
|
13
13
|
signMessage(): Promise<never>;
|
|
14
14
|
signTransaction(transaction: string): Promise<{
|
|
@@ -21,4 +21,4 @@ declare class SolanaEmailSigner extends EmailSigner {
|
|
|
21
21
|
} | null): void;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export {
|
|
24
|
+
export { SolanaNonCustodialSigner };
|
package/dist/signers/{email/solana-email-signer.d.ts → non-custodial/ncs-solana-signer.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EmailInternalSignerConfig } from '../types.js';
|
|
2
|
-
import {
|
|
1
|
+
import { EmailInternalSignerConfig, PhoneInternalSignerConfig } from '../types.js';
|
|
2
|
+
import { NonCustodialSigner } from './ncs-signer.js';
|
|
3
3
|
import 'ox';
|
|
4
4
|
import '@crossmint/client-sdk-window';
|
|
5
5
|
import '@crossmint/client-signers';
|
|
@@ -7,8 +7,8 @@ import '@crossmint/common-sdk-base';
|
|
|
7
7
|
import '../../chains/chains.js';
|
|
8
8
|
import 'viem';
|
|
9
9
|
|
|
10
|
-
declare class
|
|
11
|
-
constructor(config: EmailInternalSignerConfig);
|
|
10
|
+
declare class SolanaNonCustodialSigner extends NonCustodialSigner {
|
|
11
|
+
constructor(config: EmailInternalSignerConfig | PhoneInternalSignerConfig);
|
|
12
12
|
locator(): string;
|
|
13
13
|
signMessage(): Promise<never>;
|
|
14
14
|
signTransaction(transaction: string): Promise<{
|
|
@@ -21,4 +21,4 @@ declare class SolanaEmailSigner extends EmailSigner {
|
|
|
21
21
|
} | null): void;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export {
|
|
24
|
+
export { SolanaNonCustodialSigner };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-U3KINSXQ.js";import"../../chunk-YNIO2LU5.js";import"../../chunk-Y5NVCPZ2.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{a as SolanaNonCustodialSigner};
|
package/dist/signers/types.d.cts
CHANGED
|
@@ -14,6 +14,12 @@ type EmailSignerConfig = {
|
|
|
14
14
|
email?: string;
|
|
15
15
|
onAuthRequired?: (needsAuth: boolean, sendEmailWithOtp: () => Promise<void>, verifyOtp: (otp: string) => Promise<void>, reject: () => void) => Promise<void>;
|
|
16
16
|
};
|
|
17
|
+
type PhoneSignerConfig = {
|
|
18
|
+
type: "phone";
|
|
19
|
+
phone?: string;
|
|
20
|
+
onAuthRequired?: (needsAuth: boolean, sendOtp: () => Promise<void>, verifyOtp: (otp: string) => Promise<void>, reject: () => void) => Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
type NonCustodialSignerType = PhoneSignerConfig["type"] | EmailSignerConfig["type"];
|
|
17
23
|
type ExternalWalletSignerConfigForChain<C extends Chain> = C extends SolanaChain ? SolanaExternalWalletSignerConfig : EvmExternalWalletSignerConfig;
|
|
18
24
|
type ApiKeySignerConfig = {
|
|
19
25
|
type: "api-key";
|
|
@@ -31,11 +37,13 @@ type PasskeySignerConfig = {
|
|
|
31
37
|
}>;
|
|
32
38
|
onSignWithPasskey?: (message: string) => Promise<PasskeySignResult>;
|
|
33
39
|
};
|
|
34
|
-
type
|
|
40
|
+
type BaseInternalSignerConfig = {
|
|
35
41
|
locator: string;
|
|
36
42
|
crossmint: Crossmint;
|
|
37
43
|
clientTEEConnection?: HandshakeParent<typeof signerOutboundEvents, typeof signerInboundEvents>;
|
|
38
44
|
};
|
|
45
|
+
type EmailInternalSignerConfig = EmailSignerConfig & BaseInternalSignerConfig;
|
|
46
|
+
type PhoneInternalSignerConfig = PhoneSignerConfig & BaseInternalSignerConfig;
|
|
39
47
|
type PasskeyInternalSignerConfig = PasskeySignerConfig & {
|
|
40
48
|
locator: string;
|
|
41
49
|
id: string;
|
|
@@ -47,7 +55,7 @@ type ApiKeyInternalSignerConfig = ApiKeySignerConfig & {
|
|
|
47
55
|
type ExternalWalletInternalSignerConfig<C extends Chain> = ExternalWalletSignerConfigForChain<C> & {
|
|
48
56
|
locator: string;
|
|
49
57
|
};
|
|
50
|
-
type InternalSignerConfig<C extends Chain> = EmailInternalSignerConfig | PasskeyInternalSignerConfig | ApiKeyInternalSignerConfig | ExternalWalletInternalSignerConfig<C>;
|
|
58
|
+
type InternalSignerConfig<C extends Chain> = EmailInternalSignerConfig | PhoneInternalSignerConfig | PasskeyInternalSignerConfig | ApiKeyInternalSignerConfig | ExternalWalletInternalSignerConfig<C>;
|
|
51
59
|
type BaseSignResult = {
|
|
52
60
|
signature: string;
|
|
53
61
|
};
|
|
@@ -58,9 +66,10 @@ type PasskeySignResult = {
|
|
|
58
66
|
};
|
|
59
67
|
metadata: WebAuthnP256.SignMetadata;
|
|
60
68
|
};
|
|
61
|
-
type SignerConfigForChain<C extends Chain> = C extends SolanaChain ? EmailSignerConfig | BaseSignerConfig<C> : EmailSignerConfig | PasskeySignerConfig | BaseSignerConfig<C>;
|
|
69
|
+
type SignerConfigForChain<C extends Chain> = C extends SolanaChain ? EmailSignerConfig | PhoneSignerConfig | BaseSignerConfig<C> : EmailSignerConfig | PhoneSignerConfig | PasskeySignerConfig | BaseSignerConfig<C>;
|
|
62
70
|
type SignResultMap = {
|
|
63
71
|
email: BaseSignResult;
|
|
72
|
+
phone: BaseSignResult;
|
|
64
73
|
"api-key": BaseSignResult;
|
|
65
74
|
"external-wallet": BaseSignResult;
|
|
66
75
|
passkey: PasskeySignResult;
|
|
@@ -72,4 +81,4 @@ interface Signer<T extends keyof SignResultMap = keyof SignResultMap> {
|
|
|
72
81
|
signTransaction(transaction: string): Promise<SignResultMap[T]>;
|
|
73
82
|
}
|
|
74
83
|
|
|
75
|
-
export { type ApiKeyInternalSignerConfig, type ApiKeySignerConfig, AuthRejectedError, type BaseSignResult, type BaseSignerConfig, type EmailInternalSignerConfig, type EmailSignerConfig, type ExternalWalletInternalSignerConfig, type ExternalWalletSignerConfigForChain, type InternalSignerConfig, type PasskeyInternalSignerConfig, type PasskeySignResult, type PasskeySignerConfig, type Signer, type SignerConfigForChain };
|
|
84
|
+
export { type ApiKeyInternalSignerConfig, type ApiKeySignerConfig, AuthRejectedError, type BaseSignResult, type BaseSignerConfig, type EmailInternalSignerConfig, type EmailSignerConfig, type ExternalWalletInternalSignerConfig, type ExternalWalletSignerConfigForChain, type InternalSignerConfig, type NonCustodialSignerType, type PasskeyInternalSignerConfig, type PasskeySignResult, type PasskeySignerConfig, type PhoneInternalSignerConfig, type PhoneSignerConfig, type Signer, type SignerConfigForChain };
|
package/dist/signers/types.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ type EmailSignerConfig = {
|
|
|
14
14
|
email?: string;
|
|
15
15
|
onAuthRequired?: (needsAuth: boolean, sendEmailWithOtp: () => Promise<void>, verifyOtp: (otp: string) => Promise<void>, reject: () => void) => Promise<void>;
|
|
16
16
|
};
|
|
17
|
+
type PhoneSignerConfig = {
|
|
18
|
+
type: "phone";
|
|
19
|
+
phone?: string;
|
|
20
|
+
onAuthRequired?: (needsAuth: boolean, sendOtp: () => Promise<void>, verifyOtp: (otp: string) => Promise<void>, reject: () => void) => Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
type NonCustodialSignerType = PhoneSignerConfig["type"] | EmailSignerConfig["type"];
|
|
17
23
|
type ExternalWalletSignerConfigForChain<C extends Chain> = C extends SolanaChain ? SolanaExternalWalletSignerConfig : EvmExternalWalletSignerConfig;
|
|
18
24
|
type ApiKeySignerConfig = {
|
|
19
25
|
type: "api-key";
|
|
@@ -31,11 +37,13 @@ type PasskeySignerConfig = {
|
|
|
31
37
|
}>;
|
|
32
38
|
onSignWithPasskey?: (message: string) => Promise<PasskeySignResult>;
|
|
33
39
|
};
|
|
34
|
-
type
|
|
40
|
+
type BaseInternalSignerConfig = {
|
|
35
41
|
locator: string;
|
|
36
42
|
crossmint: Crossmint;
|
|
37
43
|
clientTEEConnection?: HandshakeParent<typeof signerOutboundEvents, typeof signerInboundEvents>;
|
|
38
44
|
};
|
|
45
|
+
type EmailInternalSignerConfig = EmailSignerConfig & BaseInternalSignerConfig;
|
|
46
|
+
type PhoneInternalSignerConfig = PhoneSignerConfig & BaseInternalSignerConfig;
|
|
39
47
|
type PasskeyInternalSignerConfig = PasskeySignerConfig & {
|
|
40
48
|
locator: string;
|
|
41
49
|
id: string;
|
|
@@ -47,7 +55,7 @@ type ApiKeyInternalSignerConfig = ApiKeySignerConfig & {
|
|
|
47
55
|
type ExternalWalletInternalSignerConfig<C extends Chain> = ExternalWalletSignerConfigForChain<C> & {
|
|
48
56
|
locator: string;
|
|
49
57
|
};
|
|
50
|
-
type InternalSignerConfig<C extends Chain> = EmailInternalSignerConfig | PasskeyInternalSignerConfig | ApiKeyInternalSignerConfig | ExternalWalletInternalSignerConfig<C>;
|
|
58
|
+
type InternalSignerConfig<C extends Chain> = EmailInternalSignerConfig | PhoneInternalSignerConfig | PasskeyInternalSignerConfig | ApiKeyInternalSignerConfig | ExternalWalletInternalSignerConfig<C>;
|
|
51
59
|
type BaseSignResult = {
|
|
52
60
|
signature: string;
|
|
53
61
|
};
|
|
@@ -58,9 +66,10 @@ type PasskeySignResult = {
|
|
|
58
66
|
};
|
|
59
67
|
metadata: WebAuthnP256.SignMetadata;
|
|
60
68
|
};
|
|
61
|
-
type SignerConfigForChain<C extends Chain> = C extends SolanaChain ? EmailSignerConfig | BaseSignerConfig<C> : EmailSignerConfig | PasskeySignerConfig | BaseSignerConfig<C>;
|
|
69
|
+
type SignerConfigForChain<C extends Chain> = C extends SolanaChain ? EmailSignerConfig | PhoneSignerConfig | BaseSignerConfig<C> : EmailSignerConfig | PhoneSignerConfig | PasskeySignerConfig | BaseSignerConfig<C>;
|
|
62
70
|
type SignResultMap = {
|
|
63
71
|
email: BaseSignResult;
|
|
72
|
+
phone: BaseSignResult;
|
|
64
73
|
"api-key": BaseSignResult;
|
|
65
74
|
"external-wallet": BaseSignResult;
|
|
66
75
|
passkey: PasskeySignResult;
|
|
@@ -72,4 +81,4 @@ interface Signer<T extends keyof SignResultMap = keyof SignResultMap> {
|
|
|
72
81
|
signTransaction(transaction: string): Promise<SignResultMap[T]>;
|
|
73
82
|
}
|
|
74
83
|
|
|
75
|
-
export { type ApiKeyInternalSignerConfig, type ApiKeySignerConfig, AuthRejectedError, type BaseSignResult, type BaseSignerConfig, type EmailInternalSignerConfig, type EmailSignerConfig, type ExternalWalletInternalSignerConfig, type ExternalWalletSignerConfigForChain, type InternalSignerConfig, type PasskeyInternalSignerConfig, type PasskeySignResult, type PasskeySignerConfig, type Signer, type SignerConfigForChain };
|
|
84
|
+
export { type ApiKeyInternalSignerConfig, type ApiKeySignerConfig, AuthRejectedError, type BaseSignResult, type BaseSignerConfig, type EmailInternalSignerConfig, type EmailSignerConfig, type ExternalWalletInternalSignerConfig, type ExternalWalletSignerConfigForChain, type InternalSignerConfig, type NonCustodialSignerType, type PasskeyInternalSignerConfig, type PasskeySignResult, type PasskeySignerConfig, type PhoneInternalSignerConfig, type PhoneSignerConfig, type Signer, type SignerConfigForChain };
|
package/dist/utils/constants.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM3EZNQE5cjs = require('../chunk-M3EZNQE5.cjs');require('../chunk-XALFCQKD.cjs');exports.SDK_NAME = _chunkM3EZNQE5cjs.c; exports.SDK_VERSION = _chunkM3EZNQE5cjs.b; exports.STATUS_POLLING_INTERVAL_MS = _chunkM3EZNQE5cjs.d; exports.WALLETS_SERVICE = _chunkM3EZNQE5cjs.a;
|
package/dist/utils/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-AIH4VH3N.js";import"../chunk-BW7YYVZE.js";export{c as SDK_NAME,b as SDK_VERSION,d as STATUS_POLLING_INTERVAL_MS,a as WALLETS_SERVICE};
|
package/dist/wallets/evm.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk77UQTNS7cjs = require('../chunk-77UQTNS7.cjs');require('../chunk-7OMPE56G.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-6VJEBYPN.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMWallet = _chunk77UQTNS7cjs.a;
|
package/dist/wallets/evm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-XP4QXJGR.js";import"../chunk-VRWKCVVK.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-BJDS5BJG.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-BW7YYVZE.js";export{a as EVMWallet};
|
package/dist/wallets/solana.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkX7Y4HEDKcjs = require('../chunk-X7Y4HEDK.cjs');require('../chunk-7OMPE56G.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaWallet = _chunkX7Y4HEDKcjs.a;
|
package/dist/wallets/solana.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-XXIW4AEP.js";import"../chunk-VRWKCVVK.js";import"../chunk-SCS4UDW7.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as SolanaWallet};
|
package/dist/wallets/types.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ import { Abi } from 'abitype';
|
|
|
5
5
|
import { CreateTransactionSuccessResponse } from '../api/types.cjs';
|
|
6
6
|
export { Activity } from '../api/types.cjs';
|
|
7
7
|
import { Chain } from '../chains/chains.cjs';
|
|
8
|
-
import { SignerConfigForChain } from '../signers/types.cjs';
|
|
8
|
+
import { SignerConfigForChain, BaseSignResult, PasskeySignResult, Signer } from '../signers/types.cjs';
|
|
9
9
|
import 'viem';
|
|
10
10
|
import '../api/gen/types.gen.cjs';
|
|
11
11
|
import 'ox';
|
|
@@ -13,6 +13,7 @@ import '@crossmint/common-sdk-base';
|
|
|
13
13
|
|
|
14
14
|
type TransactionInputOptions = {
|
|
15
15
|
experimental_prepareOnly?: boolean;
|
|
16
|
+
experimental_signer?: string;
|
|
16
17
|
};
|
|
17
18
|
type EVMTransactionInputBase = {
|
|
18
19
|
options?: TransactionInputOptions;
|
|
@@ -90,5 +91,16 @@ type Transaction<TPrepareOnly extends boolean = false> = TPrepareOnly extends tr
|
|
|
90
91
|
explorerLink: string;
|
|
91
92
|
transactionId: string;
|
|
92
93
|
};
|
|
94
|
+
type ApproveTransactionOptions = {
|
|
95
|
+
experimental_approval?: Approval;
|
|
96
|
+
additionalSigners?: Signer[];
|
|
97
|
+
};
|
|
98
|
+
type ApproveTransactionParams = {
|
|
99
|
+
transactionId: string;
|
|
100
|
+
options?: ApproveTransactionOptions;
|
|
101
|
+
};
|
|
102
|
+
type Approval = (BaseSignResult | PasskeySignResult) & {
|
|
103
|
+
signer: string;
|
|
104
|
+
};
|
|
93
105
|
|
|
94
|
-
export type { Balances, Callbacks, DelegatedSigner, EVMTransactionInput, FormattedEVMTransaction, PendingApproval, SolanaTransactionInput, TokenBalance, Transaction, TransactionInputOptions, UserLocator, WalletArgsFor, WalletOptions };
|
|
106
|
+
export type { Approval, ApproveTransactionOptions, ApproveTransactionParams, Balances, Callbacks, DelegatedSigner, EVMTransactionInput, FormattedEVMTransaction, PendingApproval, SolanaTransactionInput, TokenBalance, Transaction, TransactionInputOptions, UserLocator, WalletArgsFor, WalletOptions };
|
package/dist/wallets/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Abi } from 'abitype';
|
|
|
5
5
|
import { CreateTransactionSuccessResponse } from '../api/types.js';
|
|
6
6
|
export { Activity } from '../api/types.js';
|
|
7
7
|
import { Chain } from '../chains/chains.js';
|
|
8
|
-
import { SignerConfigForChain } from '../signers/types.js';
|
|
8
|
+
import { SignerConfigForChain, BaseSignResult, PasskeySignResult, Signer } from '../signers/types.js';
|
|
9
9
|
import 'viem';
|
|
10
10
|
import '../api/gen/types.gen.js';
|
|
11
11
|
import 'ox';
|
|
@@ -13,6 +13,7 @@ import '@crossmint/common-sdk-base';
|
|
|
13
13
|
|
|
14
14
|
type TransactionInputOptions = {
|
|
15
15
|
experimental_prepareOnly?: boolean;
|
|
16
|
+
experimental_signer?: string;
|
|
16
17
|
};
|
|
17
18
|
type EVMTransactionInputBase = {
|
|
18
19
|
options?: TransactionInputOptions;
|
|
@@ -90,5 +91,16 @@ type Transaction<TPrepareOnly extends boolean = false> = TPrepareOnly extends tr
|
|
|
90
91
|
explorerLink: string;
|
|
91
92
|
transactionId: string;
|
|
92
93
|
};
|
|
94
|
+
type ApproveTransactionOptions = {
|
|
95
|
+
experimental_approval?: Approval;
|
|
96
|
+
additionalSigners?: Signer[];
|
|
97
|
+
};
|
|
98
|
+
type ApproveTransactionParams = {
|
|
99
|
+
transactionId: string;
|
|
100
|
+
options?: ApproveTransactionOptions;
|
|
101
|
+
};
|
|
102
|
+
type Approval = (BaseSignResult | PasskeySignResult) & {
|
|
103
|
+
signer: string;
|
|
104
|
+
};
|
|
93
105
|
|
|
94
|
-
export type { Balances, Callbacks, DelegatedSigner, EVMTransactionInput, FormattedEVMTransaction, PendingApproval, SolanaTransactionInput, TokenBalance, Transaction, TransactionInputOptions, UserLocator, WalletArgsFor, WalletOptions };
|
|
106
|
+
export type { Approval, ApproveTransactionOptions, ApproveTransactionParams, Balances, Callbacks, DelegatedSigner, EVMTransactionInput, FormattedEVMTransaction, PendingApproval, SolanaTransactionInput, TokenBalance, Transaction, TransactionInputOptions, UserLocator, WalletArgsFor, WalletOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNAI62DBYcjs = require('../chunk-NAI62DBY.cjs');require('../chunk-7OMPE56G.cjs');require('../chunk-IQB4HWD3.cjs');require('../chunk-3ABHUDKX.cjs');require('../chunk-3HZJR6A3.cjs');require('../chunk-5KA7SYRH.cjs');require('../chunk-MLOSILO2.cjs');require('../chunk-U4S6GWMK.cjs');require('../chunk-YWPTI2QO.cjs');require('../chunk-4KXOWU5E.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-RFK6N7LC.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YZ4HRYSL.cjs');require('../chunk-BULGM35W.cjs');require('../chunk-XALFCQKD.cjs');exports.WalletFactory = _chunkNAI62DBYcjs.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-TXMD64BR.js";import"../chunk-VRWKCVVK.js";import"../chunk-5U4PVNPM.js";import"../chunk-7AFCY47Q.js";import"../chunk-4FM7WA5H.js";import"../chunk-U3KINSXQ.js";import"../chunk-YNIO2LU5.js";import"../chunk-Y5NVCPZ2.js";import"../chunk-UBOWSXW3.js";import"../chunk-IGBQEAD5.js";import"../chunk-SCS4UDW7.js";import"../chunk-M4ELAV7U.js";import"../chunk-IJMFCZIY.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-LW6JSI4J.js";import"../chunk-5S6YZJHE.js";import"../chunk-BW7YYVZE.js";export{a as WalletFactory};
|
package/dist/wallets/wallet.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7OMPE56Gcjs = require('../chunk-7OMPE56G.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.Wallet = _chunk7OMPE56Gcjs.a;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Signer, PasskeySignResult, BaseSignResult } from '../signers/types.cjs';
|
|
2
|
-
import { ApiClient } from '../api/client.cjs';
|
|
3
|
-
import { GetTransactionsResponse, GetTransactionResponse, Activity, RegisterSignerPasskeyParams, WalletLocator } from '../api/types.cjs';
|
|
4
2
|
import { WalletNftsResponseDto, WalletsTransactionV2025ResponseDto } from '../api/gen/types.gen.cjs';
|
|
5
|
-
import {
|
|
3
|
+
import { ApiClient } from '../api/client.cjs';
|
|
4
|
+
import { GetTransactionsResponse, GetTransactionSuccessResponse, Activity, RegisterSignerPasskeyParams, WalletLocator } from '../api/types.cjs';
|
|
5
|
+
import { WalletOptions, Balances, TransactionInputOptions, UserLocator, Transaction, ApproveTransactionParams, DelegatedSigner, ApproveTransactionOptions, PendingApproval } from './types.cjs';
|
|
6
6
|
import { Chain } from '../chains/chains.cjs';
|
|
7
7
|
import 'ox';
|
|
8
8
|
import '@crossmint/client-sdk-window';
|
|
@@ -59,13 +59,15 @@ declare class Wallet<C extends Chain> {
|
|
|
59
59
|
/**
|
|
60
60
|
* Get the wallet transactions
|
|
61
61
|
* @returns The transactions
|
|
62
|
+
* @throws {Error} If the transactions cannot be retrieved
|
|
62
63
|
*/
|
|
63
64
|
experimental_transactions(): Promise<GetTransactionsResponse>;
|
|
64
65
|
/**
|
|
65
66
|
* Get a transaction by id
|
|
66
67
|
* @returns The transaction
|
|
68
|
+
* @throws {Error} If the transaction cannot be retrieved
|
|
67
69
|
*/
|
|
68
|
-
experimental_transaction(transactionId: string): Promise<
|
|
70
|
+
experimental_transaction(transactionId: string): Promise<GetTransactionSuccessResponse>;
|
|
69
71
|
/**
|
|
70
72
|
* Get the wallet activity
|
|
71
73
|
* @returns The activity
|
|
@@ -84,6 +86,20 @@ declare class Wallet<C extends Chain> {
|
|
|
84
86
|
send<T extends TransactionInputOptions | undefined = undefined>(to: string | UserLocator, token: string, amount: string, options?: T): Promise<Transaction<T extends {
|
|
85
87
|
experimental_prepareOnly: true;
|
|
86
88
|
} ? true : false>>;
|
|
89
|
+
/**
|
|
90
|
+
* Approve a transaction
|
|
91
|
+
* @param params - The parameters
|
|
92
|
+
* @param params.transactionId - The transaction id
|
|
93
|
+
* @param params.options - The options for the transaction
|
|
94
|
+
* @param params.options.experimental_approval - The approval
|
|
95
|
+
* @param params.options.additionalSigners - The additional signers
|
|
96
|
+
* @returns The transaction
|
|
97
|
+
*/
|
|
98
|
+
approveTransaction(params: ApproveTransactionParams): Promise<{
|
|
99
|
+
hash: string;
|
|
100
|
+
explorerLink: string;
|
|
101
|
+
transactionId: string;
|
|
102
|
+
}>;
|
|
87
103
|
/**
|
|
88
104
|
* Add a delegated signer to the wallet
|
|
89
105
|
* @param signer - The signer. For Solana, it must be a string. For EVM, it can be a string or a passkey.
|
|
@@ -95,12 +111,13 @@ declare class Wallet<C extends Chain> {
|
|
|
95
111
|
delegatedSigners(): Promise<DelegatedSigner[]>;
|
|
96
112
|
protected get walletLocator(): WalletLocator;
|
|
97
113
|
protected get isSolanaWallet(): boolean;
|
|
98
|
-
protected approveAndWait(transactionId: string,
|
|
114
|
+
protected approveAndWait(transactionId: string, options?: ApproveTransactionOptions): Promise<{
|
|
99
115
|
hash: string;
|
|
100
116
|
explorerLink: string;
|
|
101
117
|
transactionId: string;
|
|
102
118
|
}>;
|
|
103
|
-
protected
|
|
119
|
+
protected approveTransactionInternal(transactionId: string, options?: ApproveTransactionOptions): Promise<WalletsTransactionV2025ResponseDto>;
|
|
120
|
+
private executeApprovalWithErrorHandling;
|
|
104
121
|
protected approveSignature(pendingApprovals: Array<PendingApproval>, signatureId: string): Promise<PasskeySignResult | BaseSignResult>;
|
|
105
122
|
protected waitForSignature(signatureId: string): Promise<string>;
|
|
106
123
|
protected waitForTransaction(transactionId: string, timeoutMs?: number, { backoffMultiplier, maxBackoffMs, initialBackoffMs, }?: {
|
package/dist/wallets/wallet.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Signer, PasskeySignResult, BaseSignResult } from '../signers/types.js';
|
|
2
|
-
import { ApiClient } from '../api/client.js';
|
|
3
|
-
import { GetTransactionsResponse, GetTransactionResponse, Activity, RegisterSignerPasskeyParams, WalletLocator } from '../api/types.js';
|
|
4
2
|
import { WalletNftsResponseDto, WalletsTransactionV2025ResponseDto } from '../api/gen/types.gen.js';
|
|
5
|
-
import {
|
|
3
|
+
import { ApiClient } from '../api/client.js';
|
|
4
|
+
import { GetTransactionsResponse, GetTransactionSuccessResponse, Activity, RegisterSignerPasskeyParams, WalletLocator } from '../api/types.js';
|
|
5
|
+
import { WalletOptions, Balances, TransactionInputOptions, UserLocator, Transaction, ApproveTransactionParams, DelegatedSigner, ApproveTransactionOptions, PendingApproval } from './types.js';
|
|
6
6
|
import { Chain } from '../chains/chains.js';
|
|
7
7
|
import 'ox';
|
|
8
8
|
import '@crossmint/client-sdk-window';
|
|
@@ -59,13 +59,15 @@ declare class Wallet<C extends Chain> {
|
|
|
59
59
|
/**
|
|
60
60
|
* Get the wallet transactions
|
|
61
61
|
* @returns The transactions
|
|
62
|
+
* @throws {Error} If the transactions cannot be retrieved
|
|
62
63
|
*/
|
|
63
64
|
experimental_transactions(): Promise<GetTransactionsResponse>;
|
|
64
65
|
/**
|
|
65
66
|
* Get a transaction by id
|
|
66
67
|
* @returns The transaction
|
|
68
|
+
* @throws {Error} If the transaction cannot be retrieved
|
|
67
69
|
*/
|
|
68
|
-
experimental_transaction(transactionId: string): Promise<
|
|
70
|
+
experimental_transaction(transactionId: string): Promise<GetTransactionSuccessResponse>;
|
|
69
71
|
/**
|
|
70
72
|
* Get the wallet activity
|
|
71
73
|
* @returns The activity
|
|
@@ -84,6 +86,20 @@ declare class Wallet<C extends Chain> {
|
|
|
84
86
|
send<T extends TransactionInputOptions | undefined = undefined>(to: string | UserLocator, token: string, amount: string, options?: T): Promise<Transaction<T extends {
|
|
85
87
|
experimental_prepareOnly: true;
|
|
86
88
|
} ? true : false>>;
|
|
89
|
+
/**
|
|
90
|
+
* Approve a transaction
|
|
91
|
+
* @param params - The parameters
|
|
92
|
+
* @param params.transactionId - The transaction id
|
|
93
|
+
* @param params.options - The options for the transaction
|
|
94
|
+
* @param params.options.experimental_approval - The approval
|
|
95
|
+
* @param params.options.additionalSigners - The additional signers
|
|
96
|
+
* @returns The transaction
|
|
97
|
+
*/
|
|
98
|
+
approveTransaction(params: ApproveTransactionParams): Promise<{
|
|
99
|
+
hash: string;
|
|
100
|
+
explorerLink: string;
|
|
101
|
+
transactionId: string;
|
|
102
|
+
}>;
|
|
87
103
|
/**
|
|
88
104
|
* Add a delegated signer to the wallet
|
|
89
105
|
* @param signer - The signer. For Solana, it must be a string. For EVM, it can be a string or a passkey.
|
|
@@ -95,12 +111,13 @@ declare class Wallet<C extends Chain> {
|
|
|
95
111
|
delegatedSigners(): Promise<DelegatedSigner[]>;
|
|
96
112
|
protected get walletLocator(): WalletLocator;
|
|
97
113
|
protected get isSolanaWallet(): boolean;
|
|
98
|
-
protected approveAndWait(transactionId: string,
|
|
114
|
+
protected approveAndWait(transactionId: string, options?: ApproveTransactionOptions): Promise<{
|
|
99
115
|
hash: string;
|
|
100
116
|
explorerLink: string;
|
|
101
117
|
transactionId: string;
|
|
102
118
|
}>;
|
|
103
|
-
protected
|
|
119
|
+
protected approveTransactionInternal(transactionId: string, options?: ApproveTransactionOptions): Promise<WalletsTransactionV2025ResponseDto>;
|
|
120
|
+
private executeApprovalWithErrorHandling;
|
|
104
121
|
protected approveSignature(pendingApprovals: Array<PendingApproval>, signatureId: string): Promise<PasskeySignResult | BaseSignResult>;
|
|
105
122
|
protected waitForSignature(signatureId: string): Promise<string>;
|
|
106
123
|
protected waitForTransaction(transactionId: string, timeoutMs?: number, { backoffMultiplier, maxBackoffMs, initialBackoffMs, }?: {
|
package/dist/wallets/wallet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-VRWKCVVK.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as Wallet};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossmint/wallets-sdk",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.16",
|
|
4
4
|
"repository": "https://github.com/Crossmint/crossmint-sdk",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Paella Labs Inc",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"ox": "0.6.9",
|
|
26
26
|
"tweetnacl": "1.0.3",
|
|
27
27
|
"viem": "2.23.6",
|
|
28
|
-
"@crossmint/
|
|
29
|
-
"@crossmint/
|
|
30
|
-
"@crossmint/client-
|
|
28
|
+
"@crossmint/common-sdk-base": "0.8.5",
|
|
29
|
+
"@crossmint/client-signers": "0.0.18",
|
|
30
|
+
"@crossmint/client-sdk-window": "1.0.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@hey-api/openapi-ts": "0.69.2",
|
package/dist/chunk-2ZWL2W3E.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./chunk-JBLEX3DQ.js";import{a as l}from"./chunk-SCS4UDW7.js";import{q as p}from"./chunk-7ENJXL4H.js";import{f as r}from"./chunk-BW7YYVZE.js";import m from"bs58";import{isValidSolanaAddress as T}from"@crossmint/common-sdk-base";var d=class u extends t{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer},t.getApiClient(n))}static from(n){if(!T(n.address))throw new Error("Wallet is not a Solana wallet");return new u(n)}sendTransaction(n){return r(this,null,function*(){var o,s;let i=yield this.createTransaction(n);if((o=n.options)!=null&&o.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:i.id};let a=(s=n.additionalSigners)==null?void 0:s.map(e=>new l({type:"external-wallet",address:e.publicKey.toString(),locator:`external-wallet:${e.publicKey.toString()}`,onSignTransaction:c=>(c.sign([e]),Promise.resolve(c))}));return yield this.approveAndWait(i.id,a)})}createTransaction(i){return r(this,arguments,function*({transaction:n}){let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:m.encode(n.serialize())}});if("error"in a)throw new p(JSON.stringify(a));return a})}};export{d as a};
|
package/dist/chunk-7KHMZPZO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as u}from"./chunk-PPTGFYIV.js";import{a as l}from"./chunk-M4ELAV7U.js";import{f as c}from"./chunk-BW7YYVZE.js";import{validateAPIKey as p}from"@crossmint/common-sdk-base";var d=class{constructor(t){this.config=t;this.type="email";this._needsAuth=!0;this._authPromise=null;this.initialize()}initialize(){return c(this,null,function*(){if(this.config.clientTEEConnection==null){let t=p(this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let r=new u({environment:t.environment});this.config.clientTEEConnection=yield r.initialize()}})}handleAuthRequired(){return c(this,null,function*(){var o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=yield(a=this.config.clientTEEConnection)==null?void 0:a.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(s=(o=this.config.crossmint.experimental_customAuth)==null?void 0:o.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey}},options:h});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:r,resolve:i,reject:n}=this.createAuthPromise();if(this._authPromise={promise:r,resolve:i,reject:n},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendEmailWithOtp(),e=>this.verifyOtp(e),()=>n(new l))}catch(e){n(e)}try{yield r}catch(e){throw e}})}getJwtOrThrow(){var r;let t=(r=this.config.crossmint.experimental_customAuth)==null?void 0:r.jwt;if(t==null)throw new Error("JWT is required");return t}createAuthPromise(){let t,r;return{promise:new Promise((n,o)=>{t=n,r=o}),resolve:t,reject:r}}sendEmailWithOtp(){return c(this,null,function*(){var n,o,s;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=this.config.clientTEEConnection,r=`email:${this.config.email}`,i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(o=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{authId:r}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendEmailWithOtp] Failed to send OTP:",i),(s=this._authPromise)==null||s.reject(new Error(i.error||"Failed to initiate OTP process.")))})}verifyOtp(t){return c(this,null,function*(){var i,n,o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let r=this.config.clientTEEConnection;try{let e=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(n=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:h});if((e==null?void 0:e.status)==="success"){this._needsAuth=!1,(o=this._authPromise)==null||o.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",e),this._needsAuth=!0;let m=(e==null?void 0:e.status)==="error"?e.error:"Failed to validate encrypted OTP";(s=this._authPromise)==null||s.reject(new Error(m))}catch(e){throw console.error("[verifyOtp] Error sending OTP validation request:",e),this._needsAuth=!0,(a=this._authPromise)==null||a.reject(e),e}})}},h={timeoutMs:1e4,intervalMs:5e3};export{d as a,h as b};
|
package/dist/chunk-BPUDXO56.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as i,b as s}from"./chunk-7KHMZPZO.js";import{f as n}from"./chunk-BW7YYVZE.js";import{VersionedTransaction as y}from"@solana/web3.js";import o from"bs58";var a=class c extends i{constructor(e){super(e)}locator(){return this.config.locator}signMessage(){return n(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(e){return n(this,null,function*(){var r;yield this.handleAuthRequired();let g=this.getJwtOrThrow(),d=o.decode(e),l=y.deserialize(d).message.serialize(),t=yield(r=this.config.clientTEEConnection)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:g,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:o.encode(l),encoding:"base58"}},options:s});if((t==null?void 0:t.status)==="error")throw new Error(t.error);if((t==null?void 0:t.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(t.publicKey),{signature:t.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="base58"||e.keyType!=="ed25519"||e.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(e))}};export{a};
|
package/dist/chunk-FGGK2EJD.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as p}from"./chunk-JBLEX3DQ.js";import{k as c,o as d,q as T}from"./chunk-7ENJXL4H.js";import{a as f}from"./chunk-BJDS5BJG.js";import{f as o}from"./chunk-BW7YYVZE.js";import{createPublicClient as E,encodeFunctionData as S,http as V}from"viem";import{isValidEvmAddress as M}from"@crossmint/common-sdk-base";var w=class C extends p{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:p.getOptions(t)},p.getApiClient(t))}static from(t){if(!M(t.address))throw new Error("Wallet is not an EVM wallet");return new C(t)}sendTransaction(t){return o(this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return o(this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new d(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return o(this,null,function*(){var m;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new c("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new c("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new d(JSON.stringify(s));let g=s.id,D=((m=s.approvals)==null?void 0:m.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}getViemClient(t){var n;return E({transport:(n=t==null?void 0:t.transport)!=null?n:V(),chain:f(this.chain)})}createTransaction(t){return o(this,null,function*(){let n=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:this.signer.locator(),chain:this.chain,calls:[t]}});if("error"in n)throw new T(JSON.stringify(n));return n})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:S({abi:t.abi,functionName:t.functionName,args:t.args})}}};export{w as a};
|
package/dist/chunk-JBLEX3DQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as b}from"./chunk-UKJYMCUP.js";import{c as E,d as P,i as A,m as W,p as x,q as $,r as L,s as _,t as B,u as F,v as I,w as J}from"./chunk-7ENJXL4H.js";import{a as S,b as N,c as l,d as v,e as C,f as g}from"./chunk-BW7YYVZE.js";import{isValidAddress as G}from"@crossmint/common-sdk-base";var m,o,R=class{constructor(t,n){v(this,m);v(this,o);let{chain:e,address:i,owner:r,signer:p,options:d}=t;C(this,o,n),this.chain=e,this.address=i,this.owner=r,this.signer=p,C(this,m,d)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return l(this,o)}get options(){return l(this,m)}balances(t,n){return g(this,null,function*(){let e=this.chain==="solana"?"sol":"eth",i=[e,"usdc",...t!=null?t:[]],r=yield l(this,o).getBalance(this.address,{chains:n!=null?n:[this.chain],tokens:i.map(p=>p.toLowerCase())});if("error"in r)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(r.message)}`);return this.transformBalanceResponse(r,e,t)})}transformBalanceResponse(t,n,e){let i=a=>{var w,f,y,T,O;let u=(w=a.chains)==null?void 0:w[this.chain],h="contractAddress"in u?u.contractAddress:void 0;return{symbol:(f=a.symbol)!=null?f:"",name:(y=a.symbol)!=null?y:"",amount:(T=a.amount)!=null?T:"0",contractAddress:h,decimals:a.decimals,rawAmount:(O=a.rawAmount)!=null?O:"0"}},r=t.find(a=>a.symbol===n),p=t.find(a=>a.symbol==="usdc"),d=t.filter(a=>{var u;return a.symbol!==n&&a.symbol!=="usdc"&&(e==null?void 0:e.includes((u=a.symbol)!=null?u:""))}),s=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:r!=null?i(r):s(n),usdc:p!=null?i(p):s("usdc"),tokens:d.map(i)}}experimental_nfts(t){return g(this,null,function*(){return yield l(this,o).experimental_getNfts(N(S({},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return g(this,null,function*(){return yield l(this,o).getTransactions(this.walletLocator)})}experimental_transaction(t){return g(this,null,function*(){return yield l(this,o).getTransaction(this.walletLocator,t)})}experimental_activity(){return g(this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,n,e,i){return g(this,null,function*(){let r=k(t),p=M(n,this.chain),d={recipient:r,amount:e},s=yield l(this,o).send(this.walletLocator,p,d);if("message"in s)throw new $(`Failed to send token: ${JSON.stringify(s.message)}`);return i!=null&&i.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}addDelegatedSigner(t){return g(this,null,function*(){var e,i;let n=yield l(this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in n)throw new Error(`Failed to register signer: ${JSON.stringify(n.message)}`);if("transaction"in n){let r=n.transaction.id;yield this.approveAndWait(r)}else{let r=(e=n.chains)==null?void 0:e[this.chain];if((r==null?void 0:r.status)==="awaiting-approval"){let p=((i=r.approvals)==null?void 0:i.pending)||[];yield this.approveSignature(p,r.id),yield this.waitForSignature(r.id);return}if((r==null?void 0:r.status)==="pending"){yield this.waitForSignature(r.id);return}}})}delegatedSigners(){return g(this,null,function*(){var n,e,i;let t=yield l(this,o).getWallet(this.walletLocator);if("error"in t)throw new P(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new E(`Wallet type ${t.type} not supported`);return(i=(e=(n=t==null?void 0:t.config)==null?void 0:n.delegatedSigners)==null?void 0:e.map(r=>{let p=r.locator.indexOf(":");return{signer:`external-wallet:${p>=0?r.locator.slice(p+1):r.locator}`}}))!=null?i:[]})}get walletLocator(){return l(this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,n){return g(this,null,function*(){return yield this.approveTransaction(t,n),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransaction(t,n){return g(this,null,function*(){var s,a,u,h;let e=yield l(this,o).getTransaction(this.walletLocator,t);if("error"in e)throw new L(JSON.stringify(e));if(yield(u=(a=(s=l(this,m))==null?void 0:s.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:u.call(a),this.signer.type==="api-key")return e;let i=(h=e.approvals)==null?void 0:h.pending;if(i==null)return e;let r=[...n!=null?n:[],this.signer],p=yield Promise.all(i.map(w=>{let f=r.find(T=>T.locator()===w.signer.locator);if(f==null)throw new A(`Signer ${w.signer} not found in pending approvals`);let y=e.chainType==="solana"&&"transaction"in e.onChain?e.onChain.transaction:w.message;return f.signTransaction(y)})),d=yield l(this,o).approveTransaction(this.walletLocator,e.id,{approvals:p.map(w=>S({signer:this.signer.locator()},w))});if(d.error)throw new J(JSON.stringify(d));return d})}approveSignature(t,n){return g(this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let e=t.find(r=>r.signer.locator===this.signer.locator());if(!e)throw new A(`Signer ${this.signer.locator()} not found in pending approvals`);let i=yield this.signer.signMessage(e.message);return yield l(this,o).approveSignature(this.walletLocator,n,{approvals:[S({signer:this.signer.locator()},i)]}),i})}waitForSignature(t){return g(this,null,function*(){let n=null;do if(yield new Promise(e=>setTimeout(e,b)),n=yield l(this,o).getSignature(this.walletLocator,t),"error"in n)throw new x(JSON.stringify(n));while(n===null||n.status==="pending");if(n.status==="failed")throw new W("Signature signing failed");if(!n.outputSignature)throw new x("Signature not available");return n.outputSignature})}waitForTransaction(p){return g(this,arguments,function*(t,n=6e4,{backoffMultiplier:e=1.1,maxBackoffMs:i=2e3,initialBackoffMs:r=b}={}){var u;let d=Date.now(),s;do{if(Date.now()-d>n)throw new _("Transaction confirmation timeout");if(s=yield l(this,o).getTransaction(this.walletLocator,t),s.error)throw new L(JSON.stringify(s));yield this.sleep(r),r=Math.min(r*e,i)}while(s.status==="pending");if(s.status==="failed")throw new B(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new F("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=s.onChain.txId;if(a==null)throw new I("Transaction hash not found on transaction response");return{hash:a,explorerLink:(u=s.onChain.explorerLink)!=null?u:"",transactionId:s.id}})}sleep(t){return g(this,null,function*(){return new Promise(n=>setTimeout(n,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function M(c,t){return G(c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}export{R as a};
|
package/dist/chunk-JCXMSLR4.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZMPR4ZA2cjs = require('./chunk-ZMPR4ZA2.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m,o,R= exports.a =class{constructor(t,n){_chunkXALFCQKDcjs.d.call(void 0, this,m);_chunkXALFCQKDcjs.d.call(void 0, this,o);let{chain:e,address:i,owner:r,signer:p,options:d}=t;_chunkXALFCQKDcjs.e.call(void 0, this,o,n),this.chain=e,this.address=i,this.owner=r,this.signer=p,_chunkXALFCQKDcjs.e.call(void 0, this,m,d)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,o)}get options(){return _chunkXALFCQKDcjs.c.call(void 0, this,m)}balances(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=this.chain==="solana"?"sol":"eth",i=[e,"usdc",...t!=null?t:[]],r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getBalance(this.address,{chains:n!=null?n:[this.chain],tokens:i.map(p=>p.toLowerCase())});if("error"in r)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(r.message)}`);return this.transformBalanceResponse(r,e,t)})}transformBalanceResponse(t,n,e){let i=a=>{var w,f,y,T,O;let u=(w=a.chains)==null?void 0:w[this.chain],h="contractAddress"in u?u.contractAddress:void 0;return{symbol:(f=a.symbol)!=null?f:"",name:(y=a.symbol)!=null?y:"",amount:(T=a.amount)!=null?T:"0",contractAddress:h,decimals:a.decimals,rawAmount:(O=a.rawAmount)!=null?O:"0"}},r=t.find(a=>a.symbol===n),p=t.find(a=>a.symbol==="usdc"),d=t.filter(a=>{var u;return a.symbol!==n&&a.symbol!=="usdc"&&(e==null?void 0:e.includes((u=a.symbol)!=null?u:""))}),s=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:r!=null?i(r):s(n),usdc:p!=null?i(p):s("usdc"),tokens:d.map(i)}}experimental_nfts(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).experimental_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransactions(this.walletLocator)})}experimental_transaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t)})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,n,e,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=k(t),p=M(n,this.chain),d={recipient:r,amount:e},s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).send(this.walletLocator,p,d);if("message"in s)throw new (0, _chunkCT2UGJELcjs.q)(`Failed to send token: ${JSON.stringify(s.message)}`);return i!=null&&i.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}addDelegatedSigner(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e,i;let n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in n)throw new Error(`Failed to register signer: ${JSON.stringify(n.message)}`);if("transaction"in n){let r=n.transaction.id;yield this.approveAndWait(r)}else{let r=(e=n.chains)==null?void 0:e[this.chain];if((r==null?void 0:r.status)==="awaiting-approval"){let p=((i=r.approvals)==null?void 0:i.pending)||[];yield this.approveSignature(p,r.id),yield this.waitForSignature(r.id);return}if((r==null?void 0:r.status)==="pending"){yield this.waitForSignature(r.id);return}}})}delegatedSigners(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,e,i;let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getWallet(this.walletLocator);if("error"in t)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new (0, _chunkCT2UGJELcjs.c)(`Wallet type ${t.type} not supported`);return(i=(e=(n=t==null?void 0:t.config)==null?void 0:n.delegatedSigners)==null?void 0:e.map(r=>{let p=r.locator.indexOf(":");return{signer:`external-wallet:${p>=0?r.locator.slice(p+1):r.locator}`}}))!=null?i:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransaction(t,n),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransaction(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s,a,u,h;let e=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);if("error"in e)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(e));if(yield(u=(a=(s=_chunkXALFCQKDcjs.c.call(void 0, this,m))==null?void 0:s.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:u.call(a),this.signer.type==="api-key")return e;let i=(h=e.approvals)==null?void 0:h.pending;if(i==null)return e;let r=[...n!=null?n:[],this.signer],p=yield Promise.all(i.map(w=>{let f=r.find(T=>T.locator()===w.signer.locator);if(f==null)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${w.signer} not found in pending approvals`);let y=e.chainType==="solana"&&"transaction"in e.onChain?e.onChain.transaction:w.message;return f.signTransaction(y)})),d=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveTransaction(this.walletLocator,e.id,{approvals:p.map(w=>_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},w))});if(d.error)throw new (0, _chunkCT2UGJELcjs.w)(JSON.stringify(d));return d})}approveSignature(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let e=t.find(r=>r.signer.locator===this.signer.locator());if(!e)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${this.signer.locator()} not found in pending approvals`);let i=yield this.signer.signMessage(e.message);return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveSignature(this.walletLocator,n,{approvals:[_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},i)]}),i})}waitForSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=null;do if(yield new Promise(e=>setTimeout(e,_chunkZMPR4ZA2cjs.d)),n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getSignature(this.walletLocator,t),"error"in n)throw new (0, _chunkCT2UGJELcjs.p)(JSON.stringify(n));while(n===null||n.status==="pending");if(n.status==="failed")throw new (0, _chunkCT2UGJELcjs.m)("Signature signing failed");if(!n.outputSignature)throw new (0, _chunkCT2UGJELcjs.p)("Signature not available");return n.outputSignature})}waitForTransaction(p){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(t,n=6e4,{backoffMultiplier:e=1.1,maxBackoffMs:i=2e3,initialBackoffMs:r=_chunkZMPR4ZA2cjs.d}={}){var u;let d=Date.now(),s;do{if(Date.now()-d>n)throw new (0, _chunkCT2UGJELcjs.s)("Transaction confirmation timeout");if(s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t),s.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(s));yield this.sleep(r),r=Math.min(r*e,i)}while(s.status==="pending");if(s.status==="failed")throw new (0, _chunkCT2UGJELcjs.t)(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new (0, _chunkCT2UGJELcjs.u)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=s.onChain.txId;if(a==null)throw new (0, _chunkCT2UGJELcjs.v)("Transaction hash not found on transaction response");return{hash:a,explorerLink:(u=s.onChain.explorerLink)!=null?u:"",transactionId:s.id}})}sleep(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(n=>setTimeout(n,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function M(c,t){return _commonsdkbase.isValidAddress.call(void 0, c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}exports.a = R;
|
package/dist/chunk-KH5LXU3K.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNWOKSI3Vcjs = require('./chunk-NWOKSI3V.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var _viem = require('viem');var g=class c extends _chunkNWOKSI3Vcjs.a{constructor(t){super(t)}locator(){return this.config.locator}signMessage(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=_viem.isHex.call(void 0, t)?t:_viem.toHex.call(void 0, t),i=_ox.PersonalMessage.getSignPayload(n);return yield this.sign(i)})}signTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.sign(t)})}sign(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s;yield this.handleAuthRequired();let n=this.getJwtOrThrow(),i=t.replace("0x",""),e=yield(s=this.config.clientTEEConnection)==null?void 0:s.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:n,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:i,encoding:"hex"}},options:_chunkNWOKSI3Vcjs.b});if((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(t){if(t==null)throw new Error("No public key found");if(t.encoding!=="hex"||t.keyType!=="secp256k1"||t.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(t))}static publicKeyToEvmAddress(t){let n=_ox.PublicKey.from(`0x${t}`);return _ox.Address.fromPublicKey(n,{checksum:!0})}};exports.a = g;
|