@frontiertower/frontier-sdk 0.11.2 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -4
- package/dist/index.d.mts +316 -16
- package/dist/index.d.ts +316 -16
- package/dist/index.js +206 -6
- package/dist/index.mjs +206 -6
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -23,12 +23,12 @@ interface SmartAccount {
|
|
|
23
23
|
* Wallet balance breakdown
|
|
24
24
|
*/
|
|
25
25
|
interface WalletBalance {
|
|
26
|
-
/** Total balance including both native and internal
|
|
26
|
+
/** Total balance including both native and internal FND */
|
|
27
27
|
total: bigint;
|
|
28
|
-
/** Native Frontier Dollar balance */
|
|
29
|
-
|
|
30
|
-
/** Internal Frontier Dollar balance (for Network Society) */
|
|
31
|
-
|
|
28
|
+
/** Native Frontier Network Dollar balance */
|
|
29
|
+
fnd: bigint;
|
|
30
|
+
/** Internal Frontier Network Dollar balance (for Network Society) */
|
|
31
|
+
internalFnd: bigint;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Formatted wallet balance breakdown
|
|
@@ -36,10 +36,10 @@ interface WalletBalance {
|
|
|
36
36
|
interface WalletBalanceFormatted {
|
|
37
37
|
/** Total balance formatted with currency symbol */
|
|
38
38
|
total: string;
|
|
39
|
-
/** Native Frontier Dollar balance formatted with currency symbol */
|
|
40
|
-
|
|
41
|
-
/** Internal Frontier Dollar balance formatted with currency symbol */
|
|
42
|
-
|
|
39
|
+
/** Native Frontier Network Dollar balance formatted with currency symbol */
|
|
40
|
+
fnd: string;
|
|
41
|
+
/** Internal Frontier Network Dollar balance formatted with currency symbol */
|
|
42
|
+
internalFnd: string;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Transaction receipt from a user operation
|
|
@@ -130,6 +130,107 @@ interface SwapQuote {
|
|
|
130
130
|
/** Minimum output amount in human-readable format */
|
|
131
131
|
minAmountOut: string;
|
|
132
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* USD deposit instructions for fiat on-ramp
|
|
135
|
+
*/
|
|
136
|
+
interface UsdDepositInstructions {
|
|
137
|
+
/** Currency type */
|
|
138
|
+
currency: 'usd';
|
|
139
|
+
/** Bank name */
|
|
140
|
+
bankName: string;
|
|
141
|
+
/** Bank address */
|
|
142
|
+
bankAddress: string;
|
|
143
|
+
/** Bank routing number (ABA) */
|
|
144
|
+
bankRoutingNumber: string;
|
|
145
|
+
/** Bank account number */
|
|
146
|
+
bankAccountNumber: string;
|
|
147
|
+
/** Beneficiary name for the transfer */
|
|
148
|
+
bankBeneficiaryName: string;
|
|
149
|
+
/** Payment rail (e.g., 'ach', 'wire') */
|
|
150
|
+
paymentRail: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* EUR deposit instructions for fiat on-ramp (SEPA)
|
|
154
|
+
*/
|
|
155
|
+
interface EurDepositInstructions {
|
|
156
|
+
/** Currency type */
|
|
157
|
+
currency: 'eur';
|
|
158
|
+
/** IBAN for SEPA transfer */
|
|
159
|
+
iban: string;
|
|
160
|
+
/** BIC/SWIFT code */
|
|
161
|
+
bic: string;
|
|
162
|
+
/** Bank name */
|
|
163
|
+
bankName: string;
|
|
164
|
+
/** Beneficiary name for the transfer */
|
|
165
|
+
beneficiaryName: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Response containing deposit instructions for fiat on-ramp
|
|
169
|
+
*/
|
|
170
|
+
interface OnRampResponse<T = UsdDepositInstructions | EurDepositInstructions> {
|
|
171
|
+
/** Currency type ('usd' or 'eur') */
|
|
172
|
+
currency: 'usd' | 'eur';
|
|
173
|
+
/** Deposit instructions specific to the currency */
|
|
174
|
+
depositInstructions: T;
|
|
175
|
+
/** Destination address where stablecoins will be sent */
|
|
176
|
+
destinationAddress: string;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Linked bank account for withdrawals (off-ramp)
|
|
180
|
+
*/
|
|
181
|
+
interface LinkedBank {
|
|
182
|
+
/** External account ID */
|
|
183
|
+
id: string;
|
|
184
|
+
/** Bank name */
|
|
185
|
+
bankName: string;
|
|
186
|
+
/** Last 4 digits of account number */
|
|
187
|
+
last4: string;
|
|
188
|
+
/** Withdrawal address for this bank */
|
|
189
|
+
withdrawalAddress: string;
|
|
190
|
+
/** Chain for withdrawals */
|
|
191
|
+
chain: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Response containing linked bank accounts
|
|
195
|
+
*/
|
|
196
|
+
interface LinkedBanksResponse {
|
|
197
|
+
/** List of linked bank accounts */
|
|
198
|
+
banks: LinkedBank[];
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Response from linking a bank account
|
|
202
|
+
*/
|
|
203
|
+
interface LinkBankResponse {
|
|
204
|
+
/** External account ID */
|
|
205
|
+
externalAccountId: string;
|
|
206
|
+
/** Bank name */
|
|
207
|
+
bankName: string;
|
|
208
|
+
/** Withdrawal address for this bank */
|
|
209
|
+
withdrawalAddress: string;
|
|
210
|
+
/** Chain for withdrawals */
|
|
211
|
+
chain: string;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Billing address for bank account linking
|
|
215
|
+
*/
|
|
216
|
+
interface BillingAddress {
|
|
217
|
+
/** Street address line 1 */
|
|
218
|
+
streetLine1: string;
|
|
219
|
+
/** Street address line 2 (optional) */
|
|
220
|
+
streetLine2?: string;
|
|
221
|
+
/** City */
|
|
222
|
+
city: string;
|
|
223
|
+
/** State/Province */
|
|
224
|
+
state: string;
|
|
225
|
+
/** Postal/ZIP code */
|
|
226
|
+
postalCode: string;
|
|
227
|
+
/** Country code (e.g., 'USA') */
|
|
228
|
+
country: string;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Account owner type for IBAN accounts
|
|
232
|
+
*/
|
|
233
|
+
type AccountOwnerType = 'individual' | 'business';
|
|
133
234
|
/**
|
|
134
235
|
* Wallet access class for interacting with the user's wallet
|
|
135
236
|
*
|
|
@@ -148,8 +249,8 @@ declare class WalletAccess {
|
|
|
148
249
|
/**
|
|
149
250
|
* Get the current wallet balance breakdown
|
|
150
251
|
*
|
|
151
|
-
* Returns the balance breakdown including total, native
|
|
152
|
-
* and internal
|
|
252
|
+
* Returns the balance breakdown including total, native FND,
|
|
253
|
+
* and internal FND amounts.
|
|
153
254
|
*
|
|
154
255
|
* @returns Balance breakdown object
|
|
155
256
|
* @throws {Error} If no wallet exists
|
|
@@ -158,7 +259,7 @@ declare class WalletAccess {
|
|
|
158
259
|
* ```typescript
|
|
159
260
|
* const balance = await sdk.getWallet().getBalance();
|
|
160
261
|
* console.log('Total Balance:', balance.total.toString());
|
|
161
|
-
* console.log('
|
|
262
|
+
* console.log('FND Balance:', balance.fnd.toString());
|
|
162
263
|
* ```
|
|
163
264
|
*/
|
|
164
265
|
getBalance(): Promise<WalletBalance>;
|
|
@@ -355,7 +456,7 @@ declare class WalletAccess {
|
|
|
355
456
|
*/
|
|
356
457
|
transferInternalFrontierDollar(to: string, amount: string, overrides?: GasOverrides): Promise<UserOperationReceipt>;
|
|
357
458
|
/**
|
|
358
|
-
* Transfer Frontier Dollars with Internal Frontier Dollars (
|
|
459
|
+
* Transfer Frontier Dollars with Internal Frontier Network Dollars (iFND) preferred
|
|
359
460
|
*
|
|
360
461
|
* This method will use Internal Frontier Dollars first, and if insufficient,
|
|
361
462
|
* it will use regular Frontier Dollars to complete the transfer.
|
|
@@ -411,12 +512,12 @@ declare class WalletAccess {
|
|
|
411
512
|
* Returns an array of token symbols that are supported for swaps
|
|
412
513
|
* and other operations on the current network.
|
|
413
514
|
*
|
|
414
|
-
* @returns Array of token symbols (e.g., ['
|
|
515
|
+
* @returns Array of token symbols (e.g., ['FND', 'USDC', 'WETH'])
|
|
415
516
|
*
|
|
416
517
|
* @example
|
|
417
518
|
* ```typescript
|
|
418
519
|
* const tokens = await sdk.getWallet().getSupportedTokens();
|
|
419
|
-
* console.log('Supported tokens:', tokens); // ['
|
|
520
|
+
* console.log('Supported tokens:', tokens); // ['FND', 'USDC', 'WETH']
|
|
420
521
|
* ```
|
|
421
522
|
*/
|
|
422
523
|
getSupportedTokens(): Promise<string[]>;
|
|
@@ -472,6 +573,153 @@ declare class WalletAccess {
|
|
|
472
573
|
* ```
|
|
473
574
|
*/
|
|
474
575
|
quoteSwap(sourceToken: string, targetToken: string, sourceNetwork: string, targetNetwork: string, amount: string): Promise<SwapQuote>;
|
|
576
|
+
/**
|
|
577
|
+
* Get USD deposit instructions for fiat on-ramp
|
|
578
|
+
*
|
|
579
|
+
* Returns US bank details where user should send their USD deposit.
|
|
580
|
+
* The deposited fiat will be converted to stablecoins and sent to
|
|
581
|
+
* the user's wallet address.
|
|
582
|
+
*
|
|
583
|
+
* Requires approved KYC verification.
|
|
584
|
+
*
|
|
585
|
+
* @returns Bank details including routing number, account number, and beneficiary info
|
|
586
|
+
* @throws {Error} If KYC is not approved
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* ```typescript
|
|
590
|
+
* const instructions = await sdk.getWallet().getUsdDepositInstructions();
|
|
591
|
+
* console.log('Bank:', instructions.depositInstructions.bankName);
|
|
592
|
+
* console.log('Routing:', instructions.depositInstructions.bankRoutingNumber);
|
|
593
|
+
* console.log('Account:', instructions.depositInstructions.bankAccountNumber);
|
|
594
|
+
* console.log('Beneficiary:', instructions.depositInstructions.bankBeneficiaryName);
|
|
595
|
+
* ```
|
|
596
|
+
*/
|
|
597
|
+
getUsdDepositInstructions(): Promise<OnRampResponse<UsdDepositInstructions>>;
|
|
598
|
+
/**
|
|
599
|
+
* Get EUR deposit instructions for fiat on-ramp (SEPA)
|
|
600
|
+
*
|
|
601
|
+
* Returns SEPA bank details where user should send their EUR deposit.
|
|
602
|
+
* The deposited fiat will be converted to stablecoins and sent to
|
|
603
|
+
* the user's wallet address.
|
|
604
|
+
*
|
|
605
|
+
* Requires approved KYC verification.
|
|
606
|
+
*
|
|
607
|
+
* @returns SEPA bank details including IBAN, BIC, and beneficiary info
|
|
608
|
+
* @throws {Error} If KYC is not approved
|
|
609
|
+
*
|
|
610
|
+
* @example
|
|
611
|
+
* ```typescript
|
|
612
|
+
* const instructions = await sdk.getWallet().getEurDepositInstructions();
|
|
613
|
+
* console.log('IBAN:', instructions.depositInstructions.iban);
|
|
614
|
+
* console.log('BIC:', instructions.depositInstructions.bic);
|
|
615
|
+
* console.log('Bank:', instructions.depositInstructions.bankName);
|
|
616
|
+
* console.log('Beneficiary:', instructions.depositInstructions.beneficiaryName);
|
|
617
|
+
* ```
|
|
618
|
+
*/
|
|
619
|
+
getEurDepositInstructions(): Promise<OnRampResponse<EurDepositInstructions>>;
|
|
620
|
+
/**
|
|
621
|
+
* Get all linked bank accounts for withdrawals (off-ramp)
|
|
622
|
+
*
|
|
623
|
+
* Returns a list of bank accounts that have been linked for
|
|
624
|
+
* withdrawing stablecoins to fiat.
|
|
625
|
+
*
|
|
626
|
+
* Requires approved KYC verification.
|
|
627
|
+
*
|
|
628
|
+
* @returns List of linked bank accounts with withdrawal addresses
|
|
629
|
+
* @throws {Error} If KYC is not approved
|
|
630
|
+
*
|
|
631
|
+
* @example
|
|
632
|
+
* ```typescript
|
|
633
|
+
* const { banks } = await sdk.getWallet().getLinkedBanks();
|
|
634
|
+
* banks.forEach(bank => {
|
|
635
|
+
* console.log(`${bank.bankName} (****${bank.last4})`);
|
|
636
|
+
* });
|
|
637
|
+
* ```
|
|
638
|
+
*/
|
|
639
|
+
getLinkedBanks(): Promise<LinkedBanksResponse>;
|
|
640
|
+
/**
|
|
641
|
+
* Link a US bank account for withdrawals (off-ramp)
|
|
642
|
+
*
|
|
643
|
+
* Links a US bank account (checking or savings) for withdrawing
|
|
644
|
+
* stablecoins to USD via ACH transfer.
|
|
645
|
+
*
|
|
646
|
+
* Requires approved KYC verification.
|
|
647
|
+
*
|
|
648
|
+
* @param accountOwnerName - Full name of the account owner
|
|
649
|
+
* @param bankName - Name of the bank (e.g., 'Chase', 'Bank of America')
|
|
650
|
+
* @param routingNumber - Bank routing number (9 digits)
|
|
651
|
+
* @param accountNumber - Bank account number
|
|
652
|
+
* @param checkingOrSavings - Account type: 'checking' or 'savings'
|
|
653
|
+
* @param address - Billing address for the account
|
|
654
|
+
* @returns Linked bank details with withdrawal address
|
|
655
|
+
* @throws {Error} If KYC is not approved or bank details are invalid
|
|
656
|
+
*
|
|
657
|
+
* @example
|
|
658
|
+
* ```typescript
|
|
659
|
+
* const result = await sdk.getWallet().linkUsBankAccount(
|
|
660
|
+
* 'John Doe',
|
|
661
|
+
* 'Chase',
|
|
662
|
+
* '121000248',
|
|
663
|
+
* '1234567890',
|
|
664
|
+
* 'checking',
|
|
665
|
+
* {
|
|
666
|
+
* streetLine1: '123 Main St',
|
|
667
|
+
* city: 'San Francisco',
|
|
668
|
+
* state: 'CA',
|
|
669
|
+
* postalCode: '94102',
|
|
670
|
+
* country: 'USA'
|
|
671
|
+
* }
|
|
672
|
+
* );
|
|
673
|
+
* console.log('Linked bank:', result.bankName);
|
|
674
|
+
* ```
|
|
675
|
+
*/
|
|
676
|
+
linkUsBankAccount(accountOwnerName: string, bankName: string, routingNumber: string, accountNumber: string, checkingOrSavings: 'checking' | 'savings', address: BillingAddress): Promise<LinkBankResponse>;
|
|
677
|
+
/**
|
|
678
|
+
* Link a EUR/IBAN bank account for withdrawals (off-ramp)
|
|
679
|
+
*
|
|
680
|
+
* Links a European bank account via IBAN for withdrawing
|
|
681
|
+
* stablecoins to EUR via SEPA transfer.
|
|
682
|
+
*
|
|
683
|
+
* Requires approved KYC verification.
|
|
684
|
+
*
|
|
685
|
+
* @param accountOwnerName - Full name of the account owner
|
|
686
|
+
* @param accountOwnerType - Type of account owner: 'individual' or 'business'
|
|
687
|
+
* @param firstName - First name of the account owner
|
|
688
|
+
* @param lastName - Last name of the account owner
|
|
689
|
+
* @param ibanAccountNumber - IBAN account number
|
|
690
|
+
* @param bic - Optional BIC/SWIFT code
|
|
691
|
+
* @returns Linked bank details with withdrawal address
|
|
692
|
+
* @throws {Error} If KYC is not approved or bank details are invalid
|
|
693
|
+
*
|
|
694
|
+
* @example
|
|
695
|
+
* ```typescript
|
|
696
|
+
* const result = await sdk.getWallet().linkEuroAccount(
|
|
697
|
+
* 'Hans Mueller',
|
|
698
|
+
* 'individual',
|
|
699
|
+
* 'Hans',
|
|
700
|
+
* 'Mueller',
|
|
701
|
+
* 'DE89370400440532013000',
|
|
702
|
+
* 'COBADEFFXXX' // optional BIC
|
|
703
|
+
* );
|
|
704
|
+
* console.log('Linked bank:', result.bankName);
|
|
705
|
+
* ```
|
|
706
|
+
*/
|
|
707
|
+
linkEuroAccount(accountOwnerName: string, accountOwnerType: AccountOwnerType, firstName: string, lastName: string, ibanAccountNumber: string, bic?: string): Promise<LinkBankResponse>;
|
|
708
|
+
/**
|
|
709
|
+
* Delete a linked bank account
|
|
710
|
+
*
|
|
711
|
+
* Removes a previously linked bank account from the user's off-ramp options.
|
|
712
|
+
*
|
|
713
|
+
* @param bankId - The ID of the linked bank account to delete
|
|
714
|
+
* @throws {Error} If the bank account doesn't exist or deletion fails
|
|
715
|
+
*
|
|
716
|
+
* @example
|
|
717
|
+
* ```typescript
|
|
718
|
+
* await sdk.getWallet().deleteLinkedBank('bank_abc123');
|
|
719
|
+
* console.log('Bank account deleted');
|
|
720
|
+
* ```
|
|
721
|
+
*/
|
|
722
|
+
deleteLinkedBank(bankId: string): Promise<void>;
|
|
475
723
|
}
|
|
476
724
|
|
|
477
725
|
/**
|
|
@@ -767,6 +1015,33 @@ interface UserContact {
|
|
|
767
1015
|
/** Contact name */
|
|
768
1016
|
name: string;
|
|
769
1017
|
}
|
|
1018
|
+
/**
|
|
1019
|
+
* KYC verification status
|
|
1020
|
+
*/
|
|
1021
|
+
type KycStatus = 'not_started' | 'pending' | 'in_review' | 'approved' | 'rejected';
|
|
1022
|
+
/**
|
|
1023
|
+
* Terms of Service acceptance status
|
|
1024
|
+
*/
|
|
1025
|
+
type TosStatus = 'pending' | 'approved';
|
|
1026
|
+
/**
|
|
1027
|
+
* KYC status response
|
|
1028
|
+
*/
|
|
1029
|
+
interface KycStatusResponse {
|
|
1030
|
+
/** Current KYC status */
|
|
1031
|
+
status: KycStatus;
|
|
1032
|
+
/** Whether KYC is approved */
|
|
1033
|
+
isApproved: boolean;
|
|
1034
|
+
/** Reason for rejection (if rejected) */
|
|
1035
|
+
rejectionReason: string | null;
|
|
1036
|
+
/** KYC link ID (if KYC has been started) */
|
|
1037
|
+
kycLinkId: string | null;
|
|
1038
|
+
/** URL to complete KYC verification (if KYC has been started) */
|
|
1039
|
+
kycLinkUrl: string | null;
|
|
1040
|
+
/** Terms of Service acceptance status */
|
|
1041
|
+
tosStatus: TosStatus | null;
|
|
1042
|
+
/** URL to accept Terms of Service */
|
|
1043
|
+
tosLink: string | null;
|
|
1044
|
+
}
|
|
770
1045
|
/**
|
|
771
1046
|
* User contact information payload
|
|
772
1047
|
*/
|
|
@@ -882,6 +1157,31 @@ declare class UserAccess {
|
|
|
882
1157
|
* ```
|
|
883
1158
|
*/
|
|
884
1159
|
addUserContact(data: UserContactPayload): Promise<void>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Get or create KYC status
|
|
1162
|
+
*
|
|
1163
|
+
* Returns the current KYC verification status. If KYC has not been started,
|
|
1164
|
+
* it will be initiated and the response will include a URL to complete verification.
|
|
1165
|
+
*
|
|
1166
|
+
* @param redirectUri - Optional URL to redirect user after KYC completion
|
|
1167
|
+
* @returns KycStatusResponse with status and verification link if applicable
|
|
1168
|
+
* @throws {Error} If user is not authenticated
|
|
1169
|
+
*
|
|
1170
|
+
* @example
|
|
1171
|
+
* ```typescript
|
|
1172
|
+
* const kyc = await sdk.getUser().getOrCreateKyc();
|
|
1173
|
+
* if (kyc.status === 'not_started' && kyc.kycLinkUrl) {
|
|
1174
|
+
* // Redirect user to complete KYC
|
|
1175
|
+
* window.open(kyc.kycLinkUrl, '_blank');
|
|
1176
|
+
* } else if (kyc.isApproved) {
|
|
1177
|
+
* console.log('KYC approved!');
|
|
1178
|
+
* }
|
|
1179
|
+
*
|
|
1180
|
+
* // With redirect URI
|
|
1181
|
+
* const kycWithRedirect = await sdk.getUser().getOrCreateKyc('https://myapp.com/callback');
|
|
1182
|
+
* ```
|
|
1183
|
+
*/
|
|
1184
|
+
getOrCreateKyc(redirectUri?: string): Promise<KycStatusResponse>;
|
|
885
1185
|
}
|
|
886
1186
|
|
|
887
1187
|
/**
|
|
@@ -1598,4 +1898,4 @@ interface SDKResponse {
|
|
|
1598
1898
|
error?: string;
|
|
1599
1899
|
}
|
|
1600
1900
|
|
|
1601
|
-
export { type App, type AppPermission, type AppStatus, ChainAccess, type ChainConfig, type CreateAppRequest, type CreateSponsorPassRequest, type CreateWebhookRequest, type Developer, type ExecuteCall, FrontierSDK, type GasOverrides, type ListParams, type ListSponsorsParams, type PaginatedResponse, PartnershipsAccess, type ReferralDetails, type ReferralOverview, type RotateKeyResponse, type RotateWebhookKeyResponse, type SDKRequest, type SDKResponse, type SmartAccount, type Sponsor, type SponsorPass, type StableCoin, StorageAccess, type SwapParams, type SwapQuote, type SwapResult, SwapResultStatus, ThirdPartyAccess, type Token, Underlying, type UpdateAppRequest, type UpdateDeveloperRequest, type UpdateWebhookRequest, type User, UserAccess, type UserContact, type UserContactPayload, type UserOperationReceipt, type UserProfile, WalletAccess, type WalletBalance, type WalletBalanceFormatted, type Webhook, type WebhookConfig, type WebhookEvent, type WebhookScope, type WebhookStatus };
|
|
1901
|
+
export { type AccountOwnerType, type App, type AppPermission, type AppStatus, type BillingAddress, ChainAccess, type ChainConfig, type CreateAppRequest, type CreateSponsorPassRequest, type CreateWebhookRequest, type Developer, type EurDepositInstructions, type ExecuteCall, FrontierSDK, type GasOverrides, type LinkBankResponse, type LinkedBank, type LinkedBanksResponse, type ListParams, type ListSponsorsParams, type OnRampResponse, type PaginatedResponse, PartnershipsAccess, type ReferralDetails, type ReferralOverview, type RotateKeyResponse, type RotateWebhookKeyResponse, type SDKRequest, type SDKResponse, type SmartAccount, type Sponsor, type SponsorPass, type StableCoin, StorageAccess, type SwapParams, type SwapQuote, type SwapResult, SwapResultStatus, ThirdPartyAccess, type Token, Underlying, type UpdateAppRequest, type UpdateDeveloperRequest, type UpdateWebhookRequest, type UsdDepositInstructions, type User, UserAccess, type UserContact, type UserContactPayload, type UserOperationReceipt, type UserProfile, WalletAccess, type WalletBalance, type WalletBalanceFormatted, type Webhook, type WebhookConfig, type WebhookEvent, type WebhookScope, type WebhookStatus };
|
package/dist/index.js
CHANGED
|
@@ -49,8 +49,8 @@ var WalletAccess = class {
|
|
|
49
49
|
/**
|
|
50
50
|
* Get the current wallet balance breakdown
|
|
51
51
|
*
|
|
52
|
-
* Returns the balance breakdown including total, native
|
|
53
|
-
* and internal
|
|
52
|
+
* Returns the balance breakdown including total, native FND,
|
|
53
|
+
* and internal FND amounts.
|
|
54
54
|
*
|
|
55
55
|
* @returns Balance breakdown object
|
|
56
56
|
* @throws {Error} If no wallet exists
|
|
@@ -59,7 +59,7 @@ var WalletAccess = class {
|
|
|
59
59
|
* ```typescript
|
|
60
60
|
* const balance = await sdk.getWallet().getBalance();
|
|
61
61
|
* console.log('Total Balance:', balance.total.toString());
|
|
62
|
-
* console.log('
|
|
62
|
+
* console.log('FND Balance:', balance.fnd.toString());
|
|
63
63
|
* ```
|
|
64
64
|
*/
|
|
65
65
|
async getBalance() {
|
|
@@ -301,7 +301,7 @@ var WalletAccess = class {
|
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
303
|
/**
|
|
304
|
-
* Transfer Frontier Dollars with Internal Frontier Dollars (
|
|
304
|
+
* Transfer Frontier Dollars with Internal Frontier Network Dollars (iFND) preferred
|
|
305
305
|
*
|
|
306
306
|
* This method will use Internal Frontier Dollars first, and if insufficient,
|
|
307
307
|
* it will use regular Frontier Dollars to complete the transfer.
|
|
@@ -368,12 +368,12 @@ var WalletAccess = class {
|
|
|
368
368
|
* Returns an array of token symbols that are supported for swaps
|
|
369
369
|
* and other operations on the current network.
|
|
370
370
|
*
|
|
371
|
-
* @returns Array of token symbols (e.g., ['
|
|
371
|
+
* @returns Array of token symbols (e.g., ['FND', 'USDC', 'WETH'])
|
|
372
372
|
*
|
|
373
373
|
* @example
|
|
374
374
|
* ```typescript
|
|
375
375
|
* const tokens = await sdk.getWallet().getSupportedTokens();
|
|
376
|
-
* console.log('Supported tokens:', tokens); // ['
|
|
376
|
+
* console.log('Supported tokens:', tokens); // ['FND', 'USDC', 'WETH']
|
|
377
377
|
* ```
|
|
378
378
|
*/
|
|
379
379
|
async getSupportedTokens() {
|
|
@@ -447,6 +447,179 @@ var WalletAccess = class {
|
|
|
447
447
|
amount
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
|
+
/**
|
|
451
|
+
* Get USD deposit instructions for fiat on-ramp
|
|
452
|
+
*
|
|
453
|
+
* Returns US bank details where user should send their USD deposit.
|
|
454
|
+
* The deposited fiat will be converted to stablecoins and sent to
|
|
455
|
+
* the user's wallet address.
|
|
456
|
+
*
|
|
457
|
+
* Requires approved KYC verification.
|
|
458
|
+
*
|
|
459
|
+
* @returns Bank details including routing number, account number, and beneficiary info
|
|
460
|
+
* @throws {Error} If KYC is not approved
|
|
461
|
+
*
|
|
462
|
+
* @example
|
|
463
|
+
* ```typescript
|
|
464
|
+
* const instructions = await sdk.getWallet().getUsdDepositInstructions();
|
|
465
|
+
* console.log('Bank:', instructions.depositInstructions.bankName);
|
|
466
|
+
* console.log('Routing:', instructions.depositInstructions.bankRoutingNumber);
|
|
467
|
+
* console.log('Account:', instructions.depositInstructions.bankAccountNumber);
|
|
468
|
+
* console.log('Beneficiary:', instructions.depositInstructions.bankBeneficiaryName);
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
471
|
+
async getUsdDepositInstructions() {
|
|
472
|
+
return this.sdk.request("wallet:getUsdDepositInstructions");
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Get EUR deposit instructions for fiat on-ramp (SEPA)
|
|
476
|
+
*
|
|
477
|
+
* Returns SEPA bank details where user should send their EUR deposit.
|
|
478
|
+
* The deposited fiat will be converted to stablecoins and sent to
|
|
479
|
+
* the user's wallet address.
|
|
480
|
+
*
|
|
481
|
+
* Requires approved KYC verification.
|
|
482
|
+
*
|
|
483
|
+
* @returns SEPA bank details including IBAN, BIC, and beneficiary info
|
|
484
|
+
* @throws {Error} If KYC is not approved
|
|
485
|
+
*
|
|
486
|
+
* @example
|
|
487
|
+
* ```typescript
|
|
488
|
+
* const instructions = await sdk.getWallet().getEurDepositInstructions();
|
|
489
|
+
* console.log('IBAN:', instructions.depositInstructions.iban);
|
|
490
|
+
* console.log('BIC:', instructions.depositInstructions.bic);
|
|
491
|
+
* console.log('Bank:', instructions.depositInstructions.bankName);
|
|
492
|
+
* console.log('Beneficiary:', instructions.depositInstructions.beneficiaryName);
|
|
493
|
+
* ```
|
|
494
|
+
*/
|
|
495
|
+
async getEurDepositInstructions() {
|
|
496
|
+
return this.sdk.request("wallet:getEurDepositInstructions");
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Get all linked bank accounts for withdrawals (off-ramp)
|
|
500
|
+
*
|
|
501
|
+
* Returns a list of bank accounts that have been linked for
|
|
502
|
+
* withdrawing stablecoins to fiat.
|
|
503
|
+
*
|
|
504
|
+
* Requires approved KYC verification.
|
|
505
|
+
*
|
|
506
|
+
* @returns List of linked bank accounts with withdrawal addresses
|
|
507
|
+
* @throws {Error} If KYC is not approved
|
|
508
|
+
*
|
|
509
|
+
* @example
|
|
510
|
+
* ```typescript
|
|
511
|
+
* const { banks } = await sdk.getWallet().getLinkedBanks();
|
|
512
|
+
* banks.forEach(bank => {
|
|
513
|
+
* console.log(`${bank.bankName} (****${bank.last4})`);
|
|
514
|
+
* });
|
|
515
|
+
* ```
|
|
516
|
+
*/
|
|
517
|
+
async getLinkedBanks() {
|
|
518
|
+
return this.sdk.request("wallet:getLinkedBanks");
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Link a US bank account for withdrawals (off-ramp)
|
|
522
|
+
*
|
|
523
|
+
* Links a US bank account (checking or savings) for withdrawing
|
|
524
|
+
* stablecoins to USD via ACH transfer.
|
|
525
|
+
*
|
|
526
|
+
* Requires approved KYC verification.
|
|
527
|
+
*
|
|
528
|
+
* @param accountOwnerName - Full name of the account owner
|
|
529
|
+
* @param bankName - Name of the bank (e.g., 'Chase', 'Bank of America')
|
|
530
|
+
* @param routingNumber - Bank routing number (9 digits)
|
|
531
|
+
* @param accountNumber - Bank account number
|
|
532
|
+
* @param checkingOrSavings - Account type: 'checking' or 'savings'
|
|
533
|
+
* @param address - Billing address for the account
|
|
534
|
+
* @returns Linked bank details with withdrawal address
|
|
535
|
+
* @throws {Error} If KYC is not approved or bank details are invalid
|
|
536
|
+
*
|
|
537
|
+
* @example
|
|
538
|
+
* ```typescript
|
|
539
|
+
* const result = await sdk.getWallet().linkUsBankAccount(
|
|
540
|
+
* 'John Doe',
|
|
541
|
+
* 'Chase',
|
|
542
|
+
* '121000248',
|
|
543
|
+
* '1234567890',
|
|
544
|
+
* 'checking',
|
|
545
|
+
* {
|
|
546
|
+
* streetLine1: '123 Main St',
|
|
547
|
+
* city: 'San Francisco',
|
|
548
|
+
* state: 'CA',
|
|
549
|
+
* postalCode: '94102',
|
|
550
|
+
* country: 'USA'
|
|
551
|
+
* }
|
|
552
|
+
* );
|
|
553
|
+
* console.log('Linked bank:', result.bankName);
|
|
554
|
+
* ```
|
|
555
|
+
*/
|
|
556
|
+
async linkUsBankAccount(accountOwnerName, bankName, routingNumber, accountNumber, checkingOrSavings, address) {
|
|
557
|
+
return this.sdk.request("wallet:linkUsBankAccount", {
|
|
558
|
+
accountOwnerName,
|
|
559
|
+
bankName,
|
|
560
|
+
routingNumber,
|
|
561
|
+
accountNumber,
|
|
562
|
+
checkingOrSavings,
|
|
563
|
+
address
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Link a EUR/IBAN bank account for withdrawals (off-ramp)
|
|
568
|
+
*
|
|
569
|
+
* Links a European bank account via IBAN for withdrawing
|
|
570
|
+
* stablecoins to EUR via SEPA transfer.
|
|
571
|
+
*
|
|
572
|
+
* Requires approved KYC verification.
|
|
573
|
+
*
|
|
574
|
+
* @param accountOwnerName - Full name of the account owner
|
|
575
|
+
* @param accountOwnerType - Type of account owner: 'individual' or 'business'
|
|
576
|
+
* @param firstName - First name of the account owner
|
|
577
|
+
* @param lastName - Last name of the account owner
|
|
578
|
+
* @param ibanAccountNumber - IBAN account number
|
|
579
|
+
* @param bic - Optional BIC/SWIFT code
|
|
580
|
+
* @returns Linked bank details with withdrawal address
|
|
581
|
+
* @throws {Error} If KYC is not approved or bank details are invalid
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
* ```typescript
|
|
585
|
+
* const result = await sdk.getWallet().linkEuroAccount(
|
|
586
|
+
* 'Hans Mueller',
|
|
587
|
+
* 'individual',
|
|
588
|
+
* 'Hans',
|
|
589
|
+
* 'Mueller',
|
|
590
|
+
* 'DE89370400440532013000',
|
|
591
|
+
* 'COBADEFFXXX' // optional BIC
|
|
592
|
+
* );
|
|
593
|
+
* console.log('Linked bank:', result.bankName);
|
|
594
|
+
* ```
|
|
595
|
+
*/
|
|
596
|
+
async linkEuroAccount(accountOwnerName, accountOwnerType, firstName, lastName, ibanAccountNumber, bic) {
|
|
597
|
+
return this.sdk.request("wallet:linkEuroAccount", {
|
|
598
|
+
accountOwnerName,
|
|
599
|
+
accountOwnerType,
|
|
600
|
+
firstName,
|
|
601
|
+
lastName,
|
|
602
|
+
ibanAccountNumber,
|
|
603
|
+
bic
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Delete a linked bank account
|
|
608
|
+
*
|
|
609
|
+
* Removes a previously linked bank account from the user's off-ramp options.
|
|
610
|
+
*
|
|
611
|
+
* @param bankId - The ID of the linked bank account to delete
|
|
612
|
+
* @throws {Error} If the bank account doesn't exist or deletion fails
|
|
613
|
+
*
|
|
614
|
+
* @example
|
|
615
|
+
* ```typescript
|
|
616
|
+
* await sdk.getWallet().deleteLinkedBank('bank_abc123');
|
|
617
|
+
* console.log('Bank account deleted');
|
|
618
|
+
* ```
|
|
619
|
+
*/
|
|
620
|
+
async deleteLinkedBank(bankId) {
|
|
621
|
+
return this.sdk.request("wallet:deleteLinkedBank", { bankId });
|
|
622
|
+
}
|
|
450
623
|
};
|
|
451
624
|
|
|
452
625
|
// src/access/storage.ts
|
|
@@ -673,6 +846,33 @@ var UserAccess = class {
|
|
|
673
846
|
async addUserContact(data) {
|
|
674
847
|
return this.sdk.request("user:addUserContact", data);
|
|
675
848
|
}
|
|
849
|
+
/**
|
|
850
|
+
* Get or create KYC status
|
|
851
|
+
*
|
|
852
|
+
* Returns the current KYC verification status. If KYC has not been started,
|
|
853
|
+
* it will be initiated and the response will include a URL to complete verification.
|
|
854
|
+
*
|
|
855
|
+
* @param redirectUri - Optional URL to redirect user after KYC completion
|
|
856
|
+
* @returns KycStatusResponse with status and verification link if applicable
|
|
857
|
+
* @throws {Error} If user is not authenticated
|
|
858
|
+
*
|
|
859
|
+
* @example
|
|
860
|
+
* ```typescript
|
|
861
|
+
* const kyc = await sdk.getUser().getOrCreateKyc();
|
|
862
|
+
* if (kyc.status === 'not_started' && kyc.kycLinkUrl) {
|
|
863
|
+
* // Redirect user to complete KYC
|
|
864
|
+
* window.open(kyc.kycLinkUrl, '_blank');
|
|
865
|
+
* } else if (kyc.isApproved) {
|
|
866
|
+
* console.log('KYC approved!');
|
|
867
|
+
* }
|
|
868
|
+
*
|
|
869
|
+
* // With redirect URI
|
|
870
|
+
* const kycWithRedirect = await sdk.getUser().getOrCreateKyc('https://myapp.com/callback');
|
|
871
|
+
* ```
|
|
872
|
+
*/
|
|
873
|
+
async getOrCreateKyc(redirectUri) {
|
|
874
|
+
return this.sdk.request("user:getOrCreateKyc", redirectUri);
|
|
875
|
+
}
|
|
676
876
|
};
|
|
677
877
|
|
|
678
878
|
// src/access/partnerships.ts
|