@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.mjs
CHANGED
|
@@ -18,8 +18,8 @@ var WalletAccess = class {
|
|
|
18
18
|
/**
|
|
19
19
|
* Get the current wallet balance breakdown
|
|
20
20
|
*
|
|
21
|
-
* Returns the balance breakdown including total, native
|
|
22
|
-
* and internal
|
|
21
|
+
* Returns the balance breakdown including total, native FND,
|
|
22
|
+
* and internal FND amounts.
|
|
23
23
|
*
|
|
24
24
|
* @returns Balance breakdown object
|
|
25
25
|
* @throws {Error} If no wallet exists
|
|
@@ -28,7 +28,7 @@ var WalletAccess = class {
|
|
|
28
28
|
* ```typescript
|
|
29
29
|
* const balance = await sdk.getWallet().getBalance();
|
|
30
30
|
* console.log('Total Balance:', balance.total.toString());
|
|
31
|
-
* console.log('
|
|
31
|
+
* console.log('FND Balance:', balance.fnd.toString());
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
async getBalance() {
|
|
@@ -270,7 +270,7 @@ var WalletAccess = class {
|
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
272
|
/**
|
|
273
|
-
* Transfer Frontier Dollars with Internal Frontier Dollars (
|
|
273
|
+
* Transfer Frontier Dollars with Internal Frontier Network Dollars (iFND) preferred
|
|
274
274
|
*
|
|
275
275
|
* This method will use Internal Frontier Dollars first, and if insufficient,
|
|
276
276
|
* it will use regular Frontier Dollars to complete the transfer.
|
|
@@ -337,12 +337,12 @@ var WalletAccess = class {
|
|
|
337
337
|
* Returns an array of token symbols that are supported for swaps
|
|
338
338
|
* and other operations on the current network.
|
|
339
339
|
*
|
|
340
|
-
* @returns Array of token symbols (e.g., ['
|
|
340
|
+
* @returns Array of token symbols (e.g., ['FND', 'USDC', 'WETH'])
|
|
341
341
|
*
|
|
342
342
|
* @example
|
|
343
343
|
* ```typescript
|
|
344
344
|
* const tokens = await sdk.getWallet().getSupportedTokens();
|
|
345
|
-
* console.log('Supported tokens:', tokens); // ['
|
|
345
|
+
* console.log('Supported tokens:', tokens); // ['FND', 'USDC', 'WETH']
|
|
346
346
|
* ```
|
|
347
347
|
*/
|
|
348
348
|
async getSupportedTokens() {
|
|
@@ -416,6 +416,179 @@ var WalletAccess = class {
|
|
|
416
416
|
amount
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
|
+
/**
|
|
420
|
+
* Get USD deposit instructions for fiat on-ramp
|
|
421
|
+
*
|
|
422
|
+
* Returns US bank details where user should send their USD deposit.
|
|
423
|
+
* The deposited fiat will be converted to stablecoins and sent to
|
|
424
|
+
* the user's wallet address.
|
|
425
|
+
*
|
|
426
|
+
* Requires approved KYC verification.
|
|
427
|
+
*
|
|
428
|
+
* @returns Bank details including routing number, account number, and beneficiary info
|
|
429
|
+
* @throws {Error} If KYC is not approved
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```typescript
|
|
433
|
+
* const instructions = await sdk.getWallet().getUsdDepositInstructions();
|
|
434
|
+
* console.log('Bank:', instructions.depositInstructions.bankName);
|
|
435
|
+
* console.log('Routing:', instructions.depositInstructions.bankRoutingNumber);
|
|
436
|
+
* console.log('Account:', instructions.depositInstructions.bankAccountNumber);
|
|
437
|
+
* console.log('Beneficiary:', instructions.depositInstructions.bankBeneficiaryName);
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
440
|
+
async getUsdDepositInstructions() {
|
|
441
|
+
return this.sdk.request("wallet:getUsdDepositInstructions");
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Get EUR deposit instructions for fiat on-ramp (SEPA)
|
|
445
|
+
*
|
|
446
|
+
* Returns SEPA bank details where user should send their EUR deposit.
|
|
447
|
+
* The deposited fiat will be converted to stablecoins and sent to
|
|
448
|
+
* the user's wallet address.
|
|
449
|
+
*
|
|
450
|
+
* Requires approved KYC verification.
|
|
451
|
+
*
|
|
452
|
+
* @returns SEPA bank details including IBAN, BIC, and beneficiary info
|
|
453
|
+
* @throws {Error} If KYC is not approved
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```typescript
|
|
457
|
+
* const instructions = await sdk.getWallet().getEurDepositInstructions();
|
|
458
|
+
* console.log('IBAN:', instructions.depositInstructions.iban);
|
|
459
|
+
* console.log('BIC:', instructions.depositInstructions.bic);
|
|
460
|
+
* console.log('Bank:', instructions.depositInstructions.bankName);
|
|
461
|
+
* console.log('Beneficiary:', instructions.depositInstructions.beneficiaryName);
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
async getEurDepositInstructions() {
|
|
465
|
+
return this.sdk.request("wallet:getEurDepositInstructions");
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Get all linked bank accounts for withdrawals (off-ramp)
|
|
469
|
+
*
|
|
470
|
+
* Returns a list of bank accounts that have been linked for
|
|
471
|
+
* withdrawing stablecoins to fiat.
|
|
472
|
+
*
|
|
473
|
+
* Requires approved KYC verification.
|
|
474
|
+
*
|
|
475
|
+
* @returns List of linked bank accounts with withdrawal addresses
|
|
476
|
+
* @throws {Error} If KYC is not approved
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* ```typescript
|
|
480
|
+
* const { banks } = await sdk.getWallet().getLinkedBanks();
|
|
481
|
+
* banks.forEach(bank => {
|
|
482
|
+
* console.log(`${bank.bankName} (****${bank.last4})`);
|
|
483
|
+
* });
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
async getLinkedBanks() {
|
|
487
|
+
return this.sdk.request("wallet:getLinkedBanks");
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Link a US bank account for withdrawals (off-ramp)
|
|
491
|
+
*
|
|
492
|
+
* Links a US bank account (checking or savings) for withdrawing
|
|
493
|
+
* stablecoins to USD via ACH transfer.
|
|
494
|
+
*
|
|
495
|
+
* Requires approved KYC verification.
|
|
496
|
+
*
|
|
497
|
+
* @param accountOwnerName - Full name of the account owner
|
|
498
|
+
* @param bankName - Name of the bank (e.g., 'Chase', 'Bank of America')
|
|
499
|
+
* @param routingNumber - Bank routing number (9 digits)
|
|
500
|
+
* @param accountNumber - Bank account number
|
|
501
|
+
* @param checkingOrSavings - Account type: 'checking' or 'savings'
|
|
502
|
+
* @param address - Billing address for the account
|
|
503
|
+
* @returns Linked bank details with withdrawal address
|
|
504
|
+
* @throws {Error} If KYC is not approved or bank details are invalid
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* ```typescript
|
|
508
|
+
* const result = await sdk.getWallet().linkUsBankAccount(
|
|
509
|
+
* 'John Doe',
|
|
510
|
+
* 'Chase',
|
|
511
|
+
* '121000248',
|
|
512
|
+
* '1234567890',
|
|
513
|
+
* 'checking',
|
|
514
|
+
* {
|
|
515
|
+
* streetLine1: '123 Main St',
|
|
516
|
+
* city: 'San Francisco',
|
|
517
|
+
* state: 'CA',
|
|
518
|
+
* postalCode: '94102',
|
|
519
|
+
* country: 'USA'
|
|
520
|
+
* }
|
|
521
|
+
* );
|
|
522
|
+
* console.log('Linked bank:', result.bankName);
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
async linkUsBankAccount(accountOwnerName, bankName, routingNumber, accountNumber, checkingOrSavings, address) {
|
|
526
|
+
return this.sdk.request("wallet:linkUsBankAccount", {
|
|
527
|
+
accountOwnerName,
|
|
528
|
+
bankName,
|
|
529
|
+
routingNumber,
|
|
530
|
+
accountNumber,
|
|
531
|
+
checkingOrSavings,
|
|
532
|
+
address
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Link a EUR/IBAN bank account for withdrawals (off-ramp)
|
|
537
|
+
*
|
|
538
|
+
* Links a European bank account via IBAN for withdrawing
|
|
539
|
+
* stablecoins to EUR via SEPA transfer.
|
|
540
|
+
*
|
|
541
|
+
* Requires approved KYC verification.
|
|
542
|
+
*
|
|
543
|
+
* @param accountOwnerName - Full name of the account owner
|
|
544
|
+
* @param accountOwnerType - Type of account owner: 'individual' or 'business'
|
|
545
|
+
* @param firstName - First name of the account owner
|
|
546
|
+
* @param lastName - Last name of the account owner
|
|
547
|
+
* @param ibanAccountNumber - IBAN account number
|
|
548
|
+
* @param bic - Optional BIC/SWIFT code
|
|
549
|
+
* @returns Linked bank details with withdrawal address
|
|
550
|
+
* @throws {Error} If KYC is not approved or bank details are invalid
|
|
551
|
+
*
|
|
552
|
+
* @example
|
|
553
|
+
* ```typescript
|
|
554
|
+
* const result = await sdk.getWallet().linkEuroAccount(
|
|
555
|
+
* 'Hans Mueller',
|
|
556
|
+
* 'individual',
|
|
557
|
+
* 'Hans',
|
|
558
|
+
* 'Mueller',
|
|
559
|
+
* 'DE89370400440532013000',
|
|
560
|
+
* 'COBADEFFXXX' // optional BIC
|
|
561
|
+
* );
|
|
562
|
+
* console.log('Linked bank:', result.bankName);
|
|
563
|
+
* ```
|
|
564
|
+
*/
|
|
565
|
+
async linkEuroAccount(accountOwnerName, accountOwnerType, firstName, lastName, ibanAccountNumber, bic) {
|
|
566
|
+
return this.sdk.request("wallet:linkEuroAccount", {
|
|
567
|
+
accountOwnerName,
|
|
568
|
+
accountOwnerType,
|
|
569
|
+
firstName,
|
|
570
|
+
lastName,
|
|
571
|
+
ibanAccountNumber,
|
|
572
|
+
bic
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Delete a linked bank account
|
|
577
|
+
*
|
|
578
|
+
* Removes a previously linked bank account from the user's off-ramp options.
|
|
579
|
+
*
|
|
580
|
+
* @param bankId - The ID of the linked bank account to delete
|
|
581
|
+
* @throws {Error} If the bank account doesn't exist or deletion fails
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
* ```typescript
|
|
585
|
+
* await sdk.getWallet().deleteLinkedBank('bank_abc123');
|
|
586
|
+
* console.log('Bank account deleted');
|
|
587
|
+
* ```
|
|
588
|
+
*/
|
|
589
|
+
async deleteLinkedBank(bankId) {
|
|
590
|
+
return this.sdk.request("wallet:deleteLinkedBank", { bankId });
|
|
591
|
+
}
|
|
419
592
|
};
|
|
420
593
|
|
|
421
594
|
// src/access/storage.ts
|
|
@@ -642,6 +815,33 @@ var UserAccess = class {
|
|
|
642
815
|
async addUserContact(data) {
|
|
643
816
|
return this.sdk.request("user:addUserContact", data);
|
|
644
817
|
}
|
|
818
|
+
/**
|
|
819
|
+
* Get or create KYC status
|
|
820
|
+
*
|
|
821
|
+
* Returns the current KYC verification status. If KYC has not been started,
|
|
822
|
+
* it will be initiated and the response will include a URL to complete verification.
|
|
823
|
+
*
|
|
824
|
+
* @param redirectUri - Optional URL to redirect user after KYC completion
|
|
825
|
+
* @returns KycStatusResponse with status and verification link if applicable
|
|
826
|
+
* @throws {Error} If user is not authenticated
|
|
827
|
+
*
|
|
828
|
+
* @example
|
|
829
|
+
* ```typescript
|
|
830
|
+
* const kyc = await sdk.getUser().getOrCreateKyc();
|
|
831
|
+
* if (kyc.status === 'not_started' && kyc.kycLinkUrl) {
|
|
832
|
+
* // Redirect user to complete KYC
|
|
833
|
+
* window.open(kyc.kycLinkUrl, '_blank');
|
|
834
|
+
* } else if (kyc.isApproved) {
|
|
835
|
+
* console.log('KYC approved!');
|
|
836
|
+
* }
|
|
837
|
+
*
|
|
838
|
+
* // With redirect URI
|
|
839
|
+
* const kycWithRedirect = await sdk.getUser().getOrCreateKyc('https://myapp.com/callback');
|
|
840
|
+
* ```
|
|
841
|
+
*/
|
|
842
|
+
async getOrCreateKyc(redirectUri) {
|
|
843
|
+
return this.sdk.request("user:getOrCreateKyc", redirectUri);
|
|
844
|
+
}
|
|
645
845
|
};
|
|
646
846
|
|
|
647
847
|
// src/access/partnerships.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontiertower/frontier-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "SDK for building apps on Frontier Wallet",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -47,5 +47,8 @@
|
|
|
47
47
|
"type": "git",
|
|
48
48
|
"url": "git+https://github.com/BerlinhouseLabs/frontier-sdk.git"
|
|
49
49
|
},
|
|
50
|
-
"readme": "README.md"
|
|
50
|
+
"readme": "README.md",
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"qrcode.react": "^4.2.0"
|
|
53
|
+
}
|
|
51
54
|
}
|