@dstoken-solana/rwa-rbac 0.0.1-rc0
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 +98 -0
- package/dist/client/AssetController.d.ts.map +1 -0
- package/dist/client/AssetController.js +535 -0
- package/dist/client/AssetController.js.map +1 -0
- package/dist/client/IdentityMetadataRegistry.d.ts +64 -0
- package/dist/client/IdentityMetadataRegistry.d.ts.map +1 -0
- package/dist/client/IdentityMetadataRegistry.js +399 -0
- package/dist/client/IdentityMetadataRegistry.js.map +1 -0
- package/dist/client/IdentityRegistry.d.ts +65 -0
- package/dist/client/IdentityRegistry.d.ts.map +1 -0
- package/dist/client/IdentityRegistry.js +328 -0
- package/dist/client/IdentityRegistry.js.map +1 -0
- package/dist/client/PolicyEngine.d.ts +74 -0
- package/dist/client/PolicyEngine.d.ts.map +1 -0
- package/dist/client/PolicyEngine.js +286 -0
- package/dist/client/PolicyEngine.js.map +1 -0
- package/dist/client/RwaRbacClient.d.ts +70 -0
- package/dist/client/RwaRbacClient.d.ts.map +1 -0
- package/dist/client/RwaRbacClient.js +269 -0
- package/dist/client/RwaRbacClient.js.map +1 -0
- package/dist/client/TokenLocks.d.ts +55 -0
- package/dist/client/TokenLocks.d.ts.map +1 -0
- package/dist/client/TokenLocks.js +320 -0
- package/dist/client/TokenLocks.js.map +1 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +23 -0
- package/dist/client/index.js.map +1 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/pdas.d.ts +9 -0
- package/dist/pdas.d.ts.map +1 -0
- package/dist/pdas.js +52 -0
- package/dist/pdas.js.map +1 -0
- package/dist/types/flags.d.ts +43 -0
- package/dist/types/flags.d.ts.map +1 -0
- package/dist/types/flags.js +48 -0
- package/dist/types/flags.js.map +1 -0
- package/dist/types/generated/index.d.ts +8 -0
- package/dist/types/generated/index.d.ts.map +1 -0
- package/dist/types/generated/index.js +13 -0
- package/dist/types/generated/index.js.map +1 -0
- package/dist/types/generated/rwa_imr.d.ts +592 -0
- package/dist/types/generated/rwa_imr.d.ts.map +1 -0
- package/dist/types/generated/rwa_imr.js +3 -0
- package/dist/types/generated/rwa_imr.js.map +1 -0
- package/dist/types/generated/rwa_imr.json +585 -0
- package/dist/types/generated/rwa_rbac.d.ts +2671 -0
- package/dist/types/generated/rwa_rbac.d.ts.map +1 -0
- package/dist/types/generated/rwa_rbac.js +3 -0
- package/dist/types/generated/rwa_rbac.js.map +1 -0
- package/dist/types/generated/rwa_rbac.json +2664 -0
- package/dist/types/generated/token_locks.d.ts +649 -0
- package/dist/types/generated/token_locks.d.ts.map +1 -0
- package/dist/types/generated/token_locks.js +3 -0
- package/dist/types/generated/token_locks.js.map +1 -0
- package/dist/types/generated/token_locks.json +642 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +20 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/instructions.d.ts +213 -0
- package/dist/types/instructions.d.ts.map +1 -0
- package/dist/types/instructions.js +3 -0
- package/dist/types/instructions.js.map +1 -0
- package/dist/utils.d.ts +7 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +16 -0
- package/dist/utils.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Program } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
3
|
+
import { IssueTokensWithLockArgs, UpdateInterestBearingMintRateArgs } from "../types/instructions";
|
|
4
|
+
import { RwaRbac } from "../types/generated/rwa_rbac";
|
|
5
|
+
import { CloseMintArgs, CreateAssetControllerIx, FreezeTokenArgs, RevokeTokensArgs, RwaClient, SeizeTokensArgs, TransferTokensArgs, UpdateAssetMetadataArgs, VoidTokensArgs } from "@dstoken-solana/rwa-token-sdk";
|
|
6
|
+
/**
|
|
7
|
+
* Represents the role-based access client for Asset Controller for an RWA.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AssetController {
|
|
10
|
+
rwaClient: RwaClient;
|
|
11
|
+
rbacProgram: Program<RwaRbac>;
|
|
12
|
+
constructor(rwaClient: RwaClient, rbacProgram: Program<RwaRbac>);
|
|
13
|
+
/**
|
|
14
|
+
* Asynchronously generates instructions to setup a new asset controller.
|
|
15
|
+
* @param args - {@link CreateAssetControllerIx}
|
|
16
|
+
* @returns A Promise that resolves to the instructions to create an asset controller.
|
|
17
|
+
*/
|
|
18
|
+
setupNewRegistry(args: CreateAssetControllerIx): Promise<TransactionInstruction>;
|
|
19
|
+
/**
|
|
20
|
+
* Update the asset controller's metadata.
|
|
21
|
+
* @param args - {@link UpdateAssetMetadataArgs}
|
|
22
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
23
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
24
|
+
* @returns A Promise that resolves to the instructions to update the asset controller's metadata.
|
|
25
|
+
* */
|
|
26
|
+
updateAssetMetadata(args: UpdateAssetMetadataArgs, assetAccessController: PublicKey, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
27
|
+
/**
|
|
28
|
+
* Asynchronously generates instructions to issue tokens and lock tokens according to issuance policy.
|
|
29
|
+
* @param args - {@link IssueTokensWithLockArgs}
|
|
30
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
31
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
32
|
+
*/
|
|
33
|
+
issueTokenIxns(args: IssueTokensWithLockArgs, 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
|
+
/**
|
|
41
|
+
* Executes a token transfer.
|
|
42
|
+
* @param args - {@link TransferTokensArgs}
|
|
43
|
+
* @returns A promise that resolves to transaction instruction.
|
|
44
|
+
*/
|
|
45
|
+
transfer(args: TransferTokensArgs): Promise<TransactionInstruction[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Asynchronously generates instruction to freeze a token account.
|
|
48
|
+
* @param args - {@link FreezeTokenArgs}
|
|
49
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
50
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
51
|
+
* @returns A Promise that resolves to the instruction to freeze.
|
|
52
|
+
*/
|
|
53
|
+
freezeTokenIxn(args: FreezeTokenArgs, assetAccessController: PublicKey, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
54
|
+
/**
|
|
55
|
+
* Asynchronously generates instruction to thaw a token account.
|
|
56
|
+
* @param args - {@link FreezeTokenArgs}
|
|
57
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
58
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
59
|
+
* @returns A Promise that resolves to the instruction to thaw.
|
|
60
|
+
*/
|
|
61
|
+
thawTokenIxn(args: FreezeTokenArgs, assetAccessController: PublicKey, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
62
|
+
/**
|
|
63
|
+
* Asynchronously generates instructions to revoke tokens from a user.
|
|
64
|
+
* @param args - {@link RevokeTokensArgs}
|
|
65
|
+
* @param payer - Payer public key.
|
|
66
|
+
* @param signer - User signer public key.
|
|
67
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
68
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
69
|
+
* @returns A Promise that resolves to the instructions to revoke.
|
|
70
|
+
*/
|
|
71
|
+
revokeTokenIxn(args: RevokeTokensArgs, investorId: string, signer: PublicKey, assetAccessController: PublicKey, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
72
|
+
/**
|
|
73
|
+
* Asynchronously generates instruction to close mint.
|
|
74
|
+
* @param args - {@link CloseMintArgs}
|
|
75
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
76
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
77
|
+
* @returns A Promise that resolves to the instruction to close mint.
|
|
78
|
+
*/
|
|
79
|
+
closeMintIxn(args: CloseMintArgs, assetAccessController: PublicKey, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
80
|
+
/**
|
|
81
|
+
* Asynchronously generates instruction to update mint interest rate.
|
|
82
|
+
* @param args - {@link UpdateInterestBearingMintRateArgs}
|
|
83
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
84
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
85
|
+
* @returns A Promise that resolves to the instruction to update mint interest rate.
|
|
86
|
+
*/
|
|
87
|
+
updateInterestBearingMintRateIxn(args: UpdateInterestBearingMintRateArgs, assetAccessController: PublicKey, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
88
|
+
/**
|
|
89
|
+
* Asynchronously generates instruction to seize tokens.
|
|
90
|
+
* @param args - {@link SeizeTokensArgs}
|
|
91
|
+
* @param signer - User signer public key.
|
|
92
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
93
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
94
|
+
* @returns A Promise that resolves to the instruction to seize.
|
|
95
|
+
*/
|
|
96
|
+
seizeTokensIxn(args: SeizeTokensArgs, investorId: string, signer: PublicKey, assetAccessController: PublicKey, authorizedUserRole?: PublicKey): Promise<TransactionInstruction>;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=AssetController.d.ts.map
|
|
@@ -0,0 +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,uBAAuB,EACvB,iCAAiC,EAClC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAEL,aAAa,EACb,uBAAuB,EACvB,eAAe,EAkBf,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACf,MAAM,+BAA+B,CAAC;AASvC;;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,CAClB,IAAI,EAAE,uBAAuB,EAC7B,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,EAAE,CAAC;IA0IpC;;;;OAIG;IACG,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAI1E;;;;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,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,SAAS,EACjB,qBAAqB,EAAE,SAAS,EAChC,kBAAkB,CAAC,EAAE,SAAS,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAoDlC;;;;;;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;CAuFnC"}
|
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.AssetController = void 0;
|
|
51
|
+
var web3_js_1 = require("@solana/web3.js");
|
|
52
|
+
var spl_token_1 = require("@solana/spl-token");
|
|
53
|
+
var rwa_token_sdk_1 = require("@dstoken-solana/rwa-token-sdk");
|
|
54
|
+
var constants_1 = require("../constants");
|
|
55
|
+
var pdas_1 = require("../pdas");
|
|
56
|
+
/**
|
|
57
|
+
* Represents the role-based access client for Asset Controller for an RWA.
|
|
58
|
+
*/
|
|
59
|
+
var AssetController = /** @class */ (function () {
|
|
60
|
+
function AssetController(rwaClient, rbacProgram) {
|
|
61
|
+
this.rwaClient = rwaClient;
|
|
62
|
+
this.rbacProgram = rbacProgram;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Asynchronously generates instructions to setup a new asset controller.
|
|
66
|
+
* @param args - {@link CreateAssetControllerIx}
|
|
67
|
+
* @returns A Promise that resolves to the instructions to create an asset controller.
|
|
68
|
+
*/
|
|
69
|
+
AssetController.prototype.setupNewRegistry = function (args) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
return [2 /*return*/, (0, rwa_token_sdk_1.getCreateAssetControllerIx)(args, this.rwaClient.provider)];
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Update the asset controller's metadata.
|
|
78
|
+
* @param args - {@link UpdateAssetMetadataArgs}
|
|
79
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
80
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
81
|
+
* @returns A Promise that resolves to the instructions to update the asset controller's metadata.
|
|
82
|
+
* */
|
|
83
|
+
AssetController.prototype.updateAssetMetadata = function (args, assetAccessController, authorizedUserRole) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
85
|
+
var updateIx, ixData;
|
|
86
|
+
return __generator(this, function (_a) {
|
|
87
|
+
switch (_a.label) {
|
|
88
|
+
case 0: return [4 /*yield*/, this.rwaClient.assetController.updateAssetMetadata(args)];
|
|
89
|
+
case 1:
|
|
90
|
+
updateIx = _a.sent();
|
|
91
|
+
ixData = updateIx.data;
|
|
92
|
+
return [2 /*return*/, this.rbacProgram.methods
|
|
93
|
+
.updateAssetMetadata(ixData)
|
|
94
|
+
.accountsStrict({
|
|
95
|
+
payer: args.payer,
|
|
96
|
+
user: args.signer,
|
|
97
|
+
controllerAuthority: args.authority,
|
|
98
|
+
assetAccessController: assetAccessController,
|
|
99
|
+
authorizedUserRole: authorizedUserRole || null,
|
|
100
|
+
assetMint: args.assetMint,
|
|
101
|
+
assetController: (0, rwa_token_sdk_1.getAssetControllerPda)(args.assetMint),
|
|
102
|
+
assetControllerProgram: rwa_token_sdk_1.assetControllerProgramId,
|
|
103
|
+
tokenProgram: spl_token_1.TOKEN_2022_PROGRAM_ID,
|
|
104
|
+
eventAuthority: (0, rwa_token_sdk_1.getAssetControllerEventAuthority)(),
|
|
105
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
106
|
+
})
|
|
107
|
+
.instruction()];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Asynchronously generates instructions to issue tokens and lock tokens according to issuance policy.
|
|
114
|
+
* @param args - {@link IssueTokensWithLockArgs}
|
|
115
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
116
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
117
|
+
*/
|
|
118
|
+
AssetController.prototype.issueTokenIxns = function (args, assetAccessController, authorizedUserRole) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
120
|
+
var identityRegistry, investorPda, unlockedTokenAccount, trackerAccount, controllerAuthority, ixs, tokenAccountData, createAtaIx, _a, _b;
|
|
121
|
+
return __generator(this, function (_c) {
|
|
122
|
+
switch (_c.label) {
|
|
123
|
+
case 0:
|
|
124
|
+
identityRegistry = (0, rwa_token_sdk_1.getIdentityRegistryPda)(args.assetMint);
|
|
125
|
+
investorPda = (0, pdas_1.deriveInvestorPda)(args.investorId, identityRegistry);
|
|
126
|
+
unlockedTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(new web3_js_1.PublicKey(args.assetMint), new web3_js_1.PublicKey(args.wallet), false, spl_token_1.TOKEN_2022_PROGRAM_ID);
|
|
127
|
+
trackerAccount = (0, rwa_token_sdk_1.getTrackerAccountPda)(args.assetMint, investorPda.toString());
|
|
128
|
+
controllerAuthority = (0, pdas_1.deriveControllerAuthorityPda)(assetAccessController);
|
|
129
|
+
ixs = [];
|
|
130
|
+
return [4 /*yield*/, this.rbacProgram.provider.connection.getAccountInfo(unlockedTokenAccount)];
|
|
131
|
+
case 1:
|
|
132
|
+
tokenAccountData = _c.sent();
|
|
133
|
+
if (!tokenAccountData) {
|
|
134
|
+
createAtaIx = (0, spl_token_1.createAssociatedTokenAccountInstruction)(new web3_js_1.PublicKey(args.payer), unlockedTokenAccount, new web3_js_1.PublicKey(args.wallet), new web3_js_1.PublicKey(args.assetMint), spl_token_1.TOKEN_2022_PROGRAM_ID);
|
|
135
|
+
ixs.push(createAtaIx);
|
|
136
|
+
}
|
|
137
|
+
_b = (_a = ixs).push;
|
|
138
|
+
return [4 /*yield*/, this.rbacProgram.methods
|
|
139
|
+
.issueTokens(args.amount, args.issuanceTimestamp, args.reasonCode == undefined ? null : args.reasonCode, args.reasonString == undefined ? null : args.reasonString)
|
|
140
|
+
.accountsStrict({
|
|
141
|
+
payer: args.payer,
|
|
142
|
+
user: args.signer,
|
|
143
|
+
controllerAuthority: controllerAuthority,
|
|
144
|
+
assetAccessController: assetAccessController,
|
|
145
|
+
authorizedUserRole: authorizedUserRole || null,
|
|
146
|
+
assetControllerProgram: rwa_token_sdk_1.assetControllerProgramId,
|
|
147
|
+
assetMint: args.assetMint,
|
|
148
|
+
assetController: (0, rwa_token_sdk_1.getAssetControllerPda)(args.assetMint),
|
|
149
|
+
to: args.wallet,
|
|
150
|
+
tokenAccount: unlockedTokenAccount,
|
|
151
|
+
policyEngine: (0, rwa_token_sdk_1.getPolicyEnginePda)(args.assetMint),
|
|
152
|
+
policyEngineProgram: rwa_token_sdk_1.policyEngineProgramId,
|
|
153
|
+
identityAccount: (0, rwa_token_sdk_1.getIdentityAccountPda)(args.assetMint, investorPda.toString()),
|
|
154
|
+
trackerAccount: trackerAccount,
|
|
155
|
+
identityRegistry: identityRegistry,
|
|
156
|
+
tokenProgram: spl_token_1.TOKEN_2022_PROGRAM_ID,
|
|
157
|
+
associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
158
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
159
|
+
walletIdentityAccount: (0, rwa_token_sdk_1.getWalletIdentityAccountPda)(args.assetMint, args.wallet),
|
|
160
|
+
tokenLocksProgram: constants_1.TL_PROGRAM,
|
|
161
|
+
investorLocks: (0, pdas_1.deriveInvestorLocks)(args.investorId, identityRegistry),
|
|
162
|
+
investor: investorPda,
|
|
163
|
+
lockedTokenAccount: (0, pdas_1.deriveLockedTokenAccount)(args.investorId, identityRegistry),
|
|
164
|
+
})
|
|
165
|
+
.remainingAccounts([
|
|
166
|
+
{
|
|
167
|
+
pubkey: (0, rwa_token_sdk_1.getPolicyEnginePda)(args.assetMint),
|
|
168
|
+
isWritable: true,
|
|
169
|
+
isSigner: false,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
pubkey: rwa_token_sdk_1.identityRegistryProgramId,
|
|
173
|
+
isWritable: false,
|
|
174
|
+
isSigner: false,
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
pubkey: rwa_token_sdk_1.policyEngineProgramId,
|
|
178
|
+
isWritable: false,
|
|
179
|
+
isSigner: false,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
pubkey: identityRegistry,
|
|
183
|
+
isWritable: false,
|
|
184
|
+
isSigner: false,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
pubkey: (0, rwa_token_sdk_1.getIdentityAccountPda)(args.assetMint, investorPda.toString()),
|
|
188
|
+
isWritable: false,
|
|
189
|
+
isSigner: false,
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
pubkey: (0, rwa_token_sdk_1.getIdentityAccountPda)(args.assetMint, args.wallet.toString()),
|
|
193
|
+
isWritable: false,
|
|
194
|
+
isSigner: false,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
pubkey: trackerAccount,
|
|
198
|
+
isWritable: true,
|
|
199
|
+
isSigner: false,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
pubkey: (0, rwa_token_sdk_1.getExtraMetasListPda)(args.assetMint),
|
|
203
|
+
isWritable: false,
|
|
204
|
+
isSigner: false,
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
pubkey: (0, rwa_token_sdk_1.getWalletIdentityAccountPda)(args.assetMint, investorPda.toString()),
|
|
208
|
+
isWritable: false,
|
|
209
|
+
isSigner: false,
|
|
210
|
+
},
|
|
211
|
+
])
|
|
212
|
+
.instruction()];
|
|
213
|
+
case 2:
|
|
214
|
+
_b.apply(_a, [_c.sent()]);
|
|
215
|
+
return [2 /*return*/, ixs];
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Asynchronously generates instructions to revoke assets.
|
|
222
|
+
* @param args - {@link VoidTokensArgs}
|
|
223
|
+
* @returns A Promise that resolves to the instructions to revoke assets.
|
|
224
|
+
*/
|
|
225
|
+
AssetController.prototype.voidTokenIxns = function (args) {
|
|
226
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
227
|
+
return __generator(this, function (_a) {
|
|
228
|
+
return [2 /*return*/, this.rwaClient.assetController.voidTokenIxns(args)];
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Executes a token transfer.
|
|
234
|
+
* @param args - {@link TransferTokensArgs}
|
|
235
|
+
* @returns A promise that resolves to transaction instruction.
|
|
236
|
+
*/
|
|
237
|
+
AssetController.prototype.transfer = function (args) {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
239
|
+
return __generator(this, function (_a) {
|
|
240
|
+
return [2 /*return*/, this.rwaClient.assetController.transfer(args)];
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Asynchronously generates instruction to freeze a token account.
|
|
246
|
+
* @param args - {@link FreezeTokenArgs}
|
|
247
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
248
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
249
|
+
* @returns A Promise that resolves to the instruction to freeze.
|
|
250
|
+
*/
|
|
251
|
+
AssetController.prototype.freezeTokenIxn = function (args, assetAccessController, authorizedUserRole) {
|
|
252
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
253
|
+
var freezeIx, ixData, tokenAccount;
|
|
254
|
+
return __generator(this, function (_a) {
|
|
255
|
+
switch (_a.label) {
|
|
256
|
+
case 0: return [4 /*yield*/, (0, rwa_token_sdk_1.getFreezeTokenIx)(args, this.rwaClient.provider)];
|
|
257
|
+
case 1:
|
|
258
|
+
freezeIx = _a.sent();
|
|
259
|
+
ixData = freezeIx.data;
|
|
260
|
+
tokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(new web3_js_1.PublicKey(args.assetMint), new web3_js_1.PublicKey(args.owner), false, spl_token_1.TOKEN_2022_PROGRAM_ID);
|
|
261
|
+
return [2 /*return*/, this.rbacProgram.methods
|
|
262
|
+
.freezeTokenAccount(ixData)
|
|
263
|
+
.accountsStrict({
|
|
264
|
+
user: args.signer,
|
|
265
|
+
controllerAuthority: args.authority,
|
|
266
|
+
assetAccessController: assetAccessController,
|
|
267
|
+
authorizedUserRole: authorizedUserRole || null,
|
|
268
|
+
assetControllerProgram: rwa_token_sdk_1.assetControllerProgramId,
|
|
269
|
+
assetMint: args.assetMint,
|
|
270
|
+
assetController: (0, rwa_token_sdk_1.getAssetControllerPda)(args.assetMint),
|
|
271
|
+
tokenAccount: tokenAccount,
|
|
272
|
+
tokenProgram: spl_token_1.TOKEN_2022_PROGRAM_ID,
|
|
273
|
+
})
|
|
274
|
+
.instruction()];
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Asynchronously generates instruction to thaw a token account.
|
|
281
|
+
* @param args - {@link FreezeTokenArgs}
|
|
282
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
283
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
284
|
+
* @returns A Promise that resolves to the instruction to thaw.
|
|
285
|
+
*/
|
|
286
|
+
AssetController.prototype.thawTokenIxn = function (args, assetAccessController, authorizedUserRole) {
|
|
287
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
288
|
+
var thawIx, ixData, tokenAccount;
|
|
289
|
+
return __generator(this, function (_a) {
|
|
290
|
+
switch (_a.label) {
|
|
291
|
+
case 0: return [4 /*yield*/, (0, rwa_token_sdk_1.getThawTokenIx)(args, this.rwaClient.provider)];
|
|
292
|
+
case 1:
|
|
293
|
+
thawIx = _a.sent();
|
|
294
|
+
ixData = thawIx.data;
|
|
295
|
+
tokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(new web3_js_1.PublicKey(args.assetMint), new web3_js_1.PublicKey(args.owner), false, spl_token_1.TOKEN_2022_PROGRAM_ID);
|
|
296
|
+
return [2 /*return*/, this.rbacProgram.methods
|
|
297
|
+
.thawTokenAccount(ixData)
|
|
298
|
+
.accountsStrict({
|
|
299
|
+
user: args.signer,
|
|
300
|
+
controllerAuthority: args.authority,
|
|
301
|
+
assetAccessController: assetAccessController,
|
|
302
|
+
authorizedUserRole: authorizedUserRole || null,
|
|
303
|
+
assetControllerProgram: rwa_token_sdk_1.assetControllerProgramId,
|
|
304
|
+
assetMint: args.assetMint,
|
|
305
|
+
assetController: (0, rwa_token_sdk_1.getAssetControllerPda)(args.assetMint),
|
|
306
|
+
identityRegistryAccount: (0, rwa_token_sdk_1.getIdentityRegistryPda)(args.assetMint),
|
|
307
|
+
tokenAccount: tokenAccount,
|
|
308
|
+
tokenProgram: spl_token_1.TOKEN_2022_PROGRAM_ID,
|
|
309
|
+
})
|
|
310
|
+
.instruction()];
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Asynchronously generates instructions to revoke tokens from a user.
|
|
317
|
+
* @param args - {@link RevokeTokensArgs}
|
|
318
|
+
* @param payer - Payer public key.
|
|
319
|
+
* @param signer - User signer public key.
|
|
320
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
321
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
322
|
+
* @returns A Promise that resolves to the instructions to revoke.
|
|
323
|
+
*/
|
|
324
|
+
AssetController.prototype.revokeTokenIxn = function (args, investorId, signer, assetAccessController, authorizedUserRole) {
|
|
325
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
326
|
+
var revokeIx, identityRegistry, investorPda, ixData, assetController, revokeTokenAccount;
|
|
327
|
+
return __generator(this, function (_a) {
|
|
328
|
+
switch (_a.label) {
|
|
329
|
+
case 0:
|
|
330
|
+
if (!args.wallet) {
|
|
331
|
+
throw new Error("Use wallet arg for wallet to revoke tokens from.");
|
|
332
|
+
}
|
|
333
|
+
// Set owner (even though it is InvestorPda) as wallet to generate ix data.
|
|
334
|
+
args.owner = args.wallet;
|
|
335
|
+
return [4 /*yield*/, (0, rwa_token_sdk_1.getRevokeTokensIx)(args, this.rwaClient.provider)];
|
|
336
|
+
case 1:
|
|
337
|
+
revokeIx = _a.sent();
|
|
338
|
+
identityRegistry = (0, rwa_token_sdk_1.getIdentityRegistryPda)(args.assetMint);
|
|
339
|
+
investorPda = (0, pdas_1.deriveInvestorPda)(investorId, identityRegistry);
|
|
340
|
+
ixData = revokeIx.data;
|
|
341
|
+
assetController = (0, rwa_token_sdk_1.getAssetControllerPda)(args.assetMint);
|
|
342
|
+
revokeTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(new web3_js_1.PublicKey(args.assetMint), new web3_js_1.PublicKey(args.wallet), false, spl_token_1.TOKEN_2022_PROGRAM_ID);
|
|
343
|
+
return [4 /*yield*/, this.rbacProgram.methods
|
|
344
|
+
.revokeTokens(ixData)
|
|
345
|
+
.accountsStrict({
|
|
346
|
+
user: signer,
|
|
347
|
+
controllerAuthority: args.authority,
|
|
348
|
+
assetAccessController: assetAccessController,
|
|
349
|
+
authorizedUserRole: authorizedUserRole || null,
|
|
350
|
+
assetControllerProgram: rwa_token_sdk_1.assetControllerProgramId,
|
|
351
|
+
assetMint: args.assetMint,
|
|
352
|
+
assetController: assetController,
|
|
353
|
+
revokeTokenAccount: revokeTokenAccount,
|
|
354
|
+
identityRegistry: identityRegistry,
|
|
355
|
+
identityAccount: (0, rwa_token_sdk_1.getIdentityAccountPda)(args.assetMint, investorPda.toString()),
|
|
356
|
+
trackerAccount: (0, rwa_token_sdk_1.getTrackerAccountPda)(args.assetMint, investorPda.toString()),
|
|
357
|
+
policyEngineProgram: rwa_token_sdk_1.policyEngineProgramId,
|
|
358
|
+
policyEngine: (0, rwa_token_sdk_1.getPolicyEnginePda)(args.assetMint),
|
|
359
|
+
walletIdentityAccount: (0, rwa_token_sdk_1.getWalletIdentityAccountPda)(args.assetMint, args.wallet),
|
|
360
|
+
tokenProgram: spl_token_1.TOKEN_2022_PROGRAM_ID,
|
|
361
|
+
associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
362
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
363
|
+
})
|
|
364
|
+
.instruction()];
|
|
365
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
});
|
|
369
|
+
};
|
|
370
|
+
/**
|
|
371
|
+
* Asynchronously generates instruction to close mint.
|
|
372
|
+
* @param args - {@link CloseMintArgs}
|
|
373
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
374
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
375
|
+
* @returns A Promise that resolves to the instruction to close mint.
|
|
376
|
+
*/
|
|
377
|
+
AssetController.prototype.closeMintIxn = function (args, assetAccessController, authorizedUserRole) {
|
|
378
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
379
|
+
var closeIx, ixData;
|
|
380
|
+
return __generator(this, function (_a) {
|
|
381
|
+
switch (_a.label) {
|
|
382
|
+
case 0: return [4 /*yield*/, (0, rwa_token_sdk_1.getCloseMintIx)(args, this.rwaClient.provider)];
|
|
383
|
+
case 1:
|
|
384
|
+
closeIx = _a.sent();
|
|
385
|
+
ixData = closeIx.data;
|
|
386
|
+
return [2 /*return*/, this.rbacProgram.methods
|
|
387
|
+
.closeMintAccount(ixData)
|
|
388
|
+
.accountsStrict({
|
|
389
|
+
user: args.signer,
|
|
390
|
+
controllerAuthority: args.authority,
|
|
391
|
+
assetAccessController: assetAccessController,
|
|
392
|
+
authorizedUserRole: authorizedUserRole || null,
|
|
393
|
+
assetControllerProgram: rwa_token_sdk_1.assetControllerProgramId,
|
|
394
|
+
assetMint: args.assetMint,
|
|
395
|
+
assetController: (0, rwa_token_sdk_1.getAssetControllerPda)(args.assetMint),
|
|
396
|
+
tokenProgram: spl_token_1.TOKEN_2022_PROGRAM_ID,
|
|
397
|
+
})
|
|
398
|
+
.instruction()];
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Asynchronously generates instruction to update mint interest rate.
|
|
405
|
+
* @param args - {@link UpdateInterestBearingMintRateArgs}
|
|
406
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
407
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
408
|
+
* @returns A Promise that resolves to the instruction to update mint interest rate.
|
|
409
|
+
*/
|
|
410
|
+
AssetController.prototype.updateInterestBearingMintRateIxn = function (args, assetAccessController, authorizedUserRole) {
|
|
411
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
412
|
+
var updateIx, ixData;
|
|
413
|
+
return __generator(this, function (_a) {
|
|
414
|
+
switch (_a.label) {
|
|
415
|
+
case 0: return [4 /*yield*/, (0, rwa_token_sdk_1.getUpdateInterestBearingMintRateIx)(args, this.rwaClient.provider)];
|
|
416
|
+
case 1:
|
|
417
|
+
updateIx = _a.sent();
|
|
418
|
+
ixData = updateIx.data;
|
|
419
|
+
return [2 /*return*/, this.rbacProgram.methods
|
|
420
|
+
.updateInterestBearingMintRate(ixData)
|
|
421
|
+
.accountsStrict({
|
|
422
|
+
user: args.signer,
|
|
423
|
+
controllerAuthority: args.authority,
|
|
424
|
+
assetAccessController: assetAccessController,
|
|
425
|
+
authorizedUserRole: authorizedUserRole || null,
|
|
426
|
+
assetControllerProgram: rwa_token_sdk_1.assetControllerProgramId,
|
|
427
|
+
assetMint: args.assetMint,
|
|
428
|
+
assetController: (0, rwa_token_sdk_1.getAssetControllerPda)(args.assetMint),
|
|
429
|
+
eventAuthority: (0, rwa_token_sdk_1.getAssetControllerEventAuthority)(),
|
|
430
|
+
tokenProgram: spl_token_1.TOKEN_2022_PROGRAM_ID,
|
|
431
|
+
})
|
|
432
|
+
.instruction()];
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
};
|
|
437
|
+
/**
|
|
438
|
+
* Asynchronously generates instruction to seize tokens.
|
|
439
|
+
* @param args - {@link SeizeTokensArgs}
|
|
440
|
+
* @param signer - User signer public key.
|
|
441
|
+
* @param assetAccessController - RBAC AssetAccessController account.
|
|
442
|
+
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
443
|
+
* @returns A Promise that resolves to the instruction to seize.
|
|
444
|
+
*/
|
|
445
|
+
AssetController.prototype.seizeTokensIxn = function (args, investorId, signer, assetAccessController, authorizedUserRole) {
|
|
446
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
447
|
+
var identityRegistry, investorPda, _a, _, seizeIx;
|
|
448
|
+
return __generator(this, function (_b) {
|
|
449
|
+
switch (_b.label) {
|
|
450
|
+
case 0:
|
|
451
|
+
identityRegistry = (0, rwa_token_sdk_1.getIdentityRegistryPda)(args.assetMint);
|
|
452
|
+
investorPda = (0, pdas_1.deriveInvestorPda)(investorId, identityRegistry);
|
|
453
|
+
return [4 /*yield*/, (0, rwa_token_sdk_1.getSeizeTokensIx)(__assign(__assign({}, args), { wallet: args.from, from: investorPda.toString() }), this.rwaClient.provider)];
|
|
454
|
+
case 1:
|
|
455
|
+
_a = _b.sent(), _ = _a[0], seizeIx = _a[1];
|
|
456
|
+
return [2 /*return*/, this.rbacProgram.methods
|
|
457
|
+
.seizeTokens(seizeIx.data)
|
|
458
|
+
.accountsStrict({
|
|
459
|
+
user: signer,
|
|
460
|
+
controllerAuthority: args.authority,
|
|
461
|
+
assetAccessController: assetAccessController,
|
|
462
|
+
authorizedUserRole: authorizedUserRole || null,
|
|
463
|
+
assetControllerProgram: rwa_token_sdk_1.assetControllerProgramId,
|
|
464
|
+
assetMint: args.assetMint,
|
|
465
|
+
assetController: (0, rwa_token_sdk_1.getAssetControllerPda)(args.assetMint),
|
|
466
|
+
sourceTokenAccount: (0, spl_token_1.getAssociatedTokenAddressSync)(new web3_js_1.PublicKey(args.assetMint), new web3_js_1.PublicKey(args.from), false, spl_token_1.TOKEN_2022_PROGRAM_ID),
|
|
467
|
+
destinationTokenAccount: (0, spl_token_1.getAssociatedTokenAddressSync)(new web3_js_1.PublicKey(args.assetMint), new web3_js_1.PublicKey(args.to), true, spl_token_1.TOKEN_2022_PROGRAM_ID),
|
|
468
|
+
tokenProgram: spl_token_1.TOKEN_2022_PROGRAM_ID,
|
|
469
|
+
})
|
|
470
|
+
.remainingAccounts([
|
|
471
|
+
{
|
|
472
|
+
pubkey: (0, rwa_token_sdk_1.getPolicyEnginePda)(args.assetMint),
|
|
473
|
+
isWritable: true,
|
|
474
|
+
isSigner: false,
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
pubkey: rwa_token_sdk_1.identityRegistryProgramId,
|
|
478
|
+
isWritable: false,
|
|
479
|
+
isSigner: false,
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
pubkey: rwa_token_sdk_1.policyEngineProgramId,
|
|
483
|
+
isWritable: false,
|
|
484
|
+
isSigner: false,
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
pubkey: (0, rwa_token_sdk_1.getIdentityRegistryPda)(args.assetMint),
|
|
488
|
+
isWritable: false,
|
|
489
|
+
isSigner: false,
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
pubkey: (0, rwa_token_sdk_1.getIdentityAccountPda)(args.assetMint, args.to),
|
|
493
|
+
isWritable: false,
|
|
494
|
+
isSigner: false,
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
pubkey: (0, rwa_token_sdk_1.getIdentityAccountPda)(args.assetMint, investorPda.toString()),
|
|
498
|
+
isWritable: false,
|
|
499
|
+
isSigner: false,
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
pubkey: (0, rwa_token_sdk_1.getTrackerAccountPda)(args.assetMint, args.to),
|
|
503
|
+
isWritable: true,
|
|
504
|
+
isSigner: false,
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
pubkey: (0, rwa_token_sdk_1.getTrackerAccountPda)(args.assetMint, investorPda.toString()),
|
|
508
|
+
isWritable: true,
|
|
509
|
+
isSigner: false,
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
pubkey: (0, rwa_token_sdk_1.getExtraMetasListPda)(args.assetMint),
|
|
513
|
+
isWritable: false,
|
|
514
|
+
isSigner: false,
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
pubkey: (0, rwa_token_sdk_1.getWalletIdentityAccountPda)(args.assetMint, args.to),
|
|
518
|
+
isWritable: false,
|
|
519
|
+
isSigner: false,
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
pubkey: (0, rwa_token_sdk_1.getWalletIdentityAccountPda)(args.assetMint, args.from),
|
|
523
|
+
isWritable: false,
|
|
524
|
+
isSigner: false,
|
|
525
|
+
},
|
|
526
|
+
])
|
|
527
|
+
.instruction()];
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
});
|
|
531
|
+
};
|
|
532
|
+
return AssetController;
|
|
533
|
+
}());
|
|
534
|
+
exports.AssetController = AssetController;
|
|
535
|
+
//# sourceMappingURL=AssetController.js.map
|