@getpara/user-management-client 2.0.0-alpha.3 → 2.0.0-alpha.30

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.
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": false
4
+ }
@@ -0,0 +1,81 @@
1
+ import "../chunk-BBZEL7EG.js";
2
+ const AUTH_TYPES = [
3
+ "email",
4
+ "phone",
5
+ "phoneLegacy",
6
+ "farcaster",
7
+ "telegram",
8
+ "userId",
9
+ "externalWallet",
10
+ "discord",
11
+ "x",
12
+ "customId",
13
+ "guestId"
14
+ ];
15
+ var EncryptorType = /* @__PURE__ */ ((EncryptorType2) => {
16
+ EncryptorType2["USER"] = "USER";
17
+ EncryptorType2["RECOVERY"] = "RECOVERY";
18
+ EncryptorType2["BIOMETRICS"] = "BIOMETRICS";
19
+ EncryptorType2["PASSWORD"] = "PASSWORD";
20
+ return EncryptorType2;
21
+ })(EncryptorType || {});
22
+ var KeyShareType = /* @__PURE__ */ ((KeyShareType2) => {
23
+ KeyShareType2["USER"] = "USER";
24
+ KeyShareType2["RECOVERY"] = "RECOVERY";
25
+ return KeyShareType2;
26
+ })(KeyShareType || {});
27
+ var PasswordStatus = /* @__PURE__ */ ((PasswordStatus2) => {
28
+ PasswordStatus2["PENDING"] = "PENDING";
29
+ PasswordStatus2["COMPLETE"] = "COMPLETE";
30
+ return PasswordStatus2;
31
+ })(PasswordStatus || {});
32
+ var PublicKeyStatus = /* @__PURE__ */ ((PublicKeyStatus2) => {
33
+ PublicKeyStatus2["PENDING"] = "PENDING";
34
+ PublicKeyStatus2["COMPLETE"] = "COMPLETE";
35
+ return PublicKeyStatus2;
36
+ })(PublicKeyStatus || {});
37
+ var PublicKeyType = /* @__PURE__ */ ((PublicKeyType2) => {
38
+ PublicKeyType2["MOBILE"] = "MOBILE";
39
+ PublicKeyType2["WEB"] = "WEB";
40
+ return PublicKeyType2;
41
+ })(PublicKeyType || {});
42
+ var OAuthMethod = /* @__PURE__ */ ((OAuthMethod2) => {
43
+ OAuthMethod2["GOOGLE"] = "GOOGLE";
44
+ OAuthMethod2["TWITTER"] = "TWITTER";
45
+ OAuthMethod2["APPLE"] = "APPLE";
46
+ OAuthMethod2["DISCORD"] = "DISCORD";
47
+ OAuthMethod2["FACEBOOK"] = "FACEBOOK";
48
+ OAuthMethod2["FARCASTER"] = "FARCASTER";
49
+ OAuthMethod2["TELEGRAM"] = "TELEGRAM";
50
+ return OAuthMethod2;
51
+ })(OAuthMethod || {});
52
+ const OAUTH_METHODS = ["GOOGLE", "TWITTER", "APPLE", "DISCORD", "FACEBOOK", "FARCASTER", "TELEGRAM"];
53
+ const LINKED_ACCOUNT_TYPES = [
54
+ "EMAIL",
55
+ "PHONE",
56
+ "GOOGLE",
57
+ "FACEBOOK",
58
+ "APPLE",
59
+ "TWITTER",
60
+ "DISCORD",
61
+ "TELEGRAM",
62
+ "FARCASTER",
63
+ "EXTERNAL_WALLET"
64
+ ];
65
+ var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
66
+ AuthMethod2["PASSWORD"] = "PASSWORD";
67
+ AuthMethod2["PASSKEY"] = "PASSKEY";
68
+ return AuthMethod2;
69
+ })(AuthMethod || {});
70
+ export {
71
+ AUTH_TYPES,
72
+ AuthMethod,
73
+ EncryptorType,
74
+ KeyShareType,
75
+ LINKED_ACCOUNT_TYPES,
76
+ OAUTH_METHODS,
77
+ OAuthMethod,
78
+ PasswordStatus,
79
+ PublicKeyStatus,
80
+ PublicKeyType
81
+ };
@@ -0,0 +1,9 @@
1
+ import "../chunk-BBZEL7EG.js";
2
+ var EmailTheme = /* @__PURE__ */ ((EmailTheme2) => {
3
+ EmailTheme2["LIGHT"] = "light";
4
+ EmailTheme2["DARK"] = "dark";
5
+ return EmailTheme2;
6
+ })(EmailTheme || {});
7
+ export {
8
+ EmailTheme
9
+ };
@@ -0,0 +1,5 @@
1
+ export * from "./auth.js";
2
+ export * from "./email.js";
3
+ export * from "./onRamp.js";
4
+ export * from "./partner.js";
5
+ export * from "./wallet.js";
@@ -0,0 +1,38 @@
1
+ import "../chunk-BBZEL7EG.js";
2
+ var OnRampProvider = /* @__PURE__ */ ((OnRampProvider2) => {
3
+ OnRampProvider2["RAMP"] = "RAMP";
4
+ OnRampProvider2["STRIPE"] = "STRIPE";
5
+ OnRampProvider2["MOONPAY"] = "MOONPAY";
6
+ return OnRampProvider2;
7
+ })(OnRampProvider || {});
8
+ var OnRampAsset = /* @__PURE__ */ ((OnRampAsset2) => {
9
+ OnRampAsset2["ETHEREUM"] = "ETHEREUM";
10
+ OnRampAsset2["USDC"] = "USDC";
11
+ OnRampAsset2["TETHER"] = "TETHER";
12
+ OnRampAsset2["POLYGON"] = "POLYGON";
13
+ OnRampAsset2["SOLANA"] = "SOLANA";
14
+ OnRampAsset2["ATOM"] = "ATOM";
15
+ OnRampAsset2["CELO"] = "CELO";
16
+ OnRampAsset2["CUSD"] = "CUSD";
17
+ OnRampAsset2["CEUR"] = "CEUR";
18
+ OnRampAsset2["CREAL"] = "CREAL";
19
+ OnRampAsset2["BERA"] = "BERA";
20
+ return OnRampAsset2;
21
+ })(OnRampAsset || {});
22
+ var OnRampPurchaseStatus = /* @__PURE__ */ ((OnRampPurchaseStatus2) => {
23
+ OnRampPurchaseStatus2["INITIATED"] = "INITIATED";
24
+ OnRampPurchaseStatus2["FINISHED"] = "FINISHED";
25
+ OnRampPurchaseStatus2["CANCELLED"] = "CANCELLED";
26
+ return OnRampPurchaseStatus2;
27
+ })(OnRampPurchaseStatus || {});
28
+ var OnRampPurchaseType = /* @__PURE__ */ ((OnRampPurchaseType2) => {
29
+ OnRampPurchaseType2["BUY"] = "BUY";
30
+ OnRampPurchaseType2["SELL"] = "SELL";
31
+ return OnRampPurchaseType2;
32
+ })(OnRampPurchaseType || {});
33
+ export {
34
+ OnRampAsset,
35
+ OnRampProvider,
36
+ OnRampPurchaseStatus,
37
+ OnRampPurchaseType
38
+ };
File without changes
@@ -0,0 +1,79 @@
1
+ import "../chunk-BBZEL7EG.js";
2
+ var WalletScheme = /* @__PURE__ */ ((WalletScheme2) => {
3
+ WalletScheme2["DKLS"] = "DKLS";
4
+ WalletScheme2["CGGMP"] = "CGGMP";
5
+ WalletScheme2["ED25519"] = "ED25519";
6
+ return WalletScheme2;
7
+ })(WalletScheme || {});
8
+ const WALLET_SCHEMES = ["DKLS", "CGGMP", "ED25519"];
9
+ var WalletType = /* @__PURE__ */ ((WalletType2) => {
10
+ WalletType2["EVM"] = "EVM";
11
+ WalletType2["SOLANA"] = "SOLANA";
12
+ WalletType2["COSMOS"] = "COSMOS";
13
+ return WalletType2;
14
+ })(WalletType || {});
15
+ const WALLET_TYPES = ["EVM", "SOLANA", "COSMOS"];
16
+ var Chain = /* @__PURE__ */ ((Chain2) => {
17
+ Chain2["ETH"] = "ETH";
18
+ Chain2["CELO"] = "CELO";
19
+ Chain2["MATIC"] = "MATIC";
20
+ return Chain2;
21
+ })(Chain || {});
22
+ var Network = /* @__PURE__ */ ((Network2) => {
23
+ Network2["ETHEREUM"] = "ETHEREUM";
24
+ Network2["SEPOLIA"] = "SEPOLIA";
25
+ Network2["ARBITRUM"] = "ARBITRUM";
26
+ Network2["BASE"] = "BASE";
27
+ Network2["OPTIMISM"] = "OPTIMISM";
28
+ Network2["POLYGON"] = "POLYGON";
29
+ Network2["SOLANA"] = "SOLANA";
30
+ Network2["COSMOS"] = "COSMOS";
31
+ Network2["CELO"] = "CELO";
32
+ Network2["NOBLE"] = "NOBLE";
33
+ Network2["SOLANA_DEVNET"] = "SOLANA_DEVNET";
34
+ Network2["BERACHAIN"] = "BERACHAIN";
35
+ return Network2;
36
+ })(Network || {});
37
+ const PREGEN_IDENTIFIER_TYPES = [
38
+ "EMAIL",
39
+ "PHONE",
40
+ "CUSTOM_ID",
41
+ "GUEST_ID",
42
+ "DISCORD",
43
+ "TWITTER",
44
+ "TELEGRAM",
45
+ "FARCASTER"
46
+ ];
47
+ const NON_ED25519 = ["DKLS", "CGGMP"];
48
+ const EVM_WALLETS = [
49
+ "METAMASK",
50
+ "RAINBOW",
51
+ "COINBASE",
52
+ "WALLETCONNECT",
53
+ "FARCASTER",
54
+ "ZERION",
55
+ "SAFE",
56
+ "RABBY",
57
+ "OKX",
58
+ "HAHA",
59
+ "BACKPACK",
60
+ "PHANTOM",
61
+ "VALORA"
62
+ ];
63
+ const SOLANA_WALLETS = ["PHANTOM", "GLOW", "BACKPACK", "SOLFLARE"];
64
+ const COSMOS_WALLETS = ["KEPLR", "LEAP", "COSMOSTATION"];
65
+ const EXTERNAL_WALLET_TYPES = [.../* @__PURE__ */ new Set([...EVM_WALLETS, ...SOLANA_WALLETS, ...COSMOS_WALLETS])];
66
+ export {
67
+ COSMOS_WALLETS,
68
+ Chain,
69
+ EVM_WALLETS,
70
+ EXTERNAL_WALLET_TYPES,
71
+ NON_ED25519,
72
+ Network,
73
+ PREGEN_IDENTIFIER_TYPES,
74
+ SOLANA_WALLETS,
75
+ WALLET_SCHEMES,
76
+ WALLET_TYPES,
77
+ WalletScheme,
78
+ WalletType
79
+ };
@@ -0,0 +1,215 @@
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "./chunk-BBZEL7EG.js";
5
+ import parsePhoneNumberFromString from "libphonenumber-js";
6
+ function isWalletId(params) {
7
+ return !!params.walletId && !params.externalWalletAddress;
8
+ }
9
+ function isExternalWalletAddress(params) {
10
+ return !!params.externalWalletAddress && !params.walletId;
11
+ }
12
+ function extractWalletRef(params) {
13
+ if (isWalletId(params)) {
14
+ return ["walletId", params.walletId];
15
+ } else if (isExternalWalletAddress(params)) {
16
+ return ["externalWalletAddress", params.externalWalletAddress];
17
+ }
18
+ throw new Error("invalid wallet params");
19
+ }
20
+ function isValid(s) {
21
+ return !!s && s !== "null" && s !== "undefined" && s !== "";
22
+ }
23
+ function isEmail(params) {
24
+ return !!params && isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
25
+ }
26
+ function isPhone(params) {
27
+ return !!params && isValid(params.phone) && /^\+\d+$/.test(params.phone) && !isValid(params.countryCode) && !isValid(params.email) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.userId) && !isValid(params.externalWalletAddress);
28
+ }
29
+ function isPhoneLegacy(params) {
30
+ return !!params && isValid(params.phone) && isValid(params.countryCode) && !isValid(params.email) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
31
+ }
32
+ function isFarcaster(params) {
33
+ return !!params && isValid(params.farcasterUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
34
+ }
35
+ function isTelegram(params) {
36
+ return !!params && isValid(params.telegramUserId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
37
+ }
38
+ function isExternalWallet(params) {
39
+ return !!params && isValid(params.externalWalletAddress) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId);
40
+ }
41
+ function isX(params) {
42
+ return !!params && isValid(params.xUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
43
+ }
44
+ function isDiscord(params) {
45
+ return !!params && isValid(params.discordUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
46
+ }
47
+ function isCustomId(params) {
48
+ return !!params && isValid(params.customId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.externalWalletAddress);
49
+ }
50
+ function isGuestId(params) {
51
+ return !!params && isValid(params.guestId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
52
+ }
53
+ function isUserId(params) {
54
+ return !!params && isValid(params.userId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.telegramUserId) && !isValid(params.externalWalletAddress);
55
+ }
56
+ function isPrimary(params) {
57
+ return isEmail(params) || isPhone(params) || isFarcaster(params) || isTelegram(params) || isExternalWallet(params);
58
+ }
59
+ function isVerifiedAuth(params) {
60
+ return isEmail(params) || isPhone(params);
61
+ }
62
+ function isPregenAuth(params) {
63
+ return isPrimary(params) && !isExternalWallet(params) || isX(params) || isDiscord(params) || isCustomId(params);
64
+ }
65
+ function extractAuthInfo(obj, { allowUserId = false, allowPregen = false, isRequired = false } = {}) {
66
+ obj = Object.entries(obj || {}).reduce((acc, [k, v]) => {
67
+ return __spreadValues(__spreadValues({}, acc), !!v && v !== "null" && v !== "undefined" && v !== "" ? { [k]: v } : {});
68
+ }, {});
69
+ let error;
70
+ switch (true) {
71
+ case isEmail(obj):
72
+ return {
73
+ auth: { email: obj.email },
74
+ authType: "email",
75
+ identifier: obj.email
76
+ };
77
+ case isPhone(obj):
78
+ if (!parsePhoneNumberFromString(obj.phone)) {
79
+ error = "invalid phone number";
80
+ break;
81
+ }
82
+ return {
83
+ auth: { phone: obj.phone },
84
+ authType: "phone",
85
+ identifier: obj.phone
86
+ };
87
+ case isPhoneLegacy(obj):
88
+ const identifier = `${obj.countryCode.startsWith("+") ? "" : "+"}${obj.countryCode}${obj.phone}`;
89
+ if (!parsePhoneNumberFromString(identifier)) {
90
+ error = "invalid phone number";
91
+ break;
92
+ }
93
+ return {
94
+ auth: { phone: identifier },
95
+ authType: "phone",
96
+ identifier
97
+ };
98
+ case isFarcaster(obj):
99
+ return {
100
+ auth: { farcasterUsername: obj.farcasterUsername },
101
+ authType: "farcaster",
102
+ identifier: obj.farcasterUsername
103
+ };
104
+ case isTelegram(obj):
105
+ return {
106
+ auth: { telegramUserId: obj.telegramUserId },
107
+ authType: "telegram",
108
+ identifier: obj.telegramUserId
109
+ };
110
+ case isExternalWallet(obj):
111
+ return {
112
+ auth: { externalWalletAddress: obj.externalWalletAddress },
113
+ authType: "externalWallet",
114
+ identifier: obj.externalWalletAddress
115
+ };
116
+ case (allowPregen && isX(obj)):
117
+ return {
118
+ auth: { xUsername: obj.xUsername },
119
+ authType: "x",
120
+ identifier: obj.xUsername
121
+ };
122
+ case (allowPregen && isDiscord(obj)):
123
+ return {
124
+ auth: { discordUsername: obj.discordUsername },
125
+ authType: "discord",
126
+ identifier: obj.discordUsername
127
+ };
128
+ case (allowPregen && isCustomId(obj)):
129
+ return {
130
+ auth: { customId: obj.customId },
131
+ authType: "customId",
132
+ identifier: obj.customId
133
+ };
134
+ case (allowPregen && isGuestId(obj)):
135
+ return {
136
+ auth: { guestId: obj.guestId },
137
+ authType: "guestId",
138
+ identifier: obj.guestId
139
+ };
140
+ case (isUserId(obj) && allowUserId):
141
+ return {
142
+ auth: { userId: obj.userId },
143
+ authType: "userId",
144
+ identifier: obj.userId
145
+ };
146
+ default:
147
+ break;
148
+ }
149
+ if (isRequired) {
150
+ throw new Error(error != null ? error : "invalid auth object");
151
+ }
152
+ return void 0;
153
+ }
154
+ function toPregenTypeAndId(auth) {
155
+ const { authType, identifier: pregenIdentifier } = extractAuthInfo(auth, { isRequired: true, allowPregen: true });
156
+ const pregenIdentifierType = {
157
+ email: "EMAIL",
158
+ phone: "PHONE",
159
+ farcaster: "FARCASTER",
160
+ telegram: "TELEGRAM",
161
+ discord: "DISCORD",
162
+ x: "TWITTER",
163
+ customId: "CUSTOM_ID",
164
+ guestId: "GUEST_ID"
165
+ }[authType];
166
+ return [pregenIdentifierType, pregenIdentifier];
167
+ }
168
+ function toPregenIds(auth) {
169
+ const [pregenIdentifierType, pregenIdentifier] = toPregenTypeAndId(auth);
170
+ return { [pregenIdentifierType]: [pregenIdentifier] };
171
+ }
172
+ function fromAccountMetadata(obj) {
173
+ return Object.entries(obj || {}).reduce(
174
+ (acc, [method, obj2]) => __spreadProps(__spreadValues({}, acc), {
175
+ [method]: __spreadProps(__spreadValues({}, obj2), {
176
+ date: new Date(obj2.date)
177
+ })
178
+ }),
179
+ {}
180
+ );
181
+ }
182
+ function fromLinkedAccounts({ primary, linked }) {
183
+ return {
184
+ primary: primary.map((account) => __spreadProps(__spreadValues({}, account), {
185
+ date: new Date(account.date)
186
+ })),
187
+ linked: linked.map((account) => __spreadProps(__spreadValues({}, account), {
188
+ date: new Date(account.date)
189
+ }))
190
+ };
191
+ }
192
+ export {
193
+ extractAuthInfo,
194
+ extractWalletRef,
195
+ fromAccountMetadata,
196
+ fromLinkedAccounts,
197
+ isCustomId,
198
+ isDiscord,
199
+ isEmail,
200
+ isExternalWallet,
201
+ isExternalWalletAddress,
202
+ isFarcaster,
203
+ isGuestId,
204
+ isPhone,
205
+ isPhoneLegacy,
206
+ isPregenAuth,
207
+ isPrimary,
208
+ isTelegram,
209
+ isUserId,
210
+ isVerifiedAuth,
211
+ isWalletId,
212
+ isX,
213
+ toPregenIds,
214
+ toPregenTypeAndId
215
+ };
@@ -1,5 +1,5 @@
1
1
  import { AxiosResponse } from 'axios';
2
- import { Auth, AuthIdentifier, AuthMethod, BackupKitEmailProps, BiometricLocationHint, Chain, CurrentWalletIds, EncryptedKeyShare, EncryptorType, ExternalWalletInfo, LoginExternalWalletResponse, KeyShareType, Network, OnRampAsset, OnRampConfig, OnRampProvider, OnRampPurchase, OnRampPurchaseCreateParams, OnRampPurchaseUpdateParams, PasswordStatus, PregenIds, PrimaryAuth, PublicKeyStatus, PublicKeyType, ServerAuthStateSignup, SessionInfo, Setup2faResponse, SignUpOrLogInResponse, TelegramAuthResponse, TPregenIdentifierType, VerificationEmailProps, VerifiedAuth, VerifyFarcasterResponse, VerifyTelegramResponse, VerifyThirdPartyAuth, WalletEntity, WalletParams, WalletScheme, WalletType, VerifyExternalWalletParams } from './types/index.js';
2
+ import { AccountMetadata, Auth, AuthIdentifier, AuthMethod, BackupKitEmailProps, BiometricLocationHint, Chain, CurrentWalletIds, EncryptedKeyShare, EncryptorType, ExternalWalletInfo, LoginExternalWalletResponse, KeyShareType, Network, OnRampAsset, OnRampConfig, OnRampProvider, OnRampPurchase, OnRampPurchaseCreateParams, OnRampPurchaseUpdateParams, PasswordStatus, PregenIds, PrimaryAuth, PublicKeyStatus, PublicKeyType, ServerAuthStateSignup, SessionInfo, Setup2faResponse, SignUpOrLogInResponse, TelegramAuthResponse, TPregenIdentifierType, VerificationEmailProps, VerifiedAuth, VerifyFarcasterResponse, VerifyTelegramResponse, VerifyThirdPartyAuth, WalletEntity, WalletParams, TWalletScheme, TWalletType, VerifyExternalWalletParams, IssueJwtParams, IssueJwtResponse, LinkAccountParams, LinkedAccounts, ResendVerificationCodeParams } from './types/index.js';
3
3
  interface ConfigOpts {
4
4
  useFetchAdapter?: boolean;
5
5
  }
@@ -70,8 +70,8 @@ interface PasswordEntity {
70
70
  }
71
71
  interface createWalletBody {
72
72
  useTwoSigners?: boolean;
73
- scheme: WalletScheme;
74
- type: WalletType;
73
+ scheme: TWalletScheme;
74
+ type: TWalletType;
75
75
  cosmosPrefix?: string;
76
76
  }
77
77
  interface updatePregenWalletBody {
@@ -82,11 +82,14 @@ interface createWalletRes {
82
82
  protocolId: string;
83
83
  walletId: string;
84
84
  }
85
+ interface GetWalletBalanceRes {
86
+ balance: string;
87
+ }
85
88
  interface createPregenWalletBody {
86
89
  pregenIdentifier: string;
87
90
  pregenIdentifierType: TPregenIdentifierType;
88
- scheme?: WalletScheme;
89
- type: WalletType;
91
+ scheme?: TWalletScheme;
92
+ type: TWalletType;
90
93
  cosmosPrefix?: string;
91
94
  }
92
95
  interface claimPreGenWalletsBody {
@@ -96,11 +99,13 @@ interface claimPreGenWalletsBody {
96
99
  interface signTransactionBody {
97
100
  transaction: string;
98
101
  chainId: string;
102
+ protocolId?: string;
99
103
  }
100
104
  interface sendTransactionBody {
101
105
  transaction: string;
102
106
  chain?: Chain;
103
107
  chainId?: string;
108
+ protocolId?: string;
104
109
  }
105
110
  interface AcceptScopesBody {
106
111
  scopeIds: string[];
@@ -113,6 +118,15 @@ interface sessionPasswordBody {
113
118
  encryptedWalletPrivateKey?: string;
114
119
  encryptionKeyHash?: string;
115
120
  }
121
+ interface EncryptedWalletPrivateKey {
122
+ id: string;
123
+ userId: string;
124
+ encryptedPrivateKey: string;
125
+ encryptionKeyHash: string;
126
+ biometricPublicKey?: string;
127
+ passwordId?: string;
128
+ }
129
+ export type SDKType = 'WEB' | 'SERVER' | 'BRIDGE' | 'REACT_NATIVE';
116
130
  export type VerifyTelegramRes = {
117
131
  isValid: true;
118
132
  userId: string;
@@ -141,6 +155,34 @@ declare class Client {
141
155
  shouldTrackUser?: boolean;
142
156
  }) => Promise<LoginExternalWalletResponse>;
143
157
  verifyNewAccount: (userId: string, body: verifyBody) => Promise<ServerAuthStateSignup>;
158
+ getLinkedAccounts: ({ userId, withMetadata, }: {
159
+ userId: string;
160
+ withMetadata?: boolean;
161
+ }) => Promise<{
162
+ accounts: LinkedAccounts;
163
+ }>;
164
+ linkAccount: ({ userId, ...opts }: LinkAccountParams & {
165
+ userId: string;
166
+ }) => Promise<{
167
+ linkedAccountId: string;
168
+ signatureVerificationMessage?: string;
169
+ } | {
170
+ isConflict: true;
171
+ }>;
172
+ verifyLink: ({ linkedAccountId, userId, ...opts }: {
173
+ linkedAccountId: string;
174
+ userId: string;
175
+ telegramAuthResponse?: TelegramAuthResponse;
176
+ verificationCode?: string;
177
+ } & Partial<VerifyExternalWalletParams>) => Promise<{
178
+ accounts: LinkedAccounts;
179
+ } | {
180
+ isConflict: true;
181
+ }>;
182
+ unlinkAccount: ({ linkedAccountId, userId }: {
183
+ linkedAccountId: string;
184
+ userId: string;
185
+ }) => Promise<LinkedAccounts>;
144
186
  /**
145
187
  * @deprecated
146
188
  */
@@ -185,7 +227,7 @@ declare class Client {
185
227
  logout: () => Promise<any>;
186
228
  recoveryVerification: (email: string, verificationCode: string) => Promise<any>;
187
229
  recoveryInit: (email: string) => Promise<any>;
188
- preSignMessage: (userId: string, walletId: string, message: string, scheme?: WalletScheme, cosmosSignDoc?: string) => Promise<any>;
230
+ preSignMessage: (userId: string, walletId: string, message: string, scheme?: TWalletScheme, cosmosSignDoc?: string, protocolId?: string) => Promise<any>;
189
231
  deleteSelf: (userId: string) => Promise<any>;
190
232
  uploadKeyshares(userId: string, walletId: string, encryptedKeyshares: EncryptedKeyShare[]): Promise<any>;
191
233
  uploadUserKeyShares(userId: string, encryptedKeyshares: (EncryptedKeyShare & {
@@ -202,10 +244,8 @@ declare class Client {
202
244
  }[]): Promise<any>;
203
245
  getTransmissionKeyshares(userId: string, sessionLookupId: string): Promise<any>;
204
246
  getParaShare: (userId: string, walletId: string) => Promise<string>;
205
- getBackupKit: (userId: string) => Promise<any>;
206
- resendVerificationCode({ userId, ...rest }: {
207
- userId: string;
208
- } & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
247
+ getBackupKit: (userId: string, walletId: string) => Promise<any>;
248
+ resendVerificationCode({ userId, ...rest }: ResendVerificationCodeParams): Promise<AxiosResponse<any, any>>;
209
249
  resendVerificationCodeByPhone({ userId, ...rest }: {
210
250
  userId: string;
211
251
  } & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
@@ -214,7 +254,9 @@ declare class Client {
214
254
  enable2FA(userId: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
215
255
  setup2FA(userId: string): Promise<Setup2faResponse>;
216
256
  initializeRecovery(email: string): Promise<AxiosResponse<any, any>>;
217
- initializeFarcasterLogin(): Promise<AxiosResponse<any, any>>;
257
+ initializeFarcasterLogin({ appScheme }?: {
258
+ appScheme?: string;
259
+ }): Promise<any>;
218
260
  getFarcasterAuthStatus(): Promise<VerifyFarcasterResponse>;
219
261
  initializeRecoveryForPhone(phone: string, countryCode: string): Promise<AxiosResponse<any, any>>;
220
262
  finalizeRecovery(userId: string, walletId: string): Promise<AxiosResponse<any, any>>;
@@ -246,7 +288,7 @@ declare class Client {
246
288
  getPendingTransaction(userId: string, pendingTransactionId: string): Promise<AxiosResponse<any, any>>;
247
289
  acceptPendingTransaction(userId: string, pendingTransactionId: string): Promise<AxiosResponse<any, any>>;
248
290
  getOnRampConfig(): Promise<OnRampConfig>;
249
- createOnRampPurchase({ userId, params: { type, walletType, address, provider, networks, assets, defaultNetwork, defaultAsset, fiat, fiatQuantity, testMode, }, ...params }: {
291
+ createOnRampPurchase({ userId, params, ...walletParams }: {
250
292
  userId: string;
251
293
  params: OnRampPurchaseCreateParams;
252
294
  } & WalletParams): Promise<OnRampPurchase>;
@@ -261,7 +303,7 @@ declare class Client {
261
303
  } & WalletParams): Promise<AxiosResponse<OnRampPurchase, any>>;
262
304
  signMoonPayUrl(userId: string, { url, type, cosmosPrefix, testMode, walletId, externalWalletAddress, }: {
263
305
  url: string;
264
- type: WalletType;
306
+ type: TWalletType;
265
307
  cosmosPrefix: string;
266
308
  testMode?: boolean;
267
309
  walletId?: string;
@@ -271,6 +313,7 @@ declare class Client {
271
313
  }, any>>;
272
314
  generateOffRampTx<ReturnType = {
273
315
  tx: string;
316
+ message?: string;
274
317
  asset: OnRampAsset;
275
318
  network: Network;
276
319
  }>(userId: string, { provider, chainId, contractAddress, testMode, walletId, walletType, destinationAddress, sourceAddress, assetQuantity, }: {
@@ -279,19 +322,20 @@ declare class Client {
279
322
  contractAddress?: string;
280
323
  testMode?: boolean;
281
324
  walletId: string;
282
- walletType: WalletType;
325
+ walletType: TWalletType;
283
326
  destinationAddress: string;
284
327
  sourceAddress?: string;
285
328
  assetQuantity: string | number;
286
329
  }): Promise<ReturnType>;
287
330
  sendOffRampTx<ReturnType = {
288
331
  txHash: string;
289
- }>(userId: string, { tx, signature, network, walletId, walletType, }: {
332
+ }>(userId: string, { tx, signature, sourceAddress, network, walletId, walletType, }: {
290
333
  tx: string;
291
334
  signature: string;
335
+ sourceAddress?: string;
292
336
  network: Network;
293
337
  walletId: string;
294
- walletType: WalletType;
338
+ walletType: TWalletType;
295
339
  }): Promise<ReturnType>;
296
340
  distributeParaShare({ userId, walletId, ...rest }: {
297
341
  userId: string;
@@ -311,8 +355,12 @@ declare class Client {
311
355
  publicKey: string;
312
356
  }[];
313
357
  }>;
314
- uploadEncryptedWalletPrivateKey(userId: string, encryptedWalletPrivateKey: string, encryptionKeyHash: string, biometricPublicKey?: string, passwordId?: string): Promise<any>;
315
- getEncryptedWalletPrivateKeys(userId: string, encryptionKeyHash: string): Promise<any>;
358
+ uploadEncryptedWalletPrivateKey(userId: string, encryptedWalletPrivateKey: string, encryptionKeyHash: string, biometricPublicKey?: string, passwordId?: string): Promise<{
359
+ encryptedWalletPrivateKey: EncryptedWalletPrivateKey;
360
+ }>;
361
+ getEncryptedWalletPrivateKeys(userId: string, encryptionKeyHash: string): Promise<{
362
+ encryptedPrivateKeys: EncryptedWalletPrivateKey[];
363
+ }>;
316
364
  getConversionRate(chainId: string, symbol: string, currency: string): Promise<any>;
317
365
  getGasEstimate(chainId: string, totalGasPrice: string): Promise<any>;
318
366
  getGasOracle(chainId: string): Promise<any>;
@@ -325,7 +373,32 @@ declare class Client {
325
373
  getSupportedAuthMethods(auth: Auth): Promise<any>;
326
374
  getPasswords(auth: Auth): Promise<PasswordEntity[]>;
327
375
  verifyPasswordChallenge(partnerId: string, body: verifyPasswordChallengeBody): Promise<any>;
328
- getEncryptedWalletPrivateKey(passwordId: string): Promise<any>;
376
+ getEncryptedWalletPrivateKey(passwordId: string): Promise<{
377
+ data: {
378
+ encryptedWalletPrivateKey: EncryptedWalletPrivateKey;
379
+ };
380
+ }>;
329
381
  getUser(userId: string): Promise<any>;
382
+ getAccountMetadata(userId: string, partnerId: string): Promise<{
383
+ accountMetadata: AccountMetadata;
384
+ }>;
385
+ getWalletBalance: ({ walletId, rpcUrl }: {
386
+ walletId: string;
387
+ rpcUrl?: string;
388
+ }) => Promise<GetWalletBalanceRes>;
389
+ issueJwt: ({ keyIndex }?: IssueJwtParams) => Promise<IssueJwtResponse>;
390
+ trackError: (opts: {
391
+ methodName: string;
392
+ error: {
393
+ name: string;
394
+ message: string;
395
+ };
396
+ sdkType: SDKType;
397
+ userId: string;
398
+ }) => Promise<void>;
399
+ trackReactSdkAnalytics: (opts: {
400
+ props: object;
401
+ reactSdkVersion: string;
402
+ }) => Promise<void>;
330
403
  }
331
404
  export default Client;