generated from PolymeshAssociation/typescript-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 11
/
types.ts
1537 lines (1377 loc) · 42.9 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import BigNumber from 'bignumber.js';
import {
Account,
AuthorizationRequest,
CheckpointSchedule,
ChildIdentity,
CorporateActionBase,
CustomPermissionGroup,
DefaultPortfolio,
FungibleAsset,
Identity,
KnownPermissionGroup,
MultiSig,
Nft,
NumberedPortfolio,
PolymeshTransaction,
PolymeshTransactionBatch,
Venue,
} from '~/internal';
import {
ActiveTransferRestrictions,
AddCountStatInput,
AssetDocument,
CheckPermissionsResult,
CheckRolesResult,
ClaimCountStatInput,
ClaimCountTransferRestriction,
ClaimPercentageTransferRestriction,
ClaimTarget,
CorporateActionTargets,
CountTransferRestriction,
InputCaCheckpoint,
InputCondition,
InputStatClaim,
InputStatType,
InputTargets,
InputTaxWithholding,
InputTrustedClaimIssuer,
KnownAssetType,
KnownNftType,
MetadataSpec,
MetadataType,
MetadataValueDetails,
NftCollection,
OfferingTier,
PercentageTransferRestriction,
PermissionedAccount,
PermissionsLike,
PortfolioLike,
PortfolioMovement,
Requirement,
Scope,
SecurityIdentifier,
Signer,
SignerType,
StatClaimIssuer,
StatType,
TaxWithholding,
TransactionPermissions,
TxTag,
VenueType,
} from '~/types';
import { Modify } from '~/types/utils';
export interface ProcedureAuthorizationStatus {
/**
* whether the Identity complies with all required Agent permissions
*/
agentPermissions: CheckPermissionsResult<SignerType.Identity>;
/**
* whether the Account complies with all required Signer permissions
*/
signerPermissions: CheckPermissionsResult<SignerType.Account>;
/**
* whether the Identity complies with all required Roles
*/
roles: CheckRolesResult;
/**
* whether the Account is frozen (i.e. can't perform any transactions)
*/
accountFrozen: boolean;
/**
* true only if the Procedure requires an Identity but the signing Account
* doesn't have one associated
*/
noIdentity: boolean;
}
export interface ProcedureOpts {
/**
* Account or address of a signing key to replace the current one (for this procedure only)
*/
signingAccount?: string | Account;
/**
* nonce value for signing the transaction
*
* An {@link api/entities/Account!Account} can directly fetch its current nonce by calling {@link api/entities/Account!Account.getCurrentNonce | account.getCurrentNonce}. More information can be found at: https://polkadot.js.org/docs/api/cookbook/tx/#how-do-i-take-the-pending-tx-pool-into-account-in-my-nonce
*
* @note the passed value can be either the nonce itself or a function that returns the nonce. This allows, for example, passing a closure that increases the returned value every time it's called, or a function that fetches the nonce from the chain or a different source
*/
nonce?: BigNumber | Promise<BigNumber> | (() => BigNumber | Promise<BigNumber>);
/**
* This option allows for transactions that never expire, aka "immortal". By default, a transaction is only valid for approximately 5 minutes (250 blocks) after its construction. Allows for transaction construction to be decoupled from its submission, such as requiring manual approval for the signing or providing "at least once" guarantees.
*
* More information can be found [here](https://wiki.polkadot.network/docs/build-protocol-info#transaction-mortality). Note the Polymesh chain will **never** reap Accounts, so the risk of a replay attack is mitigated.
*/
mortality?: MortalityProcedureOpt;
}
/**
* This transaction will never expire
*/
export interface ImmortalProcedureOptValue {
readonly immortal: true;
}
/**
* This transaction will be rejected if not included in a block after a while (default: ~5 minutes)
*/
export interface MortalProcedureOptValue {
readonly immortal: false;
/**
* The number of blocks the for which the transaction remains valid. Target block time is 6 seconds. The default should suffice for most use cases
*
* @note this value will get rounded up to the closest power of 2, e.g. `65` rounds up to `128`
* @note this value should not exceed 4096, which is the chain's `BlockHashCount` as the lesser of the two will be used.
*/
readonly lifetime?: BigNumber;
}
export type MortalityProcedureOpt = ImmortalProcedureOptValue | MortalProcedureOptValue;
export interface CreateTransactionBatchProcedureMethod {
<ReturnValues extends readonly [...unknown[]]>(
args: CreateTransactionBatchParams<ReturnValues>,
opts?: ProcedureOpts
): Promise<PolymeshTransactionBatch<ReturnValues, ReturnValues>>;
checkAuthorization: <ReturnValues extends [...unknown[]]>(
args: CreateTransactionBatchParams<ReturnValues>,
opts?: ProcedureOpts
) => Promise<ProcedureAuthorizationStatus>;
}
export interface ProcedureMethod<
MethodArgs,
ProcedureReturnValue,
ReturnValue = ProcedureReturnValue
> {
(args: MethodArgs, opts?: ProcedureOpts): Promise<
GenericPolymeshTransaction<ProcedureReturnValue, ReturnValue>
>;
checkAuthorization: (
args: MethodArgs,
opts?: ProcedureOpts
) => Promise<ProcedureAuthorizationStatus>;
}
export interface OptionalArgsProcedureMethod<
MethodArgs,
ProcedureReturnValue,
ReturnValue = ProcedureReturnValue
> {
(args?: MethodArgs, opts?: ProcedureOpts): Promise<
GenericPolymeshTransaction<ProcedureReturnValue, ReturnValue>
>;
checkAuthorization: (
args?: MethodArgs,
opts?: ProcedureOpts
) => Promise<ProcedureAuthorizationStatus>;
}
export interface NoArgsProcedureMethod<ProcedureReturnValue, ReturnValue = ProcedureReturnValue> {
(opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<ProcedureReturnValue, ReturnValue>>;
checkAuthorization: (opts?: ProcedureOpts) => Promise<ProcedureAuthorizationStatus>;
}
/**
* Targets of a corporate action in a flexible structure for input purposes
*/
export type InputCorporateActionTargets = Modify<
CorporateActionTargets,
{
identities: (string | Identity)[];
}
>;
/**
* Per-Identity tax withholdings of a corporate action in a flexible structure for input purposes
*/
export type InputCorporateActionTaxWithholdings = Modify<
TaxWithholding,
{
identity: string | Identity;
}
>[];
export type GenericPolymeshTransaction<ProcedureReturnValue, ReturnValue> =
| PolymeshTransaction<ProcedureReturnValue, ReturnValue>
| PolymeshTransactionBatch<ProcedureReturnValue, ReturnValue>;
export type TransactionArray<ReturnValues extends readonly [...unknown[]]> = {
// The type has to be any here to account for procedures with transformed return values
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[K in keyof ReturnValues]: GenericPolymeshTransaction<any, ReturnValues[K]>;
};
/**
* Transaction data for display purposes
*/
export interface TxData<Args extends unknown[] = unknown[]> {
/**
* transaction string identifier
*/
tag: TxTag;
/**
* arguments with which the transaction will be called
*/
args: Args;
}
// Roles
export enum RoleType {
TickerOwner = 'TickerOwner',
CddProvider = 'CddProvider',
VenueOwner = 'VenueOwner',
PortfolioCustodian = 'PortfolioCustodian',
CorporateActionsAgent = 'CorporateActionsAgent',
// eslint-disable-next-line @typescript-eslint/no-shadow
Identity = 'Identity',
}
export interface TickerOwnerRole {
type: RoleType.TickerOwner;
ticker: string;
}
export interface CddProviderRole {
type: RoleType.CddProvider;
}
export interface VenueOwnerRole {
type: RoleType.VenueOwner;
venueId: BigNumber;
}
export interface PortfolioId {
did: string;
number?: BigNumber;
}
export interface PortfolioCustodianRole {
type: RoleType.PortfolioCustodian;
portfolioId: PortfolioId;
}
export interface IdentityRole {
type: RoleType.Identity;
did: string;
}
export type Role =
| TickerOwnerRole
| CddProviderRole
| VenueOwnerRole
| PortfolioCustodianRole
| IdentityRole;
/**
* Transaction Groups (for permissions purposes)
*/
export enum TxGroup {
/**
* - TxTags.identity.AddInvestorUniquenessClaim
* - TxTags.portfolio.MovePortfolioFunds
* - TxTags.settlement.AddInstruction
* - TxTags.settlement.AddInstructionWithMemo
* - TxTags.settlement.AddAndAffirmInstruction
* - TxTags.settlement.AddAndAffirmInstructionWithMemo
* - TxTags.settlement.AffirmInstruction
* - TxTags.settlement.RejectInstruction
* - TxTags.settlement.CreateVenue
*/
PortfolioManagement = 'PortfolioManagement',
/**
* - TxTags.asset.MakeDivisible
* - TxTags.asset.RenameAsset
* - TxTags.asset.SetFundingRound
* - TxTags.asset.AddDocuments
* - TxTags.asset.RemoveDocuments
*/
AssetManagement = 'AssetManagement',
/**
* - TxTags.asset.Freeze
* - TxTags.asset.Unfreeze
* - TxTags.identity.AddAuthorization
* - TxTags.identity.RemoveAuthorization
*/
AdvancedAssetManagement = 'AdvancedAssetManagement',
/**
* - TxTags.identity.AddInvestorUniquenessClaim
* - TxTags.settlement.CreateVenue
* - TxTags.settlement.AddInstruction
* - TxTags.settlement.AddInstructionWithMemo
* - TxTags.settlement.AddAndAffirmInstruction
* - TxTags.settlement.AddAndAffirmInstructionWithMemo
*/
Distribution = 'Distribution',
/**
* - TxTags.asset.Issue
*/
Issuance = 'Issuance',
/**
* - TxTags.complianceManager.AddDefaultTrustedClaimIssuer
* - TxTags.complianceManager.RemoveDefaultTrustedClaimIssuer
*/
TrustedClaimIssuersManagement = 'TrustedClaimIssuersManagement',
/**
* - TxTags.identity.AddClaim
* - TxTags.identity.RevokeClaim
*/
ClaimsManagement = 'ClaimsManagement',
/**
* - TxTags.complianceManager.AddComplianceRequirement
* - TxTags.complianceManager.RemoveComplianceRequirement
* - TxTags.complianceManager.PauseAssetCompliance
* - TxTags.complianceManager.ResumeAssetCompliance
* - TxTags.complianceManager.ResetAssetCompliance
*/
ComplianceRequirementsManagement = 'ComplianceRequirementsManagement',
/**
* - TxTags.checkpoint.CreateSchedule,
* - TxTags.checkpoint.RemoveSchedule,
* - TxTags.checkpoint.CreateCheckpoint,
* - TxTags.corporateAction.InitiateCorporateAction,
* - TxTags.capitalDistribution.Distribute,
* - TxTags.capitalDistribution.Claim,
* - TxTags.identity.AddInvestorUniquenessClaim,
*/
CorporateActionsManagement = 'CorporateActionsManagement',
/**
* - TxTags.sto.CreateFundraiser,
* - TxTags.sto.FreezeFundraiser,
* - TxTags.sto.Invest,
* - TxTags.sto.ModifyFundraiserWindow,
* - TxTags.sto.Stop,
* - TxTags.sto.UnfreezeFundraiser,
* - TxTags.identity.AddInvestorUniquenessClaim,
* - TxTags.asset.Issue,
* - TxTags.settlement.CreateVenue
*/
StoManagement = 'StoManagement',
}
export type AddRestrictionParams<T> = Omit<
T extends TransferRestrictionType.Count
? AddCountTransferRestrictionParams
: T extends TransferRestrictionType.Percentage
? AddPercentageTransferRestrictionParams
: T extends TransferRestrictionType.ClaimCount
? AddClaimCountTransferRestrictionParams
: AddClaimPercentageTransferRestrictionParams,
'type'
>;
export type SetRestrictionsParams<T> = Omit<
T extends TransferRestrictionType.Count
? SetCountTransferRestrictionsParams
: T extends TransferRestrictionType.Percentage
? SetPercentageTransferRestrictionsParams
: T extends TransferRestrictionType.ClaimCount
? SetClaimCountTransferRestrictionsParams
: SetClaimPercentageTransferRestrictionsParams,
'type'
>;
export type GetTransferRestrictionReturnType<T> = ActiveTransferRestrictions<
T extends TransferRestrictionType.Count
? CountTransferRestriction
: T extends TransferRestrictionType.Percentage
? PercentageTransferRestriction
: T extends TransferRestrictionType.ClaimCount
? ClaimCountTransferRestriction
: ClaimPercentageTransferRestriction
>;
export type RemoveAssetStatParams = { ticker: string } & (
| RemoveCountStatParams
| RemoveBalanceStatParams
| RemoveScopedCountParams
| RemoveScopedBalanceParams
);
export type AddCountStatParams = AddCountStatInput & {
type: StatType.Count;
};
export type AddPercentageStatParams = {
type: StatType.Balance;
};
export type AddClaimCountStatParams = ClaimCountStatInput & {
type: StatType.ScopedCount;
};
export type AddClaimPercentageStatParams = StatClaimIssuer & {
type: StatType.ScopedBalance;
};
export type AddAssetStatParams = { ticker: string } & (
| AddCountStatParams
| AddPercentageStatParams
| AddClaimCountStatParams
| AddClaimPercentageStatParams
);
export type RemoveCountStatParams = {
type: StatType.Count;
};
export type RemoveBalanceStatParams = {
type: StatType.Balance;
};
export type RemoveScopedCountParams = StatClaimIssuer & {
type: StatType.ScopedCount;
};
export type RemoveScopedBalanceParams = StatClaimIssuer & {
type: StatType.ScopedBalance;
};
export type SetAssetStatParams<T> = Omit<
T extends TransferRestrictionType.Count
? AddCountStatParams
: T extends TransferRestrictionType.Percentage
? AddPercentageStatParams
: T extends TransferRestrictionType.ClaimCount
? AddClaimCountStatParams
: AddClaimPercentageStatParams,
'type'
>;
export enum TransferRestrictionType {
Count = 'Count',
Percentage = 'Percentage',
ClaimCount = 'ClaimCount',
ClaimPercentage = 'ClaimPercentage',
}
export interface ClaimCountRestrictionValue {
min: BigNumber;
max?: BigNumber;
issuer: Identity;
claim: InputStatClaim;
}
export interface ClaimPercentageRestrictionValue {
min: BigNumber;
max: BigNumber;
issuer: Identity;
claim: InputStatClaim;
}
export type TransferRestriction =
| {
type: TransferRestrictionType.Count;
value: BigNumber;
}
| { type: TransferRestrictionType.Percentage; value: BigNumber }
| {
type: TransferRestrictionType.ClaimCount;
value: ClaimCountRestrictionValue;
}
| {
type: TransferRestrictionType.ClaimPercentage;
value: ClaimPercentageRestrictionValue;
};
interface TransferRestrictionInputBase {
/**
* array of Identities (or DIDs) that are exempted from the Restriction
*/
exemptedIdentities?: (Identity | string)[];
}
export interface CountTransferRestrictionInput extends TransferRestrictionInputBase {
/**
* limit on the amount of different (unique) investors that can hold the Asset at once
*/
count: BigNumber;
}
export interface PercentageTransferRestrictionInput extends TransferRestrictionInputBase {
/**
* maximum percentage (0-100) of the total supply of the Asset that can be held by a single investor at once
*/
percentage: BigNumber;
}
export interface ClaimCountTransferRestrictionInput extends TransferRestrictionInputBase {
min: BigNumber;
max?: BigNumber;
issuer: Identity;
claim: InputStatClaim;
}
export interface ClaimPercentageTransferRestrictionInput extends TransferRestrictionInputBase {
min: BigNumber;
max: BigNumber;
issuer: Identity;
claim: InputStatClaim;
}
export type AddCountTransferRestrictionParams = CountTransferRestrictionInput & {
type: TransferRestrictionType.Count;
};
export type AddPercentageTransferRestrictionParams = PercentageTransferRestrictionInput & {
type: TransferRestrictionType.Percentage;
};
export type AddClaimCountTransferRestrictionParams = ClaimCountTransferRestrictionInput & {
type: TransferRestrictionType.ClaimCount;
};
export type AddClaimPercentageTransferRestrictionParams =
ClaimPercentageTransferRestrictionInput & {
type: TransferRestrictionType.ClaimPercentage;
};
export interface SetCountTransferRestrictionsParams {
/**
* array of Count Transfer Restrictions with their corresponding exemptions (if applicable)
*/
restrictions: CountTransferRestrictionInput[];
type: TransferRestrictionType.Count;
}
export interface SetPercentageTransferRestrictionsParams {
/**
* array of Percentage Transfer Restrictions with their corresponding exemptions (if applicable)
*/
restrictions: PercentageTransferRestrictionInput[];
type: TransferRestrictionType.Percentage;
}
export interface SetClaimCountTransferRestrictionsParams {
restrictions: ClaimCountTransferRestrictionInput[];
type: TransferRestrictionType.ClaimCount;
}
export interface SetClaimPercentageTransferRestrictionsParams {
restrictions: ClaimPercentageTransferRestrictionInput[];
type: TransferRestrictionType.ClaimPercentage;
}
export interface InviteAccountParams {
targetAccount: string | Account;
permissions?: PermissionsLike;
expiry?: Date;
}
export interface AcceptPrimaryKeyRotationParams {
/**
* Authorization from the owner who initiated the change
*/
ownerAuth: BigNumber | AuthorizationRequest;
/**
* (optional) Authorization from a CDD service provider attesting the rotation of primary key
*/
cddAuth?: BigNumber | AuthorizationRequest;
}
export interface ModifySignerPermissionsParams {
/**
* list of secondary Accounts
*/
secondaryAccounts: Modify<
PermissionedAccount,
{ account: string | Account; permissions: PermissionsLike }
>[];
}
export interface RemoveSecondaryAccountsParams {
accounts: Account[];
}
export interface SubsidizeAccountParams {
/**
* Account to subsidize
*/
beneficiary: string | Account;
/**
* amount of POLYX to be subsidized. This can be increased/decreased later on
*/
allowance: BigNumber;
}
export interface CreateAssetParams {
name: string;
/**
* amount of Asset tokens that will be minted on creation (optional, default doesn't mint)
*/
initialSupply?: BigNumber;
/**
* portfolio to which the Asset tokens will be issued on creation (optional, default is the default portfolio)
*/
portfolioId?: BigNumber;
/**
* whether a single Asset token can be divided into decimal parts
*/
isDivisible: boolean;
/**
* type of security that the Asset represents (e.g. Equity, Debt, Commodity). Common values are included in the
* {@link types!KnownAssetType} enum, but custom values can be used as well. Custom values must be registered on-chain the first time
* they're used, requiring an additional transaction. They aren't tied to a specific Asset
*/
assetType: KnownAssetType | string;
/**
* array of domestic or international alphanumeric security identifiers for the Asset (e.g. ISIN, CUSIP, FIGI)
*/
securityIdentifiers?: SecurityIdentifier[];
/**
* (optional) funding round in which the Asset currently is (e.g. Series A, Series B)
*/
fundingRound?: string;
documents?: AssetDocument[];
/**
* (optional) type of statistics that should be enabled for the Asset
*
* Enabling statistics allows for TransferRestrictions to be made. For example the SEC requires registration for a company that
* has either more than 2000 investors, or more than 500 non accredited investors. To prevent crossing this limit two restrictions are
* needed, a `Count` of 2000, and a `ScopedCount` of non accredited with a maximum of 500. [source](https://www.sec.gov/info/smallbus/secg/jobs-act-section-12g-small-business-compliance-guide.htm)
*
* These restrictions require a `Count` and `ScopedCount` statistic to be created. Although they an be created after the Asset is made, it is recommended to create statistics
* before the Asset is circulated. Count statistics made after Asset creation need their initial value set, so it is simpler to create them before investors hold the Asset.
* If you do need to create a stat for an Asset after creation, you can use the { @link api/entities/Asset/Fungible/TransferRestrictions/TransferRestrictionBase!TransferRestrictionBase.enableStat | enableStat } method in
* the appropriate namespace
*/
initialStatistics?: InputStatType[];
}
export interface CreateAssetWithTickerParams extends CreateAssetParams {
ticker: string;
}
export interface GlobalCollectionKeyInput {
type: MetadataType.Global;
id: BigNumber;
}
export interface LocalCollectionKeyInput {
type: MetadataType.Local;
name: string;
spec: MetadataSpec;
}
/**
* Global key must be registered. local keys must provide a specification as they are created with the NftCollection
*/
export type CollectionKeyInput = GlobalCollectionKeyInput | LocalCollectionKeyInput;
export interface CreateNftCollectionParams {
/**
* The primary identifier for the collection. The ticker must either be free, or the signer has appropriate permissions if reserved
*/
ticker: string;
/**
* The collection name. defaults to `ticker`
*/
name?: string;
/**
* @throws if provided string that does not have a custom type
* @throws if provided a BigNumber that does not correspond to a custom type
*/
nftType: KnownNftType | string | BigNumber;
/**
* array of domestic or international alphanumeric security identifiers for the Asset (e.g. ISIN, CUSIP, FIGI)
*/
securityIdentifiers?: SecurityIdentifier[];
/**
* The required metadata values each NFT in the collection will have
*
* @note Images — Most Polymesh networks (mainnet, testnet, etc.) have global metadata keys registered to help standardize displaying images
* If `imageUri` is specified as a collection key, then each token will need to be issued with an image URI.
*/
collectionKeys: CollectionKeyInput[];
/**
* Links to off chain documents related to the NftCollection
*/
documents?: AssetDocument[];
/**
* A optional field that can be used to provide information about the funding state of the asset
*/
fundingRound?: string;
}
export interface ReserveTickerParams {
/**
* ticker symbol to reserve
*/
ticker: string;
extendPeriod?: boolean;
}
export enum ClaimOperation {
Revoke = 'Revoke',
Add = 'Add',
Edit = 'Edit',
}
export interface AddClaimsParams {
/**
* array of claims to be added
*/
claims: ClaimTarget[];
operation: ClaimOperation.Add;
}
export interface EditClaimsParams {
/**
* array of claims to be edited
*/
claims: ClaimTarget[];
operation: ClaimOperation.Edit;
}
export interface RevokeClaimsParams {
/**
* array of claims to be revoked
*/
claims: Omit<ClaimTarget, 'expiry'>[];
operation: ClaimOperation.Revoke;
}
export type ModifyClaimsParams = AddClaimsParams | EditClaimsParams | RevokeClaimsParams;
export interface ScopeClaimProof {
proofScopeIdWellFormed: string;
proofScopeIdCddIdMatch: {
challengeResponses: [string, string];
subtractExpressionsRes: string;
blindedScopeDidHash: string;
};
}
export interface AddInvestorUniquenessClaimParams {
scope: Scope;
cddId: string;
proof: string | ScopeClaimProof;
scopeId: string;
expiry?: Date;
}
export interface RegisterIdentityParams {
/**
* The Account that should function as the primary key of the newly created Identity. Can be ss58 encoded address or an instance of Account
*/
targetAccount: string | Account;
/**
* (optional) secondary accounts for the new Identity with their corresponding permissions.
* @note Each Account will need to accept the generated authorizations before being linked to the Identity
*/
secondaryAccounts?: Modify<PermissionedAccount, { permissions: PermissionsLike }>[];
/**
* (optional) also issue a CDD claim for the created DID, completing the onboarding process for the Account
*/
createCdd?: boolean;
/**
* (optional) when the generated CDD claim should expire, `createCdd` must be true if specified
*/
expiry?: Date;
}
export interface AttestPrimaryKeyRotationParams {
/**
* The Account that will be attested to become the primary key of the `identity`. Can be ss58 encoded address or an instance of Account
*/
targetAccount: string | Account;
/**
* Identity or the DID of the Identity that is to be rotated
*/
identity: string | Identity;
/**
* (optional) when the generated authorization should expire
*/
expiry?: Date;
}
export interface RotatePrimaryKeyParams {
/**
* The Account that should function as the primary key of the newly created Identity. Can be ss58 encoded address or an instance of Account
*/
targetAccount: string | Account;
/**
* (optional) when the generated authorization should expire
*/
expiry?: Date;
}
export type RotatePrimaryKeyToSecondaryParams = {
permissions: PermissionsLike;
/**
* The Account that should function as the primary key of the newly created Identity. Can be ss58 encoded address or an instance of Account
*/
targetAccount: string | Account;
/**
* (optional) when the generated authorization should expire
*/
expiry?: Date;
};
export interface TransferPolyxParams {
/**
* Account that will receive the POLYX
*/
to: string | Account;
/**
* amount of POLYX to be transferred
*/
amount: BigNumber;
/**
* identifier string to help differentiate transfers
*/
memo?: string;
}
export interface InstructionFungibleLeg {
amount: BigNumber;
from: PortfolioLike;
to: PortfolioLike;
asset: string | FungibleAsset;
}
export interface InstructionNftLeg {
nfts: (BigNumber | Nft)[];
from: PortfolioLike;
to: PortfolioLike;
asset: string | NftCollection;
}
export type InstructionLeg = InstructionFungibleLeg | InstructionNftLeg;
export type AddInstructionParams = {
/**
* array of Asset movements
*/
legs: InstructionLeg[];
/**
* date at which the trade was agreed upon (optional, for off chain trades)
*/
tradeDate?: Date;
/**
* date at which the trade was executed (optional, for off chain trades)
*/
valueDate?: Date;
/**
* identifier string to help differentiate instructions
*/
memo?: string;
/**
* additional identities that must affirm the instruction
*/
mediators?: (string | Identity)[];
} & (
| {
/**
* block at which the Instruction will be executed automatically (optional, the Instruction will be executed when all participants have authorized it if not supplied)
*/
endBlock?: BigNumber;
}
| {
/**
* block after which the Instruction can be manually executed (optional, the Instruction will be executed when all participants have authorized it if not supplied)
*/
endAfterBlock?: BigNumber;
}
);
export interface AddInstructionsParams {
/**
* array of Instructions to be added in the Venue
*/
instructions: AddInstructionParams[];
}
export type AddInstructionWithVenueIdParams = AddInstructionParams & {
venueId: BigNumber;
};
export interface InstructionIdParams {
id: BigNumber;
}
export enum InstructionAffirmationOperation {
Affirm = 'Affirm',
Withdraw = 'Withdraw',
Reject = 'Reject',
AffirmAsMediator = 'AffirmAsMediator',
WithdrawAsMediator = 'WithdrawAsMediator',
RejectAsMediator = 'RejectAsMediator',
}
export type RejectInstructionParams = {
/**
* (optional) Portfolio that the signer controls and wants to reject the instruction
*/
portfolio?: PortfolioLike;
};
export type AffirmOrWithdrawInstructionParams = {
/**
* (optional) Portfolios that the signer controls and wants to affirm the instruction or withdraw affirmation
*
* @note if empty, all the legs containing any custodied Portfolios of the signer will be affirmed/affirmation will be withdrawn, based on the operation.
*/
portfolios?: PortfolioLike[];
};
export type AffirmAsMediatorParams = {
expiry?: Date;
};
export type ModifyInstructionAffirmationParams = InstructionIdParams &
(
| ({
operation:
| InstructionAffirmationOperation.Affirm
| InstructionAffirmationOperation.Withdraw;
} & AffirmOrWithdrawInstructionParams)
| ({
operation:
| InstructionAffirmationOperation.Reject
| InstructionAffirmationOperation.RejectAsMediator;
} & RejectInstructionParams)
| ({
operation: InstructionAffirmationOperation.AffirmAsMediator;
} & AffirmAsMediatorParams)
| {
operation:
| InstructionAffirmationOperation.WithdrawAsMediator
| InstructionAffirmationOperation.RejectAsMediator;
}
);
export interface ExecuteManualInstructionParams {
/**
* (optional) Set to `true` to skip affirmation check, useful for batch transactions
*/
skipAffirmationCheck?: boolean;
}
export interface CreateVenueParams {
description: string;
type: VenueType;
}
export interface ControllerTransferParams {
/**
* portfolio (or portfolio ID) from which Assets will be transferred
*/
originPortfolio: PortfolioLike;
/**
* amount of Asset tokens to transfer
*/
amount: BigNumber;
}
export interface NftControllerTransferParams {
/**
* portfolio (or portfolio ID) from which NFTs will be transferred from
*/
originPortfolio: PortfolioLike;
/**
* The NFTs to transfer
*/
nfts: (Nft | BigNumber)[];
/**
* Optional portfolio (or portfolio ID) to which NFTs will be transferred to. Defaults to default. If specified it must be one of the callers own portfolios
*/
destinationPortfolio?: PortfolioLike;
}
export type ModifyAssetParams =
| {
/**
* makes an indivisible Asset divisible
*/
makeDivisible?: true;
name: string;
fundingRound?: string;