@dstoken-solana/rwa-rbac 0.2.1 → 0.3.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/dist/client/AssetController.d.ts +3 -9
- package/dist/client/AssetController.d.ts.map +1 -1
- package/dist/client/IdentityRegistry.d.ts +2 -26
- package/dist/client/IdentityRegistry.d.ts.map +1 -1
- package/dist/index.es.js +17 -355
- package/dist/index.js +16 -354
- package/dist/types/generated/rwa_rbac.d.ts +6 -233
- package/dist/types/generated/rwa_rbac.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import { Program } from "@coral-xyz/anchor";
|
|
|
2
2
|
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
3
3
|
import { IssueTokensArgs, UpdateInterestBearingMintRateArgs } from "../types/instructions";
|
|
4
4
|
import { RwaRbac } from "../types/generated/rwa_rbac";
|
|
5
|
-
import { CloseMintArgs, CreateAssetControllerIx, FreezeTokenArgs, RevokeTokensArgs, RwaClient, SeizeTokensArgs, TransferTokensArgs, UpdateAssetMetadataArgs
|
|
5
|
+
import { CloseMintArgs, CreateAssetControllerIx, FreezeTokenArgs, RevokeTokensArgs, RwaClient, SeizeTokensArgs, TransferTokensArgs, UpdateAssetMetadataArgs } from "@dstoken-solana/rwa-token-sdk";
|
|
6
6
|
/**
|
|
7
7
|
* Represents the role-based access client for Asset Controller for an RWA.
|
|
8
8
|
*/
|
|
@@ -31,12 +31,6 @@ export declare class AssetController {
|
|
|
31
31
|
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
32
32
|
*/
|
|
33
33
|
issueTokenIxns(args: IssueTokensArgs, assetAccessController: PublicKey, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
34
|
-
/**
|
|
35
|
-
* Asynchronously generates instructions to revoke assets.
|
|
36
|
-
* @param args - {@link VoidTokensArgs}
|
|
37
|
-
* @returns A Promise that resolves to the instructions to revoke assets.
|
|
38
|
-
*/
|
|
39
|
-
voidTokenIxns(args: VoidTokensArgs): Promise<TransactionInstruction>;
|
|
40
34
|
/**
|
|
41
35
|
* Executes a token transfer.
|
|
42
36
|
* @param args - {@link TransferTokensArgs}
|
|
@@ -62,13 +56,13 @@ export declare class AssetController {
|
|
|
62
56
|
/**
|
|
63
57
|
* Asynchronously generates instructions to revoke tokens from a user.
|
|
64
58
|
* @param args - {@link RevokeTokensArgs}
|
|
65
|
-
* @param payer - Payer public key.
|
|
66
59
|
* @param signer - User signer public key.
|
|
67
60
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
61
|
+
* @param investorId - Optional investorId. Required if user is not an investor.
|
|
68
62
|
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
69
63
|
* @returns A Promise that resolves to the instructions to revoke.
|
|
70
64
|
*/
|
|
71
|
-
revokeTokenIxn(args: RevokeTokensArgs,
|
|
65
|
+
revokeTokenIxn(args: RevokeTokensArgs, signer: PublicKey, assetAccessController: PublicKey, investorId?: string, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
72
66
|
/**
|
|
73
67
|
* Asynchronously generates instruction to close mint.
|
|
74
68
|
* @param args - {@link CloseMintArgs}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetController.d.ts","sourceRoot":"","sources":["../../src/client/AssetController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,SAAS,EAGT,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAQzB,OAAO,EACL,eAAe,EAEf,iCAAiC,EAClC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAEL,aAAa,EACb,uBAAuB,EACvB,eAAe,EAoBf,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"AssetController.d.ts","sourceRoot":"","sources":["../../src/client/AssetController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,SAAS,EAGT,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAQzB,OAAO,EACL,eAAe,EAEf,iCAAiC,EAClC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAEL,aAAa,EACb,uBAAuB,EACvB,eAAe,EAoBf,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,+BAA+B,CAAC;AAUvC;;GAEG;AACH,qBAAa,eAAe;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;gBAElB,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC;IAK/D;;;;OAIG;IACG,gBAAgB,CAAC,IAAI,EAAE,uBAAuB;IAIpD;;;;;;SAMK;IACC,mBAAmB,CACvB,IAAI,EAAE,uBAAuB,EAC7B,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAuBlC;;;;;OAKG;IACG,cAAc,CAAC,IAAI,EAAE,eAAe,EACxC,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAkElE;;;;OAIG;IACG,QAAQ,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;IAI3E;;;;;;OAMG;IACG,cAAc,CAClB,IAAI,EAAE,eAAe,EACrB,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAyBlC;;;;;;OAMG;IACG,YAAY,CAChB,IAAI,EAAE,eAAe,EACrB,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IA0BlC;;;;;;;;OAQG;IACG,cAAc,CAClB,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,SAAS,EACjB,qBAAqB,EAAE,SAAS,EAChC,UAAU,CAAC,EAAE,MAAM,EACnB,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAqDlC;;;;;;OAMG;IACG,YAAY,CAChB,IAAI,EAAE,aAAa,EACnB,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAkBlC;;;;;;OAMG;IACG,gCAAgC,CACpC,IAAI,EAAE,iCAAiC,EACvC,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAsBlC;;;;;;;OAOG;IACG,cAAc,CAClB,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,SAAS,EACjB,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,CAAC;CAwFnC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Program } from "@coral-xyz/anchor";
|
|
2
2
|
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
3
3
|
import { RwaRbac } from "../types/generated/rwa_rbac";
|
|
4
|
-
import { AttachDetachWalletArgs,
|
|
5
|
-
import {
|
|
4
|
+
import { AttachDetachWalletArgs, RevokeIdentityArgs } from "../types/instructions";
|
|
5
|
+
import { IxReturn, RwaClient, SetupUserArgs } from "@dstoken-solana/rwa-token-sdk";
|
|
6
6
|
/**
|
|
7
7
|
* Represents the role-based access client for Identity Registry for an RWA.
|
|
8
8
|
*/
|
|
@@ -32,30 +32,6 @@ export declare class IdentityRegistry {
|
|
|
32
32
|
* It is required for at least a single user to be setup before issuing tokens.
|
|
33
33
|
*/
|
|
34
34
|
removeUserIxn(args: RevokeIdentityArgs, assetAccessController: PublicKey, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
35
|
-
/**
|
|
36
|
-
* Asynchronously update a non-investor user identity account level.
|
|
37
|
-
* @param args - {@link AddLevelToIdentityAccountArgs}
|
|
38
|
-
* @param assetAccessController - RBAC AssetAccessController account.
|
|
39
|
-
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
40
|
-
* @returns A Promise that resolves to the instructions to update user account identity.
|
|
41
|
-
* */
|
|
42
|
-
addIdentityLevelToUserAccount(args: AddLevelToIdentityAccountArgs, assetAccessController: PublicKey, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
43
|
-
/**
|
|
44
|
-
* Asynchronously reduces a non-Investor user identity account level.
|
|
45
|
-
* @param args - {@link RemoveLevelFromIdentityAccount}
|
|
46
|
-
* @param assetAccessController - RBAC AssetAccessController account.
|
|
47
|
-
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
48
|
-
* @returns A Promise that resolves to the instructions to reduce the level of a user identity account.
|
|
49
|
-
*/
|
|
50
|
-
removeIdentityLevelFromUserAccount(args: RemoveLevelFromIdentityAccountArgs, assetAccessController: PublicKey, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
51
|
-
/**
|
|
52
|
-
* Asynchronously generates instruction to refresh expiry on an Identity Account level.
|
|
53
|
-
* @param args - {@link RefreshLevelArgs}
|
|
54
|
-
* @param assetAccessController - RBAC AssetAccessController account.
|
|
55
|
-
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
56
|
-
* @returns A Promise that resolves to refresh expiry on an Identity Account level.
|
|
57
|
-
* */
|
|
58
|
-
refreshLevelToIdentityAccountIxn(args: RefreshLevelArgs, assetAccessController: PublicKey, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
59
35
|
/**
|
|
60
36
|
* Asynchronously generates instruction to attach wallet to identity.
|
|
61
37
|
* @param args - {@link AttachDetachWalletArgs}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdentityRegistry.d.ts","sourceRoot":"","sources":["../../src/client/IdentityRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EACL,sBAAsB,
|
|
1
|
+
{"version":3,"file":"IdentityRegistry.d.ts","sourceRoot":"","sources":["../../src/client/IdentityRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EACL,sBAAsB,EAEtB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAYL,QAAQ,EAGR,SAAS,EACT,aAAa,EACd,MAAM,+BAA+B,CAAC;AAKvC;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;gBAElB,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC;IAK/D;;;;;;;;;OASG;IACG,aAAa,CACjB,IAAI,EAAE,aAAa,EACnB,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,QAAQ,CAAC;IAyCpB;;;;;;;;;OASG;IACG,aAAa,CACjB,IAAI,EAAE,kBAAkB,EACxB,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAgClC;;;;;;SAMK;IACC,yBAAyB,CAC7B,IAAI,EAAE,sBAAsB,EAC5B,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAiDlC;;;;;;SAMK;IACC,2BAA2B,CAC/B,IAAI,EAAE,sBAAsB,EAC5B,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,CAAC;CAmDnC"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PublicKey, SystemProgram } from '@solana/web3.js';
|
|
2
2
|
import { utils, Program, BN } from '@coral-xyz/anchor';
|
|
3
3
|
import { TOKEN_2022_PROGRAM_ID, getAssociatedTokenAddressSync, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
4
|
-
import { getCreateAssetControllerIx, getAssetControllerPda, assetControllerProgramId, getAssetControllerEventAuthority, getIdentityRegistryPda, getIssueTokensIx, getTrackerAccountPda, getPolicyEnginePda, policyEngineProgramId, getIdentityAccountPda, getWalletIdentityAccountPda, getFreezeTokenIx, getThawTokenIx, getRevokeTokensIx, getCloseMintIx, getUpdateInterestBearingMintRateIx, getSeizeTokensIx, identityRegistryProgramId, getExtraMetasListPda, getPolicyEngineEventAuthority, getIdentityRegistryEventAuthority, getIdentityAccount,
|
|
4
|
+
import { getCreateAssetControllerIx, getAssetControllerPda, assetControllerProgramId, getAssetControllerEventAuthority, getIdentityRegistryPda, getIssueTokensIx, getTrackerAccountPda, getPolicyEnginePda, policyEngineProgramId, getIdentityAccountPda, getWalletIdentityAccountPda, getFreezeTokenIx, getThawTokenIx, getRevokeTokensIx, getCloseMintIx, getUpdateInterestBearingMintRateIx, getSeizeTokensIx, identityRegistryProgramId, getExtraMetasListPda, getPolicyEngineEventAuthority, getIdentityRegistryEventAuthority, getIdentityAccount, getIdentityRegistryProgram, getPolicyEngineProgram, RwaClient } from '@dstoken-solana/rwa-token-sdk';
|
|
5
5
|
|
|
6
6
|
const IMR_PROGRAM = new PublicKey("D2V7wTBbNCKgYwirgRUnSmc2QyKnHSVmRotWJ4rz8Jp9");
|
|
7
7
|
const RBAC_PROGRAM = new PublicKey("3g6fUgMsJQhjPUYxNjEU5PyzGf8DerbDx8p5Qh4yMnRR");
|
|
@@ -51,98 +51,6 @@ var metadata$1 = {
|
|
|
51
51
|
description: "Created with Anchor"
|
|
52
52
|
};
|
|
53
53
|
var instructions$1 = [
|
|
54
|
-
{
|
|
55
|
-
name: "add_level_to_identity_account",
|
|
56
|
-
discriminator: [
|
|
57
|
-
102,
|
|
58
|
-
204,
|
|
59
|
-
64,
|
|
60
|
-
169,
|
|
61
|
-
252,
|
|
62
|
-
177,
|
|
63
|
-
192,
|
|
64
|
-
232
|
|
65
|
-
],
|
|
66
|
-
accounts: [
|
|
67
|
-
{
|
|
68
|
-
name: "payer",
|
|
69
|
-
writable: true,
|
|
70
|
-
signer: true
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: "user",
|
|
74
|
-
signer: true
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: "controller_authority",
|
|
78
|
-
relations: [
|
|
79
|
-
"asset_access_controller"
|
|
80
|
-
]
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: "asset_access_controller",
|
|
84
|
-
relations: [
|
|
85
|
-
"authorized_user_role"
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "authorized_user_role",
|
|
90
|
-
optional: true
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "identity_registry_program",
|
|
94
|
-
address: "GZsnjqT3c5zbHqsctrJ4EG4rbEfo7ZXyyUG7aDJNmxfA"
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: "identity_registry"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: "identity_account",
|
|
101
|
-
writable: true
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: "identity_account_owner",
|
|
105
|
-
docs: [
|
|
106
|
-
"to ensure that it is not an Investor account. If it is an Investor account,",
|
|
107
|
-
"CPI to IdentityMetadataRegistry should be called."
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
name: "system_program",
|
|
112
|
-
address: "11111111111111111111111111111111"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: "policy_engine_program"
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: "policy_engine",
|
|
119
|
-
writable: true
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
name: "tracker_account"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "asset_mint"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: "event_authority"
|
|
129
|
-
}
|
|
130
|
-
],
|
|
131
|
-
args: [
|
|
132
|
-
{
|
|
133
|
-
name: "level",
|
|
134
|
-
type: "u8"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
name: "expiry",
|
|
138
|
-
type: "i64"
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
name: "enforce_limits",
|
|
142
|
-
type: "bool"
|
|
143
|
-
}
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
54
|
{
|
|
147
55
|
name: "add_levels",
|
|
148
56
|
discriminator: [
|
|
@@ -1246,6 +1154,12 @@ var instructions$1 = [
|
|
|
1246
1154
|
{
|
|
1247
1155
|
name: "identity_registry"
|
|
1248
1156
|
},
|
|
1157
|
+
{
|
|
1158
|
+
name: "token_account"
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
name: "asset_mint"
|
|
1162
|
+
},
|
|
1249
1163
|
{
|
|
1250
1164
|
name: "event_authority"
|
|
1251
1165
|
}
|
|
@@ -1467,63 +1381,6 @@ var instructions$1 = [
|
|
|
1467
1381
|
}
|
|
1468
1382
|
]
|
|
1469
1383
|
},
|
|
1470
|
-
{
|
|
1471
|
-
name: "refresh_level_to_identity_account",
|
|
1472
|
-
discriminator: [
|
|
1473
|
-
23,
|
|
1474
|
-
68,
|
|
1475
|
-
237,
|
|
1476
|
-
111,
|
|
1477
|
-
144,
|
|
1478
|
-
169,
|
|
1479
|
-
239,
|
|
1480
|
-
91
|
|
1481
|
-
],
|
|
1482
|
-
accounts: [
|
|
1483
|
-
{
|
|
1484
|
-
name: "payer",
|
|
1485
|
-
writable: true,
|
|
1486
|
-
signer: true
|
|
1487
|
-
},
|
|
1488
|
-
{
|
|
1489
|
-
name: "user",
|
|
1490
|
-
signer: true
|
|
1491
|
-
},
|
|
1492
|
-
{
|
|
1493
|
-
name: "controller_authority",
|
|
1494
|
-
relations: [
|
|
1495
|
-
"asset_access_controller"
|
|
1496
|
-
]
|
|
1497
|
-
},
|
|
1498
|
-
{
|
|
1499
|
-
name: "asset_access_controller",
|
|
1500
|
-
relations: [
|
|
1501
|
-
"authorized_user_role"
|
|
1502
|
-
]
|
|
1503
|
-
},
|
|
1504
|
-
{
|
|
1505
|
-
name: "authorized_user_role",
|
|
1506
|
-
optional: true
|
|
1507
|
-
},
|
|
1508
|
-
{
|
|
1509
|
-
name: "identity_registry_program",
|
|
1510
|
-
address: "GZsnjqT3c5zbHqsctrJ4EG4rbEfo7ZXyyUG7aDJNmxfA"
|
|
1511
|
-
},
|
|
1512
|
-
{
|
|
1513
|
-
name: "identity_registry"
|
|
1514
|
-
},
|
|
1515
|
-
{
|
|
1516
|
-
name: "identity_account",
|
|
1517
|
-
writable: true
|
|
1518
|
-
}
|
|
1519
|
-
],
|
|
1520
|
-
args: [
|
|
1521
|
-
{
|
|
1522
|
-
name: "cpi_data",
|
|
1523
|
-
type: "bytes"
|
|
1524
|
-
}
|
|
1525
|
-
]
|
|
1526
|
-
},
|
|
1527
1384
|
{
|
|
1528
1385
|
name: "register_investor",
|
|
1529
1386
|
discriminator: [
|
|
@@ -1749,90 +1606,6 @@ var instructions$1 = [
|
|
|
1749
1606
|
args: [
|
|
1750
1607
|
]
|
|
1751
1608
|
},
|
|
1752
|
-
{
|
|
1753
|
-
name: "remove_level_from_identity_account",
|
|
1754
|
-
discriminator: [
|
|
1755
|
-
194,
|
|
1756
|
-
231,
|
|
1757
|
-
187,
|
|
1758
|
-
54,
|
|
1759
|
-
197,
|
|
1760
|
-
136,
|
|
1761
|
-
170,
|
|
1762
|
-
55
|
|
1763
|
-
],
|
|
1764
|
-
accounts: [
|
|
1765
|
-
{
|
|
1766
|
-
name: "payer",
|
|
1767
|
-
writable: true,
|
|
1768
|
-
signer: true
|
|
1769
|
-
},
|
|
1770
|
-
{
|
|
1771
|
-
name: "user",
|
|
1772
|
-
signer: true
|
|
1773
|
-
},
|
|
1774
|
-
{
|
|
1775
|
-
name: "controller_authority",
|
|
1776
|
-
relations: [
|
|
1777
|
-
"asset_access_controller"
|
|
1778
|
-
]
|
|
1779
|
-
},
|
|
1780
|
-
{
|
|
1781
|
-
name: "asset_access_controller",
|
|
1782
|
-
relations: [
|
|
1783
|
-
"authorized_user_role"
|
|
1784
|
-
]
|
|
1785
|
-
},
|
|
1786
|
-
{
|
|
1787
|
-
name: "authorized_user_role",
|
|
1788
|
-
optional: true
|
|
1789
|
-
},
|
|
1790
|
-
{
|
|
1791
|
-
name: "identity_registry_program",
|
|
1792
|
-
address: "GZsnjqT3c5zbHqsctrJ4EG4rbEfo7ZXyyUG7aDJNmxfA"
|
|
1793
|
-
},
|
|
1794
|
-
{
|
|
1795
|
-
name: "identity_registry"
|
|
1796
|
-
},
|
|
1797
|
-
{
|
|
1798
|
-
name: "identity_account",
|
|
1799
|
-
writable: true
|
|
1800
|
-
},
|
|
1801
|
-
{
|
|
1802
|
-
name: "identity_account_owner",
|
|
1803
|
-
docs: [
|
|
1804
|
-
"to ensure that it is not an Investor account. If it is an Investor account,",
|
|
1805
|
-
"CPI to IdentityMetadataRegistry should be called."
|
|
1806
|
-
]
|
|
1807
|
-
},
|
|
1808
|
-
{
|
|
1809
|
-
name: "system_program",
|
|
1810
|
-
address: "11111111111111111111111111111111"
|
|
1811
|
-
},
|
|
1812
|
-
{
|
|
1813
|
-
name: "policy_engine_program"
|
|
1814
|
-
},
|
|
1815
|
-
{
|
|
1816
|
-
name: "policy_engine",
|
|
1817
|
-
writable: true
|
|
1818
|
-
},
|
|
1819
|
-
{
|
|
1820
|
-
name: "tracker_account"
|
|
1821
|
-
},
|
|
1822
|
-
{
|
|
1823
|
-
name: "asset_mint"
|
|
1824
|
-
},
|
|
1825
|
-
{
|
|
1826
|
-
name: "event_authority"
|
|
1827
|
-
}
|
|
1828
|
-
],
|
|
1829
|
-
args: [
|
|
1830
|
-
{
|
|
1831
|
-
name: "cpi_data",
|
|
1832
|
-
type: "bytes"
|
|
1833
|
-
}
|
|
1834
|
-
]
|
|
1835
|
-
},
|
|
1836
1609
|
{
|
|
1837
1610
|
name: "remove_levels",
|
|
1838
1611
|
discriminator: [
|
|
@@ -3929,16 +3702,6 @@ class AssetController {
|
|
|
3929
3702
|
.instruction();
|
|
3930
3703
|
});
|
|
3931
3704
|
}
|
|
3932
|
-
/**
|
|
3933
|
-
* Asynchronously generates instructions to revoke assets.
|
|
3934
|
-
* @param args - {@link VoidTokensArgs}
|
|
3935
|
-
* @returns A Promise that resolves to the instructions to revoke assets.
|
|
3936
|
-
*/
|
|
3937
|
-
voidTokenIxns(args) {
|
|
3938
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3939
|
-
return this.rwaClient.assetController.voidTokenIxns(args);
|
|
3940
|
-
});
|
|
3941
|
-
}
|
|
3942
3705
|
/**
|
|
3943
3706
|
* Executes a token transfer.
|
|
3944
3707
|
* @param args - {@link TransferTokensArgs}
|
|
@@ -4009,13 +3772,13 @@ class AssetController {
|
|
|
4009
3772
|
/**
|
|
4010
3773
|
* Asynchronously generates instructions to revoke tokens from a user.
|
|
4011
3774
|
* @param args - {@link RevokeTokensArgs}
|
|
4012
|
-
* @param payer - Payer public key.
|
|
4013
3775
|
* @param signer - User signer public key.
|
|
4014
3776
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
3777
|
+
* @param investorId - Optional investorId. Required if user is not an investor.
|
|
4015
3778
|
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
4016
3779
|
* @returns A Promise that resolves to the instructions to revoke.
|
|
4017
3780
|
*/
|
|
4018
|
-
revokeTokenIxn(args,
|
|
3781
|
+
revokeTokenIxn(args, signer, assetAccessController, investorId, authorizedUserRole) {
|
|
4019
3782
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4020
3783
|
if (!args.wallet) {
|
|
4021
3784
|
throw new Error("Use wallet arg for wallet to revoke tokens from.");
|
|
@@ -4024,7 +3787,7 @@ class AssetController {
|
|
|
4024
3787
|
args.owner = args.wallet;
|
|
4025
3788
|
const revokeIx = yield getRevokeTokensIx(args, this.rwaClient.provider);
|
|
4026
3789
|
const identityRegistry = getIdentityRegistryPda(args.assetMint);
|
|
4027
|
-
const investorPda = deriveInvestorPda(investorId, identityRegistry);
|
|
3790
|
+
const investorPda = investorId ? deriveInvestorPda(investorId, identityRegistry) : null;
|
|
4028
3791
|
const ixData = revokeIx.data;
|
|
4029
3792
|
const assetController = getAssetControllerPda(args.assetMint);
|
|
4030
3793
|
const revokeTokenAccount = getAssociatedTokenAddressSync(new PublicKey(args.assetMint), new PublicKey(args.wallet), false, TOKEN_2022_PROGRAM_ID);
|
|
@@ -4040,8 +3803,8 @@ class AssetController {
|
|
|
4040
3803
|
assetController,
|
|
4041
3804
|
revokeTokenAccount,
|
|
4042
3805
|
identityRegistry,
|
|
4043
|
-
identityAccount: getIdentityAccountPda(args.assetMint, investorPda.toString()),
|
|
4044
|
-
trackerAccount: getTrackerAccountPda(args.assetMint, investorPda.toString()),
|
|
3806
|
+
identityAccount: getIdentityAccountPda(args.assetMint, investorId ? investorPda.toString() : args.owner),
|
|
3807
|
+
trackerAccount: getTrackerAccountPda(args.assetMint, investorId ? investorPda.toString() : args.owner),
|
|
4045
3808
|
policyEngineProgram: policyEngineProgramId,
|
|
4046
3809
|
policyEngine: getPolicyEnginePda(args.assetMint),
|
|
4047
3810
|
walletIdentityAccount: getWalletIdentityAccountPda(args.assetMint, args.wallet),
|
|
@@ -4529,112 +4292,6 @@ class IdentityRegistry {
|
|
|
4529
4292
|
return returnIx;
|
|
4530
4293
|
});
|
|
4531
4294
|
}
|
|
4532
|
-
/**
|
|
4533
|
-
* Asynchronously update a non-investor user identity account level.
|
|
4534
|
-
* @param args - {@link AddLevelToIdentityAccountArgs}
|
|
4535
|
-
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4536
|
-
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
4537
|
-
* @returns A Promise that resolves to the instructions to update user account identity.
|
|
4538
|
-
* */
|
|
4539
|
-
addIdentityLevelToUserAccount(args, assetAccessController, authorizedUserRole) {
|
|
4540
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4541
|
-
var _a;
|
|
4542
|
-
const identityAccount = getIdentityAccountPda(args.assetMint, args.owner);
|
|
4543
|
-
const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
|
|
4544
|
-
return this.rbacProgram.methods
|
|
4545
|
-
.addLevelToIdentityAccount(args.levels[0], args.expiries[0], (_a = args.ignorePolicy) !== null && _a !== void 0 ? _a : false)
|
|
4546
|
-
.accountsStrict({
|
|
4547
|
-
payer: args.payer,
|
|
4548
|
-
user: args.signer,
|
|
4549
|
-
controllerAuthority,
|
|
4550
|
-
assetAccessController,
|
|
4551
|
-
authorizedUserRole: authorizedUserRole || null,
|
|
4552
|
-
identityRegistryProgram: identityRegistryProgramId,
|
|
4553
|
-
identityRegistry: getIdentityRegistryPda(args.assetMint),
|
|
4554
|
-
identityAccount,
|
|
4555
|
-
identityAccountOwner: args.owner,
|
|
4556
|
-
systemProgram: SystemProgram.programId,
|
|
4557
|
-
policyEngineProgram: policyEngineProgramId,
|
|
4558
|
-
policyEngine: getPolicyEnginePda(args.assetMint),
|
|
4559
|
-
trackerAccount: getTrackerAccountPda(args.assetMint, args.owner),
|
|
4560
|
-
assetMint: args.assetMint,
|
|
4561
|
-
eventAuthority: getIdentityRegistryEventAuthority(),
|
|
4562
|
-
})
|
|
4563
|
-
.instruction();
|
|
4564
|
-
});
|
|
4565
|
-
}
|
|
4566
|
-
/**
|
|
4567
|
-
* Asynchronously reduces a non-Investor user identity account level.
|
|
4568
|
-
* @param args - {@link RemoveLevelFromIdentityAccount}
|
|
4569
|
-
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4570
|
-
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
4571
|
-
* @returns A Promise that resolves to the instructions to reduce the level of a user identity account.
|
|
4572
|
-
*/
|
|
4573
|
-
removeIdentityLevelFromUserAccount(args, assetAccessController, authorizedUserRole) {
|
|
4574
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4575
|
-
const removeLevelIx = yield getRemoveLevelFromIdentityAccount(args, this.rwaClient.provider);
|
|
4576
|
-
const ixData = removeLevelIx.data;
|
|
4577
|
-
const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
|
|
4578
|
-
const identityAccount = getIdentityAccountPda(args.assetMint, args.owner);
|
|
4579
|
-
return this.rbacProgram.methods
|
|
4580
|
-
.removeLevelFromIdentityAccount(ixData)
|
|
4581
|
-
.accountsStrict({
|
|
4582
|
-
payer: args.payer,
|
|
4583
|
-
user: args.signer,
|
|
4584
|
-
controllerAuthority,
|
|
4585
|
-
assetAccessController,
|
|
4586
|
-
authorizedUserRole: authorizedUserRole || null,
|
|
4587
|
-
identityRegistryProgram: identityRegistryProgramId,
|
|
4588
|
-
identityRegistry: getIdentityRegistryPda(args.assetMint),
|
|
4589
|
-
identityAccount,
|
|
4590
|
-
identityAccountOwner: args.owner,
|
|
4591
|
-
systemProgram: SystemProgram.programId,
|
|
4592
|
-
policyEngineProgram: policyEngineProgramId,
|
|
4593
|
-
policyEngine: getPolicyEnginePda(args.assetMint),
|
|
4594
|
-
trackerAccount: getTrackerAccountPda(args.assetMint, args.owner),
|
|
4595
|
-
assetMint: args.assetMint,
|
|
4596
|
-
eventAuthority: getIdentityRegistryEventAuthority(),
|
|
4597
|
-
})
|
|
4598
|
-
.instruction();
|
|
4599
|
-
});
|
|
4600
|
-
}
|
|
4601
|
-
/**
|
|
4602
|
-
* Asynchronously generates instruction to refresh expiry on an Identity Account level.
|
|
4603
|
-
* @param args - {@link RefreshLevelArgs}
|
|
4604
|
-
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4605
|
-
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
4606
|
-
* @returns A Promise that resolves to refresh expiry on an Identity Account level.
|
|
4607
|
-
* */
|
|
4608
|
-
refreshLevelToIdentityAccountIxn(args, assetAccessController, authorizedUserRole) {
|
|
4609
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4610
|
-
const identityProgram = getIdentityRegistryProgram(this.rwaClient.provider);
|
|
4611
|
-
const identityRegistry = getIdentityRegistryPda(args.assetMint);
|
|
4612
|
-
const identityAccount = getIdentityAccountPda(args.assetMint, args.owner);
|
|
4613
|
-
const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
|
|
4614
|
-
const refreshIx = yield identityProgram.methods
|
|
4615
|
-
.refreshLevelToIdentityAccount(args.level, args.expiry)
|
|
4616
|
-
.accountsStrict({
|
|
4617
|
-
payer: args.payer,
|
|
4618
|
-
signer: controllerAuthority,
|
|
4619
|
-
identityRegistry,
|
|
4620
|
-
identityAccount,
|
|
4621
|
-
})
|
|
4622
|
-
.instruction();
|
|
4623
|
-
return this.rbacProgram.methods
|
|
4624
|
-
.refreshLevelToIdentityAccount(refreshIx.data)
|
|
4625
|
-
.accountsStrict({
|
|
4626
|
-
payer: args.payer,
|
|
4627
|
-
user: args.signer,
|
|
4628
|
-
controllerAuthority,
|
|
4629
|
-
assetAccessController,
|
|
4630
|
-
authorizedUserRole: authorizedUserRole || null,
|
|
4631
|
-
identityRegistryProgram: identityRegistryProgramId,
|
|
4632
|
-
identityRegistry,
|
|
4633
|
-
identityAccount,
|
|
4634
|
-
})
|
|
4635
|
-
.instruction();
|
|
4636
|
-
});
|
|
4637
|
-
}
|
|
4638
4295
|
/**
|
|
4639
4296
|
* Asynchronously generates instruction to attach wallet to identity.
|
|
4640
4297
|
* @param args - {@link AttachDetachWalletArgs}
|
|
@@ -4697,6 +4354,7 @@ class IdentityRegistry {
|
|
|
4697
4354
|
const identityRegistry = getIdentityRegistryPda(args.assetMint);
|
|
4698
4355
|
const identityAccount = getIdentityAccountPda(args.assetMint, args.owner);
|
|
4699
4356
|
const walletIdentity = getWalletIdentityAccountPda(args.assetMint, args.wallet.toString());
|
|
4357
|
+
const tokenAccount = getAssociatedTokenAddressSync(new PublicKey(args.assetMint), new PublicKey(args.wallet), false, TOKEN_2022_PROGRAM_ID);
|
|
4700
4358
|
const ix = yield identityProgram.methods
|
|
4701
4359
|
.detachWalletFromIdentity()
|
|
4702
4360
|
.accountsStrict({
|
|
@@ -4707,6 +4365,8 @@ class IdentityRegistry {
|
|
|
4707
4365
|
identityRegistry,
|
|
4708
4366
|
eventAuthority: getIdentityRegistryEventAuthority(),
|
|
4709
4367
|
program: identityRegistryProgramId,
|
|
4368
|
+
tokenAccount: tokenAccount,
|
|
4369
|
+
assetMint: args.assetMint,
|
|
4710
4370
|
})
|
|
4711
4371
|
.instruction();
|
|
4712
4372
|
return this.rbacProgram.methods
|
|
@@ -4722,6 +4382,8 @@ class IdentityRegistry {
|
|
|
4722
4382
|
identityAccount,
|
|
4723
4383
|
identityRegistry,
|
|
4724
4384
|
eventAuthority: getIdentityRegistryEventAuthority(),
|
|
4385
|
+
tokenAccount: tokenAccount,
|
|
4386
|
+
assetMint: args.assetMint,
|
|
4725
4387
|
})
|
|
4726
4388
|
.instruction();
|
|
4727
4389
|
});
|