infra-sdk-typescript 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +256 -249
- package/dist/index.cjs +51 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -44
- package/dist/index.d.ts +81 -44
- package/dist/index.js +51 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
package/dist/index.d.cts
CHANGED
|
@@ -351,8 +351,8 @@ declare class WalletResource extends APIResource {
|
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
type TokenType = "ASSET" | "YIELD_BEARING";
|
|
354
|
-
type TokenStatus = LooseUnion<"PENDING" | "ACTIVE" | "PAUSED">;
|
|
355
|
-
type TokenTransactionType = LooseUnion<"MINT" | "BURN" | "TRANSFER">;
|
|
354
|
+
type TokenStatus = LooseUnion<"PENDING" | "ACTIVE" | "PAUSED" | "RETIRED">;
|
|
355
|
+
type TokenTransactionType = LooseUnion<"MINT" | "BURN" | "TRANSFER" | "DEPLOY" | "REDEEM" | "SNAPSHOT">;
|
|
356
356
|
type TokenTransactionStatus = LooseUnion<"PENDING" | "CONFIRMED" | "FAILED">;
|
|
357
357
|
interface YieldParams {
|
|
358
358
|
/** Annual yield rate as a percentage, e.g. `5.5` for 5.5%. */
|
|
@@ -372,6 +372,8 @@ interface YieldParams {
|
|
|
372
372
|
callable?: boolean;
|
|
373
373
|
/** Call date, `YYYY-MM-DD`. Only meaningful when `callable` is `true`. */
|
|
374
374
|
callDate?: string;
|
|
375
|
+
/** Early redemption fee, in basis points. */
|
|
376
|
+
earlyRedemptionFee?: number;
|
|
375
377
|
}
|
|
376
378
|
interface CreateTokenParams {
|
|
377
379
|
/** Short token symbol, e.g. `"ACMB3"`. */
|
|
@@ -396,7 +398,7 @@ interface CreateTokenParams {
|
|
|
396
398
|
/** Result of a token deployment submission — `status` starts `PENDING` until the chain confirms it. */
|
|
397
399
|
interface TokenDeploymentResult {
|
|
398
400
|
id: string;
|
|
399
|
-
|
|
401
|
+
chainId: string;
|
|
400
402
|
status: TokenStatus;
|
|
401
403
|
operationRef: string;
|
|
402
404
|
tokenAdmin: string;
|
|
@@ -455,7 +457,7 @@ interface ListTokensParams {
|
|
|
455
457
|
}
|
|
456
458
|
interface BurnTokenParams {
|
|
457
459
|
tokenId: string;
|
|
458
|
-
|
|
460
|
+
chainId: string;
|
|
459
461
|
/** Holder address to burn from. */
|
|
460
462
|
fromAddress: string;
|
|
461
463
|
/** Amount to burn, in token units. */
|
|
@@ -465,7 +467,7 @@ interface BurnTokenParams {
|
|
|
465
467
|
}
|
|
466
468
|
interface MintTokenParams {
|
|
467
469
|
tokenId: string;
|
|
468
|
-
|
|
470
|
+
chainId: string;
|
|
469
471
|
/** Recipient wallet address. */
|
|
470
472
|
toAddress: string;
|
|
471
473
|
/** Amount to mint, in token units. */
|
|
@@ -474,55 +476,58 @@ interface MintTokenParams {
|
|
|
474
476
|
}
|
|
475
477
|
interface TransferTokenParams {
|
|
476
478
|
tokenId: string;
|
|
477
|
-
|
|
479
|
+
chainId: string;
|
|
480
|
+
/** HD address index of the sending holder wallet. */
|
|
481
|
+
fromAddressIndex: number;
|
|
482
|
+
toAddress: string;
|
|
483
|
+
/** Amount to transfer, in token units. */
|
|
484
|
+
amount: number;
|
|
485
|
+
memo?: string;
|
|
486
|
+
}
|
|
487
|
+
interface ForcedTransferTokenParams {
|
|
488
|
+
tokenId: string;
|
|
489
|
+
chainId: string;
|
|
490
|
+
/** Holder address to move tokens out of. */
|
|
478
491
|
fromAddress: string;
|
|
479
492
|
toAddress: string;
|
|
480
493
|
/** Amount to transfer, in token units. */
|
|
481
494
|
amount: number;
|
|
482
495
|
memo?: string;
|
|
483
496
|
}
|
|
484
|
-
/**
|
|
497
|
+
/**
|
|
498
|
+
* Result of {@link TokenizationResource.mintToken} / {@link TokenizationResource.burnToken} /
|
|
499
|
+
* {@link TokenizationResource.forcedTransfer}.
|
|
500
|
+
*/
|
|
485
501
|
interface TokenOperationResult {
|
|
486
502
|
operationRef: string;
|
|
487
503
|
transactionId: string;
|
|
488
504
|
txHash: string;
|
|
489
505
|
}
|
|
490
|
-
/** Result of {@link TokenizationResource.transferToken}
|
|
506
|
+
/** Result of {@link TokenizationResource.transferToken}. */
|
|
491
507
|
interface TokenTransferResult {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
chainId: number;
|
|
497
|
-
signerType: string;
|
|
498
|
-
fromAddress: string;
|
|
499
|
-
addressIndex: number | null;
|
|
508
|
+
tokenId: string;
|
|
509
|
+
status: TokenTransactionStatus;
|
|
510
|
+
transactionId: string;
|
|
511
|
+
fromAddressIndex: number;
|
|
500
512
|
toAddress: string;
|
|
501
|
-
/** Amount in token units
|
|
502
|
-
amount:
|
|
503
|
-
tokenAddress: string | null;
|
|
504
|
-
data: string | null;
|
|
505
|
-
value: string | null;
|
|
513
|
+
/** Amount transferred, in token units. */
|
|
514
|
+
amount: number;
|
|
506
515
|
txHash: string;
|
|
507
|
-
|
|
508
|
-
gasUsed: string | null;
|
|
509
|
-
feeWei: string | null;
|
|
510
|
-
createdAt: string;
|
|
511
|
-
updatedAt: string;
|
|
516
|
+
operationRef: string;
|
|
512
517
|
}
|
|
513
518
|
interface RegisterTokenWalletParams {
|
|
514
519
|
tokenId: string;
|
|
515
|
-
|
|
520
|
+
chainId: string;
|
|
516
521
|
walletAddress: string;
|
|
517
522
|
}
|
|
518
523
|
interface RegisterTokenWalletResult {
|
|
519
524
|
tokenId: string;
|
|
520
|
-
|
|
525
|
+
chainId: string;
|
|
521
526
|
walletAddress: string;
|
|
522
527
|
}
|
|
523
528
|
interface GetTokenHoldersParams {
|
|
524
529
|
tokenId: string;
|
|
525
|
-
|
|
530
|
+
chainId?: string;
|
|
526
531
|
page?: number;
|
|
527
532
|
pageSize?: number;
|
|
528
533
|
}
|
|
@@ -531,16 +536,38 @@ interface TokenHolder {
|
|
|
531
536
|
/** Balance in token units, as a decimal string. */
|
|
532
537
|
balance: string;
|
|
533
538
|
}
|
|
539
|
+
interface GetWalletBalanceParams {
|
|
540
|
+
tokenId: string;
|
|
541
|
+
chainId: string;
|
|
542
|
+
walletAddress: string;
|
|
543
|
+
}
|
|
544
|
+
/** A single wallet's balance of a token, returned by {@link TokenizationResource.getWalletBalance}. */
|
|
545
|
+
interface TokenWalletBalance {
|
|
546
|
+
tokenId: string;
|
|
547
|
+
ticker: string;
|
|
548
|
+
chainId: string;
|
|
549
|
+
walletAddress: string;
|
|
550
|
+
/** Balance in token units, as a decimal string. */
|
|
551
|
+
balance: string;
|
|
552
|
+
decimals: number;
|
|
553
|
+
}
|
|
534
554
|
interface ListTokenTransactionsParams {
|
|
535
555
|
tokenId?: string;
|
|
556
|
+
chainId?: string;
|
|
536
557
|
page?: number;
|
|
537
558
|
pageSize?: number;
|
|
559
|
+
type?: TokenTransactionType;
|
|
560
|
+
status?: TokenTransactionStatus;
|
|
561
|
+
fromAddress?: string;
|
|
562
|
+
toAddress?: string;
|
|
563
|
+
txHash?: string;
|
|
564
|
+
operationRef?: string;
|
|
538
565
|
}
|
|
539
566
|
/** A recorded on-chain operation against a token (mint, burn, or transfer). */
|
|
540
567
|
interface TokenTransactionRecord {
|
|
541
568
|
id: string;
|
|
542
569
|
tokenId: string;
|
|
543
|
-
|
|
570
|
+
chainId: string;
|
|
544
571
|
projectId?: string;
|
|
545
572
|
type: TokenTransactionType;
|
|
546
573
|
status: TokenTransactionStatus;
|
|
@@ -561,22 +588,24 @@ interface TokenTransactionRecord {
|
|
|
561
588
|
interface UpdateTokenYieldParams {
|
|
562
589
|
/** Yield-bearing token id. */
|
|
563
590
|
tokenId: string;
|
|
564
|
-
|
|
591
|
+
chainId: string;
|
|
565
592
|
/** New annual yield rate, as a percentage. */
|
|
566
593
|
annualRate: number;
|
|
567
594
|
}
|
|
568
595
|
interface DistributeYieldParams {
|
|
569
596
|
tokenId: string;
|
|
570
|
-
|
|
597
|
+
chainId: string;
|
|
571
598
|
/** Amount to fund the distribution, in fiat major units. */
|
|
572
599
|
fundAmount: number;
|
|
600
|
+
payoutToken?: string;
|
|
573
601
|
/** Seconds after which unclaimed funds may be reclaimed. */
|
|
574
602
|
reclaimAfter?: number;
|
|
575
603
|
memo?: string;
|
|
576
604
|
}
|
|
577
605
|
interface PayCouponParams {
|
|
578
606
|
tokenId: string;
|
|
579
|
-
|
|
607
|
+
chainId: string;
|
|
608
|
+
payoutToken?: string;
|
|
580
609
|
/** Push the coupon to investors instead of letting them claim it. */
|
|
581
610
|
pushYield?: boolean;
|
|
582
611
|
reclaimAfter?: number;
|
|
@@ -584,7 +613,7 @@ interface PayCouponParams {
|
|
|
584
613
|
}
|
|
585
614
|
interface ClaimYieldParams {
|
|
586
615
|
tokenId: string;
|
|
587
|
-
|
|
616
|
+
chainId: string;
|
|
588
617
|
/** HD address index of the claiming investor. */
|
|
589
618
|
investorAddressIndex: number;
|
|
590
619
|
/** Distribution snapshot to claim against. */
|
|
@@ -592,7 +621,7 @@ interface ClaimYieldParams {
|
|
|
592
621
|
}
|
|
593
622
|
interface RedeemPrincipalParams {
|
|
594
623
|
tokenId: string;
|
|
595
|
-
|
|
624
|
+
chainId: string;
|
|
596
625
|
/** Push redeemed funds to investors instead of letting them claim. */
|
|
597
626
|
pushYield?: boolean;
|
|
598
627
|
}
|
|
@@ -619,7 +648,7 @@ declare class TokenizationResource extends APIResource {
|
|
|
619
648
|
* {@link getToken} until `status` is `ACTIVE`. Supply `yieldParams` for a
|
|
620
649
|
* `YIELD_BEARING` token.
|
|
621
650
|
*/
|
|
622
|
-
createToken(params: CreateTokenParams, overrides?:
|
|
651
|
+
createToken(params: CreateTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenDeploymentResult>;
|
|
623
652
|
/**
|
|
624
653
|
* Returns a paginated list of tokens for the calling project.
|
|
625
654
|
*
|
|
@@ -632,15 +661,23 @@ declare class TokenizationResource extends APIResource {
|
|
|
632
661
|
/** Fetches a single token by id, including its per-chain deployment details. */
|
|
633
662
|
getToken(id: string, overrides?: RequestOverrides): Promise<TokenDetail>;
|
|
634
663
|
/** Mints new units of a token to a recipient address. */
|
|
635
|
-
mintToken(params: MintTokenParams, overrides?:
|
|
664
|
+
mintToken(params: MintTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
|
|
636
665
|
/** Burns units of a token from a holder address. */
|
|
637
|
-
burnToken(params: BurnTokenParams, overrides?:
|
|
666
|
+
burnToken(params: BurnTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
|
|
638
667
|
/** Transfers token units between holder addresses. */
|
|
639
|
-
transferToken(params: TransferTokenParams, overrides?:
|
|
668
|
+
transferToken(params: TransferTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenTransferResult>;
|
|
669
|
+
/**
|
|
670
|
+
* Force-transfers token units out of a holder's address without the holder's signature
|
|
671
|
+
* (issuer/admin compliance action, e.g. recovery or court order). An `Idempotency-Key` is
|
|
672
|
+
* generated per call unless you pass your own.
|
|
673
|
+
*/
|
|
674
|
+
forcedTransfer(params: ForcedTransferTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
|
|
640
675
|
/** Registers (whitelists) a wallet address so it can hold a given token. */
|
|
641
|
-
registerWallet(params: RegisterTokenWalletParams, overrides?:
|
|
676
|
+
registerWallet(params: RegisterTokenWalletParams, overrides?: IdempotentRequestOverrides): Promise<RegisterTokenWalletResult>;
|
|
642
677
|
/** Returns the paginated list of holder wallet addresses and balances for a token on a chain. */
|
|
643
678
|
getTokenHolders(params: GetTokenHoldersParams, overrides?: RequestOverrides): Promise<Page<TokenHolder>>;
|
|
679
|
+
/** Returns a single wallet's balance of a token on a chain. */
|
|
680
|
+
getWalletBalance(params: GetWalletBalanceParams, overrides?: RequestOverrides): Promise<TokenWalletBalance>;
|
|
644
681
|
/** Fetches a single token transaction by its reference. */
|
|
645
682
|
getTokenTransaction(ref: string, overrides?: RequestOverrides): Promise<TokenTransactionRecord>;
|
|
646
683
|
/** Returns token transactions, optionally filtered by token. */
|
|
@@ -648,13 +685,13 @@ declare class TokenizationResource extends APIResource {
|
|
|
648
685
|
/** Updates the annual yield rate for a yield-bearing token. */
|
|
649
686
|
updateYield(params: UpdateTokenYieldParams, overrides?: RequestOverrides): Promise<YieldTxResult>;
|
|
650
687
|
/** Funds and distributes a yield payout to holders. Unclaimed funds may be reclaimed after `reclaimAfter`. */
|
|
651
|
-
distributeYield(params: DistributeYieldParams, overrides?:
|
|
688
|
+
distributeYield(params: DistributeYieldParams, overrides?: IdempotentRequestOverrides): Promise<YieldOperationResult>;
|
|
652
689
|
/** Pays the scheduled coupon for a yield-bearing token. Set `pushYield` to push funds rather than let investors claim. */
|
|
653
|
-
payCoupon(params: PayCouponParams, overrides?:
|
|
690
|
+
payCoupon(params: PayCouponParams, overrides?: IdempotentRequestOverrides): Promise<YieldOperationResult>;
|
|
654
691
|
/** Claims an investor's yield for a given distribution snapshot. */
|
|
655
|
-
claimYield(params: ClaimYieldParams, overrides?:
|
|
692
|
+
claimYield(params: ClaimYieldParams, overrides?: IdempotentRequestOverrides): Promise<YieldTxResult>;
|
|
656
693
|
/** Redeems principal to holders at maturity. Set `pushYield` to push funds rather than let investors claim. */
|
|
657
|
-
redeemPrincipal(params: RedeemPrincipalParams, overrides?:
|
|
694
|
+
redeemPrincipal(params: RedeemPrincipalParams, overrides?: IdempotentRequestOverrides): Promise<YieldTxResult>;
|
|
658
695
|
}
|
|
659
696
|
|
|
660
697
|
type SubscriptionStatus = LooseUnion<"active" | "paused" | "deleted">;
|
package/dist/index.d.ts
CHANGED
|
@@ -351,8 +351,8 @@ declare class WalletResource extends APIResource {
|
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
type TokenType = "ASSET" | "YIELD_BEARING";
|
|
354
|
-
type TokenStatus = LooseUnion<"PENDING" | "ACTIVE" | "PAUSED">;
|
|
355
|
-
type TokenTransactionType = LooseUnion<"MINT" | "BURN" | "TRANSFER">;
|
|
354
|
+
type TokenStatus = LooseUnion<"PENDING" | "ACTIVE" | "PAUSED" | "RETIRED">;
|
|
355
|
+
type TokenTransactionType = LooseUnion<"MINT" | "BURN" | "TRANSFER" | "DEPLOY" | "REDEEM" | "SNAPSHOT">;
|
|
356
356
|
type TokenTransactionStatus = LooseUnion<"PENDING" | "CONFIRMED" | "FAILED">;
|
|
357
357
|
interface YieldParams {
|
|
358
358
|
/** Annual yield rate as a percentage, e.g. `5.5` for 5.5%. */
|
|
@@ -372,6 +372,8 @@ interface YieldParams {
|
|
|
372
372
|
callable?: boolean;
|
|
373
373
|
/** Call date, `YYYY-MM-DD`. Only meaningful when `callable` is `true`. */
|
|
374
374
|
callDate?: string;
|
|
375
|
+
/** Early redemption fee, in basis points. */
|
|
376
|
+
earlyRedemptionFee?: number;
|
|
375
377
|
}
|
|
376
378
|
interface CreateTokenParams {
|
|
377
379
|
/** Short token symbol, e.g. `"ACMB3"`. */
|
|
@@ -396,7 +398,7 @@ interface CreateTokenParams {
|
|
|
396
398
|
/** Result of a token deployment submission — `status` starts `PENDING` until the chain confirms it. */
|
|
397
399
|
interface TokenDeploymentResult {
|
|
398
400
|
id: string;
|
|
399
|
-
|
|
401
|
+
chainId: string;
|
|
400
402
|
status: TokenStatus;
|
|
401
403
|
operationRef: string;
|
|
402
404
|
tokenAdmin: string;
|
|
@@ -455,7 +457,7 @@ interface ListTokensParams {
|
|
|
455
457
|
}
|
|
456
458
|
interface BurnTokenParams {
|
|
457
459
|
tokenId: string;
|
|
458
|
-
|
|
460
|
+
chainId: string;
|
|
459
461
|
/** Holder address to burn from. */
|
|
460
462
|
fromAddress: string;
|
|
461
463
|
/** Amount to burn, in token units. */
|
|
@@ -465,7 +467,7 @@ interface BurnTokenParams {
|
|
|
465
467
|
}
|
|
466
468
|
interface MintTokenParams {
|
|
467
469
|
tokenId: string;
|
|
468
|
-
|
|
470
|
+
chainId: string;
|
|
469
471
|
/** Recipient wallet address. */
|
|
470
472
|
toAddress: string;
|
|
471
473
|
/** Amount to mint, in token units. */
|
|
@@ -474,55 +476,58 @@ interface MintTokenParams {
|
|
|
474
476
|
}
|
|
475
477
|
interface TransferTokenParams {
|
|
476
478
|
tokenId: string;
|
|
477
|
-
|
|
479
|
+
chainId: string;
|
|
480
|
+
/** HD address index of the sending holder wallet. */
|
|
481
|
+
fromAddressIndex: number;
|
|
482
|
+
toAddress: string;
|
|
483
|
+
/** Amount to transfer, in token units. */
|
|
484
|
+
amount: number;
|
|
485
|
+
memo?: string;
|
|
486
|
+
}
|
|
487
|
+
interface ForcedTransferTokenParams {
|
|
488
|
+
tokenId: string;
|
|
489
|
+
chainId: string;
|
|
490
|
+
/** Holder address to move tokens out of. */
|
|
478
491
|
fromAddress: string;
|
|
479
492
|
toAddress: string;
|
|
480
493
|
/** Amount to transfer, in token units. */
|
|
481
494
|
amount: number;
|
|
482
495
|
memo?: string;
|
|
483
496
|
}
|
|
484
|
-
/**
|
|
497
|
+
/**
|
|
498
|
+
* Result of {@link TokenizationResource.mintToken} / {@link TokenizationResource.burnToken} /
|
|
499
|
+
* {@link TokenizationResource.forcedTransfer}.
|
|
500
|
+
*/
|
|
485
501
|
interface TokenOperationResult {
|
|
486
502
|
operationRef: string;
|
|
487
503
|
transactionId: string;
|
|
488
504
|
txHash: string;
|
|
489
505
|
}
|
|
490
|
-
/** Result of {@link TokenizationResource.transferToken}
|
|
506
|
+
/** Result of {@link TokenizationResource.transferToken}. */
|
|
491
507
|
interface TokenTransferResult {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
chainId: number;
|
|
497
|
-
signerType: string;
|
|
498
|
-
fromAddress: string;
|
|
499
|
-
addressIndex: number | null;
|
|
508
|
+
tokenId: string;
|
|
509
|
+
status: TokenTransactionStatus;
|
|
510
|
+
transactionId: string;
|
|
511
|
+
fromAddressIndex: number;
|
|
500
512
|
toAddress: string;
|
|
501
|
-
/** Amount in token units
|
|
502
|
-
amount:
|
|
503
|
-
tokenAddress: string | null;
|
|
504
|
-
data: string | null;
|
|
505
|
-
value: string | null;
|
|
513
|
+
/** Amount transferred, in token units. */
|
|
514
|
+
amount: number;
|
|
506
515
|
txHash: string;
|
|
507
|
-
|
|
508
|
-
gasUsed: string | null;
|
|
509
|
-
feeWei: string | null;
|
|
510
|
-
createdAt: string;
|
|
511
|
-
updatedAt: string;
|
|
516
|
+
operationRef: string;
|
|
512
517
|
}
|
|
513
518
|
interface RegisterTokenWalletParams {
|
|
514
519
|
tokenId: string;
|
|
515
|
-
|
|
520
|
+
chainId: string;
|
|
516
521
|
walletAddress: string;
|
|
517
522
|
}
|
|
518
523
|
interface RegisterTokenWalletResult {
|
|
519
524
|
tokenId: string;
|
|
520
|
-
|
|
525
|
+
chainId: string;
|
|
521
526
|
walletAddress: string;
|
|
522
527
|
}
|
|
523
528
|
interface GetTokenHoldersParams {
|
|
524
529
|
tokenId: string;
|
|
525
|
-
|
|
530
|
+
chainId?: string;
|
|
526
531
|
page?: number;
|
|
527
532
|
pageSize?: number;
|
|
528
533
|
}
|
|
@@ -531,16 +536,38 @@ interface TokenHolder {
|
|
|
531
536
|
/** Balance in token units, as a decimal string. */
|
|
532
537
|
balance: string;
|
|
533
538
|
}
|
|
539
|
+
interface GetWalletBalanceParams {
|
|
540
|
+
tokenId: string;
|
|
541
|
+
chainId: string;
|
|
542
|
+
walletAddress: string;
|
|
543
|
+
}
|
|
544
|
+
/** A single wallet's balance of a token, returned by {@link TokenizationResource.getWalletBalance}. */
|
|
545
|
+
interface TokenWalletBalance {
|
|
546
|
+
tokenId: string;
|
|
547
|
+
ticker: string;
|
|
548
|
+
chainId: string;
|
|
549
|
+
walletAddress: string;
|
|
550
|
+
/** Balance in token units, as a decimal string. */
|
|
551
|
+
balance: string;
|
|
552
|
+
decimals: number;
|
|
553
|
+
}
|
|
534
554
|
interface ListTokenTransactionsParams {
|
|
535
555
|
tokenId?: string;
|
|
556
|
+
chainId?: string;
|
|
536
557
|
page?: number;
|
|
537
558
|
pageSize?: number;
|
|
559
|
+
type?: TokenTransactionType;
|
|
560
|
+
status?: TokenTransactionStatus;
|
|
561
|
+
fromAddress?: string;
|
|
562
|
+
toAddress?: string;
|
|
563
|
+
txHash?: string;
|
|
564
|
+
operationRef?: string;
|
|
538
565
|
}
|
|
539
566
|
/** A recorded on-chain operation against a token (mint, burn, or transfer). */
|
|
540
567
|
interface TokenTransactionRecord {
|
|
541
568
|
id: string;
|
|
542
569
|
tokenId: string;
|
|
543
|
-
|
|
570
|
+
chainId: string;
|
|
544
571
|
projectId?: string;
|
|
545
572
|
type: TokenTransactionType;
|
|
546
573
|
status: TokenTransactionStatus;
|
|
@@ -561,22 +588,24 @@ interface TokenTransactionRecord {
|
|
|
561
588
|
interface UpdateTokenYieldParams {
|
|
562
589
|
/** Yield-bearing token id. */
|
|
563
590
|
tokenId: string;
|
|
564
|
-
|
|
591
|
+
chainId: string;
|
|
565
592
|
/** New annual yield rate, as a percentage. */
|
|
566
593
|
annualRate: number;
|
|
567
594
|
}
|
|
568
595
|
interface DistributeYieldParams {
|
|
569
596
|
tokenId: string;
|
|
570
|
-
|
|
597
|
+
chainId: string;
|
|
571
598
|
/** Amount to fund the distribution, in fiat major units. */
|
|
572
599
|
fundAmount: number;
|
|
600
|
+
payoutToken?: string;
|
|
573
601
|
/** Seconds after which unclaimed funds may be reclaimed. */
|
|
574
602
|
reclaimAfter?: number;
|
|
575
603
|
memo?: string;
|
|
576
604
|
}
|
|
577
605
|
interface PayCouponParams {
|
|
578
606
|
tokenId: string;
|
|
579
|
-
|
|
607
|
+
chainId: string;
|
|
608
|
+
payoutToken?: string;
|
|
580
609
|
/** Push the coupon to investors instead of letting them claim it. */
|
|
581
610
|
pushYield?: boolean;
|
|
582
611
|
reclaimAfter?: number;
|
|
@@ -584,7 +613,7 @@ interface PayCouponParams {
|
|
|
584
613
|
}
|
|
585
614
|
interface ClaimYieldParams {
|
|
586
615
|
tokenId: string;
|
|
587
|
-
|
|
616
|
+
chainId: string;
|
|
588
617
|
/** HD address index of the claiming investor. */
|
|
589
618
|
investorAddressIndex: number;
|
|
590
619
|
/** Distribution snapshot to claim against. */
|
|
@@ -592,7 +621,7 @@ interface ClaimYieldParams {
|
|
|
592
621
|
}
|
|
593
622
|
interface RedeemPrincipalParams {
|
|
594
623
|
tokenId: string;
|
|
595
|
-
|
|
624
|
+
chainId: string;
|
|
596
625
|
/** Push redeemed funds to investors instead of letting them claim. */
|
|
597
626
|
pushYield?: boolean;
|
|
598
627
|
}
|
|
@@ -619,7 +648,7 @@ declare class TokenizationResource extends APIResource {
|
|
|
619
648
|
* {@link getToken} until `status` is `ACTIVE`. Supply `yieldParams` for a
|
|
620
649
|
* `YIELD_BEARING` token.
|
|
621
650
|
*/
|
|
622
|
-
createToken(params: CreateTokenParams, overrides?:
|
|
651
|
+
createToken(params: CreateTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenDeploymentResult>;
|
|
623
652
|
/**
|
|
624
653
|
* Returns a paginated list of tokens for the calling project.
|
|
625
654
|
*
|
|
@@ -632,15 +661,23 @@ declare class TokenizationResource extends APIResource {
|
|
|
632
661
|
/** Fetches a single token by id, including its per-chain deployment details. */
|
|
633
662
|
getToken(id: string, overrides?: RequestOverrides): Promise<TokenDetail>;
|
|
634
663
|
/** Mints new units of a token to a recipient address. */
|
|
635
|
-
mintToken(params: MintTokenParams, overrides?:
|
|
664
|
+
mintToken(params: MintTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
|
|
636
665
|
/** Burns units of a token from a holder address. */
|
|
637
|
-
burnToken(params: BurnTokenParams, overrides?:
|
|
666
|
+
burnToken(params: BurnTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
|
|
638
667
|
/** Transfers token units between holder addresses. */
|
|
639
|
-
transferToken(params: TransferTokenParams, overrides?:
|
|
668
|
+
transferToken(params: TransferTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenTransferResult>;
|
|
669
|
+
/**
|
|
670
|
+
* Force-transfers token units out of a holder's address without the holder's signature
|
|
671
|
+
* (issuer/admin compliance action, e.g. recovery or court order). An `Idempotency-Key` is
|
|
672
|
+
* generated per call unless you pass your own.
|
|
673
|
+
*/
|
|
674
|
+
forcedTransfer(params: ForcedTransferTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
|
|
640
675
|
/** Registers (whitelists) a wallet address so it can hold a given token. */
|
|
641
|
-
registerWallet(params: RegisterTokenWalletParams, overrides?:
|
|
676
|
+
registerWallet(params: RegisterTokenWalletParams, overrides?: IdempotentRequestOverrides): Promise<RegisterTokenWalletResult>;
|
|
642
677
|
/** Returns the paginated list of holder wallet addresses and balances for a token on a chain. */
|
|
643
678
|
getTokenHolders(params: GetTokenHoldersParams, overrides?: RequestOverrides): Promise<Page<TokenHolder>>;
|
|
679
|
+
/** Returns a single wallet's balance of a token on a chain. */
|
|
680
|
+
getWalletBalance(params: GetWalletBalanceParams, overrides?: RequestOverrides): Promise<TokenWalletBalance>;
|
|
644
681
|
/** Fetches a single token transaction by its reference. */
|
|
645
682
|
getTokenTransaction(ref: string, overrides?: RequestOverrides): Promise<TokenTransactionRecord>;
|
|
646
683
|
/** Returns token transactions, optionally filtered by token. */
|
|
@@ -648,13 +685,13 @@ declare class TokenizationResource extends APIResource {
|
|
|
648
685
|
/** Updates the annual yield rate for a yield-bearing token. */
|
|
649
686
|
updateYield(params: UpdateTokenYieldParams, overrides?: RequestOverrides): Promise<YieldTxResult>;
|
|
650
687
|
/** Funds and distributes a yield payout to holders. Unclaimed funds may be reclaimed after `reclaimAfter`. */
|
|
651
|
-
distributeYield(params: DistributeYieldParams, overrides?:
|
|
688
|
+
distributeYield(params: DistributeYieldParams, overrides?: IdempotentRequestOverrides): Promise<YieldOperationResult>;
|
|
652
689
|
/** Pays the scheduled coupon for a yield-bearing token. Set `pushYield` to push funds rather than let investors claim. */
|
|
653
|
-
payCoupon(params: PayCouponParams, overrides?:
|
|
690
|
+
payCoupon(params: PayCouponParams, overrides?: IdempotentRequestOverrides): Promise<YieldOperationResult>;
|
|
654
691
|
/** Claims an investor's yield for a given distribution snapshot. */
|
|
655
|
-
claimYield(params: ClaimYieldParams, overrides?:
|
|
692
|
+
claimYield(params: ClaimYieldParams, overrides?: IdempotentRequestOverrides): Promise<YieldTxResult>;
|
|
656
693
|
/** Redeems principal to holders at maturity. Set `pushYield` to push funds rather than let investors claim. */
|
|
657
|
-
redeemPrincipal(params: RedeemPrincipalParams, overrides?:
|
|
694
|
+
redeemPrincipal(params: RedeemPrincipalParams, overrides?: IdempotentRequestOverrides): Promise<YieldTxResult>;
|
|
658
695
|
}
|
|
659
696
|
|
|
660
697
|
type SubscriptionStatus = LooseUnion<"active" | "paused" | "deleted">;
|
package/dist/index.js
CHANGED
|
@@ -570,11 +570,13 @@ var TokenizationResource = class extends APIResource {
|
|
|
570
570
|
* `YIELD_BEARING` token.
|
|
571
571
|
*/
|
|
572
572
|
async createToken(params, overrides = {}) {
|
|
573
|
+
const { idempotencyKey, ...rest } = overrides;
|
|
573
574
|
return this.client.request({
|
|
574
575
|
method: "POST",
|
|
575
576
|
path: "/v1/tokens",
|
|
576
577
|
body: params,
|
|
577
|
-
|
|
578
|
+
idempotencyKey: idempotencyKey ?? generateIdempotencyKey(),
|
|
579
|
+
...rest
|
|
578
580
|
});
|
|
579
581
|
}
|
|
580
582
|
/**
|
|
@@ -604,38 +606,61 @@ var TokenizationResource = class extends APIResource {
|
|
|
604
606
|
}
|
|
605
607
|
/** Mints new units of a token to a recipient address. */
|
|
606
608
|
async mintToken(params, overrides = {}) {
|
|
609
|
+
const { idempotencyKey, ...rest } = overrides;
|
|
607
610
|
return this.client.request({
|
|
608
611
|
method: "POST",
|
|
609
612
|
path: "/v1/tokens/mint",
|
|
610
613
|
body: params,
|
|
611
|
-
|
|
614
|
+
idempotencyKey: idempotencyKey ?? generateIdempotencyKey(),
|
|
615
|
+
...rest
|
|
612
616
|
});
|
|
613
617
|
}
|
|
614
618
|
/** Burns units of a token from a holder address. */
|
|
615
619
|
async burnToken(params, overrides = {}) {
|
|
620
|
+
const { idempotencyKey, ...rest } = overrides;
|
|
616
621
|
return this.client.request({
|
|
617
622
|
method: "POST",
|
|
618
623
|
path: "/v1/tokens/burn",
|
|
619
624
|
body: params,
|
|
620
|
-
|
|
625
|
+
idempotencyKey: idempotencyKey ?? generateIdempotencyKey(),
|
|
626
|
+
...rest
|
|
621
627
|
});
|
|
622
628
|
}
|
|
623
629
|
/** Transfers token units between holder addresses. */
|
|
624
630
|
async transferToken(params, overrides = {}) {
|
|
631
|
+
const { idempotencyKey, ...rest } = overrides;
|
|
625
632
|
return this.client.request({
|
|
626
633
|
method: "POST",
|
|
627
634
|
path: "/v1/tokens/transfer",
|
|
628
635
|
body: params,
|
|
629
|
-
|
|
636
|
+
idempotencyKey: idempotencyKey ?? generateIdempotencyKey(),
|
|
637
|
+
...rest
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Force-transfers token units out of a holder's address without the holder's signature
|
|
642
|
+
* (issuer/admin compliance action, e.g. recovery or court order). An `Idempotency-Key` is
|
|
643
|
+
* generated per call unless you pass your own.
|
|
644
|
+
*/
|
|
645
|
+
async forcedTransfer(params, overrides = {}) {
|
|
646
|
+
const { idempotencyKey, ...rest } = overrides;
|
|
647
|
+
return this.client.request({
|
|
648
|
+
method: "POST",
|
|
649
|
+
path: "/v1/tokens/forced-transfer",
|
|
650
|
+
body: params,
|
|
651
|
+
idempotencyKey: idempotencyKey ?? generateIdempotencyKey(),
|
|
652
|
+
...rest
|
|
630
653
|
});
|
|
631
654
|
}
|
|
632
655
|
/** Registers (whitelists) a wallet address so it can hold a given token. */
|
|
633
656
|
async registerWallet(params, overrides = {}) {
|
|
657
|
+
const { idempotencyKey, ...rest } = overrides;
|
|
634
658
|
return this.client.request({
|
|
635
659
|
method: "POST",
|
|
636
660
|
path: "/v1/tokens/register-wallet",
|
|
637
661
|
body: params,
|
|
638
|
-
|
|
662
|
+
idempotencyKey: idempotencyKey ?? generateIdempotencyKey(),
|
|
663
|
+
...rest
|
|
639
664
|
});
|
|
640
665
|
}
|
|
641
666
|
/** Returns the paginated list of holder wallet addresses and balances for a token on a chain. */
|
|
@@ -648,6 +673,15 @@ var TokenizationResource = class extends APIResource {
|
|
|
648
673
|
}).then((raw) => pageFromFlatResponse(raw, fetchPage));
|
|
649
674
|
return fetchPage({ page: params.page, pageSize: params.pageSize });
|
|
650
675
|
}
|
|
676
|
+
/** Returns a single wallet's balance of a token on a chain. */
|
|
677
|
+
async getWalletBalance(params, overrides = {}) {
|
|
678
|
+
return this.client.request({
|
|
679
|
+
method: "GET",
|
|
680
|
+
path: "/v1/tokens/balance",
|
|
681
|
+
query: { ...params },
|
|
682
|
+
...overrides
|
|
683
|
+
});
|
|
684
|
+
}
|
|
651
685
|
/** Fetches a single token transaction by its reference. */
|
|
652
686
|
async getTokenTransaction(ref, overrides = {}) {
|
|
653
687
|
return this.client.request({
|
|
@@ -677,38 +711,46 @@ var TokenizationResource = class extends APIResource {
|
|
|
677
711
|
}
|
|
678
712
|
/** Funds and distributes a yield payout to holders. Unclaimed funds may be reclaimed after `reclaimAfter`. */
|
|
679
713
|
async distributeYield(params, overrides = {}) {
|
|
714
|
+
const { idempotencyKey, ...rest } = overrides;
|
|
680
715
|
return this.client.request({
|
|
681
716
|
method: "POST",
|
|
682
717
|
path: "/v1/tokens/yield/distribute",
|
|
683
718
|
body: params,
|
|
684
|
-
|
|
719
|
+
idempotencyKey: idempotencyKey ?? generateIdempotencyKey(),
|
|
720
|
+
...rest
|
|
685
721
|
});
|
|
686
722
|
}
|
|
687
723
|
/** Pays the scheduled coupon for a yield-bearing token. Set `pushYield` to push funds rather than let investors claim. */
|
|
688
724
|
async payCoupon(params, overrides = {}) {
|
|
725
|
+
const { idempotencyKey, ...rest } = overrides;
|
|
689
726
|
return this.client.request({
|
|
690
727
|
method: "POST",
|
|
691
728
|
path: "/v1/tokens/yield/pay-coupon",
|
|
692
729
|
body: params,
|
|
693
|
-
|
|
730
|
+
idempotencyKey: idempotencyKey ?? generateIdempotencyKey(),
|
|
731
|
+
...rest
|
|
694
732
|
});
|
|
695
733
|
}
|
|
696
734
|
/** Claims an investor's yield for a given distribution snapshot. */
|
|
697
735
|
async claimYield(params, overrides = {}) {
|
|
736
|
+
const { idempotencyKey, ...rest } = overrides;
|
|
698
737
|
return this.client.request({
|
|
699
738
|
method: "POST",
|
|
700
739
|
path: "/v1/tokens/yield/claim",
|
|
701
740
|
body: params,
|
|
702
|
-
|
|
741
|
+
idempotencyKey: idempotencyKey ?? generateIdempotencyKey(),
|
|
742
|
+
...rest
|
|
703
743
|
});
|
|
704
744
|
}
|
|
705
745
|
/** Redeems principal to holders at maturity. Set `pushYield` to push funds rather than let investors claim. */
|
|
706
746
|
async redeemPrincipal(params, overrides = {}) {
|
|
747
|
+
const { idempotencyKey, ...rest } = overrides;
|
|
707
748
|
return this.client.request({
|
|
708
749
|
method: "POST",
|
|
709
750
|
path: "/v1/tokens/yield/redeem",
|
|
710
751
|
body: params,
|
|
711
|
-
|
|
752
|
+
idempotencyKey: idempotencyKey ?? generateIdempotencyKey(),
|
|
753
|
+
...rest
|
|
712
754
|
});
|
|
713
755
|
}
|
|
714
756
|
};
|