@dstoken-solana/rwa-rbac 0.1.3 → 0.2.1

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/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PublicKey, SystemProgram } from '@solana/web3.js';
2
- import { Program, BN } from '@coral-xyz/anchor';
3
- import { TOKEN_2022_PROGRAM_ID, getAssociatedTokenAddressSync, ASSOCIATED_TOKEN_PROGRAM_ID, getAccount } 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, getRemoveLevelFromIdentityAccount, getIdentityRegistryProgram, getPolicyEngineProgram, RwaClient } from '@dstoken-solana/rwa-token-sdk';
2
+ import { utils, Program, BN } from '@coral-xyz/anchor';
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, getRemoveLevelFromIdentityAccount, 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");
@@ -41,15 +41,16 @@ const deriveUserRolePda = (id, assetAccessController, programId = RBAC_PROGRAM)
41
41
  Buffer.from("UserRole"),
42
42
  ], programId)[0];
43
43
  };
44
+ const getEventAuthority = (programId) => PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], programId)[0];
44
45
 
45
- var address$2 = "3g6fUgMsJQhjPUYxNjEU5PyzGf8DerbDx8p5Qh4yMnRR";
46
- var metadata$2 = {
46
+ var address$1 = "3g6fUgMsJQhjPUYxNjEU5PyzGf8DerbDx8p5Qh4yMnRR";
47
+ var metadata$1 = {
47
48
  name: "rwa_rbac",
48
49
  version: "0.1.0",
49
50
  spec: "0.1.0",
50
51
  description: "Created with Anchor"
51
52
  };
52
- var instructions$2 = [
53
+ var instructions$1 = [
53
54
  {
54
55
  name: "add_level_to_identity_account",
55
56
  discriminator: [
@@ -122,6 +123,9 @@ var instructions$2 = [
122
123
  },
123
124
  {
124
125
  name: "asset_mint"
126
+ },
127
+ {
128
+ name: "event_authority"
125
129
  }
126
130
  ],
127
131
  args: [
@@ -212,6 +216,12 @@ var instructions$2 = [
212
216
  },
213
217
  {
214
218
  name: "asset_mint"
219
+ },
220
+ {
221
+ name: "event_authority_identity_metadata_registry"
222
+ },
223
+ {
224
+ name: "event_authority_identity_registry"
215
225
  }
216
226
  ],
217
227
  args: [
@@ -295,101 +305,6 @@ var instructions$2 = [
295
305
  }
296
306
  ]
297
307
  },
298
- {
299
- name: "add_token_lock",
300
- discriminator: [
301
- 195,
302
- 26,
303
- 109,
304
- 80,
305
- 46,
306
- 7,
307
- 195,
308
- 55
309
- ],
310
- accounts: [
311
- {
312
- name: "payer",
313
- writable: true,
314
- signer: true
315
- },
316
- {
317
- name: "user",
318
- signer: true
319
- },
320
- {
321
- name: "controller_authority",
322
- writable: true,
323
- relations: [
324
- "asset_access_controller"
325
- ]
326
- },
327
- {
328
- name: "asset_access_controller",
329
- relations: [
330
- "authorized_user_role"
331
- ]
332
- },
333
- {
334
- name: "authorized_user_role",
335
- optional: true
336
- },
337
- {
338
- name: "token_locks_program",
339
- address: "9bNt3ZiZpDdHqAt5Q1Wq6twFe5RKmMCwA7MJyK2HgGnU"
340
- },
341
- {
342
- name: "investor_locks",
343
- writable: true
344
- },
345
- {
346
- name: "investor"
347
- },
348
- {
349
- name: "wallet_identity_account"
350
- },
351
- {
352
- name: "identity_account"
353
- },
354
- {
355
- name: "asset_mint",
356
- writable: true
357
- },
358
- {
359
- name: "unlocked_token_account",
360
- writable: true
361
- },
362
- {
363
- name: "locked_token_account",
364
- writable: true
365
- },
366
- {
367
- name: "asset_controller"
368
- },
369
- {
370
- name: "identity_registry",
371
- writable: true
372
- },
373
- {
374
- name: "asset_controller_program",
375
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
376
- },
377
- {
378
- name: "token_program",
379
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
380
- },
381
- {
382
- name: "system_program",
383
- address: "11111111111111111111111111111111"
384
- }
385
- ],
386
- args: [
387
- {
388
- name: "cpi_data",
389
- type: "bytes"
390
- }
391
- ]
392
- },
393
308
  {
394
309
  name: "assign_user_role",
395
310
  discriminator: [
@@ -430,6 +345,38 @@ var instructions$2 = [
430
345
  {
431
346
  name: "system_program",
432
347
  address: "11111111111111111111111111111111"
348
+ },
349
+ {
350
+ name: "event_authority",
351
+ pda: {
352
+ seeds: [
353
+ {
354
+ kind: "const",
355
+ value: [
356
+ 95,
357
+ 95,
358
+ 101,
359
+ 118,
360
+ 101,
361
+ 110,
362
+ 116,
363
+ 95,
364
+ 97,
365
+ 117,
366
+ 116,
367
+ 104,
368
+ 111,
369
+ 114,
370
+ 105,
371
+ 116,
372
+ 121
373
+ ]
374
+ }
375
+ ]
376
+ }
377
+ },
378
+ {
379
+ name: "program"
433
380
  }
434
381
  ],
435
382
  args: [
@@ -490,6 +437,9 @@ var instructions$2 = [
490
437
  {
491
438
  name: "system_program",
492
439
  address: "11111111111111111111111111111111"
440
+ },
441
+ {
442
+ name: "event_authority"
493
443
  }
494
444
  ],
495
445
  args: [
@@ -558,6 +508,9 @@ var instructions$2 = [
558
508
  {
559
509
  name: "system_program",
560
510
  address: "11111111111111111111111111111111"
511
+ },
512
+ {
513
+ name: "event_authority"
561
514
  }
562
515
  ],
563
516
  args: [
@@ -616,6 +569,9 @@ var instructions$2 = [
616
569
  {
617
570
  name: "system_program",
618
571
  address: "11111111111111111111111111111111"
572
+ },
573
+ {
574
+ name: "event_authority"
619
575
  }
620
576
  ],
621
577
  args: [
@@ -674,6 +630,9 @@ var instructions$2 = [
674
630
  {
675
631
  name: "system_program",
676
632
  address: "11111111111111111111111111111111"
633
+ },
634
+ {
635
+ name: "event_authority"
677
636
  }
678
637
  ],
679
638
  args: [
@@ -752,6 +711,9 @@ var instructions$2 = [
752
711
  },
753
712
  {
754
713
  name: "asset_mint"
714
+ },
715
+ {
716
+ name: "event_authority_identity_registry"
755
717
  }
756
718
  ],
757
719
  args: [
@@ -806,6 +768,9 @@ var instructions$2 = [
806
768
  {
807
769
  name: "policy_engine",
808
770
  writable: true
771
+ },
772
+ {
773
+ name: "event_authority"
809
774
  }
810
775
  ],
811
776
  args: [
@@ -860,6 +825,9 @@ var instructions$2 = [
860
825
  {
861
826
  name: "policy_engine",
862
827
  writable: true
828
+ },
829
+ {
830
+ name: "event_authority"
863
831
  }
864
832
  ],
865
833
  args: [
@@ -869,70 +837,6 @@ var instructions$2 = [
869
837
  }
870
838
  ]
871
839
  },
872
- {
873
- name: "close_investor_locks",
874
- discriminator: [
875
- 255,
876
- 60,
877
- 220,
878
- 115,
879
- 217,
880
- 104,
881
- 157,
882
- 171
883
- ],
884
- accounts: [
885
- {
886
- name: "payer",
887
- writable: true,
888
- signer: true
889
- },
890
- {
891
- name: "user",
892
- signer: true
893
- },
894
- {
895
- name: "controller_authority",
896
- relations: [
897
- "asset_access_controller"
898
- ]
899
- },
900
- {
901
- name: "asset_access_controller",
902
- relations: [
903
- "authorized_user_role"
904
- ]
905
- },
906
- {
907
- name: "authorized_user_role",
908
- optional: true
909
- },
910
- {
911
- name: "token_locks_program",
912
- address: "9bNt3ZiZpDdHqAt5Q1Wq6twFe5RKmMCwA7MJyK2HgGnU"
913
- },
914
- {
915
- name: "investor_locks",
916
- writable: true
917
- },
918
- {
919
- name: "investor"
920
- },
921
- {
922
- name: "locked_token_account",
923
- writable: true
924
- },
925
- {
926
- name: "token_program"
927
- },
928
- {
929
- name: "system_program",
930
- address: "11111111111111111111111111111111"
931
- }
932
- ],
933
- args: [
934
- ]
935
- },
936
840
  {
937
841
  name: "close_mint_account",
938
842
  discriminator: [
@@ -1118,6 +1022,9 @@ var instructions$2 = [
1118
1022
  {
1119
1023
  name: "system_program",
1120
1024
  address: "11111111111111111111111111111111"
1025
+ },
1026
+ {
1027
+ name: "event_authority"
1121
1028
  }
1122
1029
  ],
1123
1030
  args: [
@@ -1128,16 +1035,16 @@ var instructions$2 = [
1128
1035
  ]
1129
1036
  },
1130
1037
  {
1131
- name: "create_investor_locks",
1038
+ name: "create_user_role",
1132
1039
  discriminator: [
1133
- 223,
1134
- 81,
1135
- 139,
1136
- 162,
1137
- 204,
1138
- 48,
1139
- 24,
1140
- 213
1040
+ 13,
1041
+ 20,
1042
+ 224,
1043
+ 42,
1044
+ 3,
1045
+ 120,
1046
+ 67,
1047
+ 23
1141
1048
  ],
1142
1049
  accounts: [
1143
1050
  {
@@ -1150,13 +1057,12 @@ var instructions$2 = [
1150
1057
  signer: true
1151
1058
  },
1152
1059
  {
1153
- name: "controller_authority",
1154
- relations: [
1155
- "asset_access_controller"
1156
- ]
1060
+ name: "new_user_role",
1061
+ writable: true
1157
1062
  },
1158
1063
  {
1159
1064
  name: "asset_access_controller",
1065
+ writable: true,
1160
1066
  relations: [
1161
1067
  "authorized_user_role"
1162
1068
  ]
@@ -1166,123 +1072,45 @@ var instructions$2 = [
1166
1072
  optional: true
1167
1073
  },
1168
1074
  {
1169
- name: "token_locks_program",
1170
- address: "9bNt3ZiZpDdHqAt5Q1Wq6twFe5RKmMCwA7MJyK2HgGnU"
1171
- },
1075
+ name: "system_program",
1076
+ address: "11111111111111111111111111111111"
1077
+ }
1078
+ ],
1079
+ args: [
1172
1080
  {
1173
- name: "investor_locks",
1174
- writable: true
1081
+ name: "name",
1082
+ type: "string"
1175
1083
  },
1176
1084
  {
1177
- name: "investor"
1085
+ name: "allowed_admin_ixs",
1086
+ type: "u64"
1178
1087
  },
1179
1088
  {
1180
- name: "identity_account"
1181
- },
1089
+ name: "allowed_medici_ixs",
1090
+ type: "u64"
1091
+ }
1092
+ ]
1093
+ },
1094
+ {
1095
+ name: "delete_user_role",
1096
+ discriminator: [
1097
+ 177,
1098
+ 139,
1099
+ 27,
1100
+ 46,
1101
+ 113,
1102
+ 250,
1103
+ 139,
1104
+ 225
1105
+ ],
1106
+ accounts: [
1182
1107
  {
1183
- name: "asset_mint",
1108
+ name: "receiver",
1184
1109
  writable: true
1185
1110
  },
1186
1111
  {
1187
- name: "locked_token_account",
1188
- writable: true
1189
- },
1190
- {
1191
- name: "asset_controller"
1192
- },
1193
- {
1194
- name: "asset_controller_program",
1195
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
1196
- },
1197
- {
1198
- name: "token_program",
1199
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
1200
- },
1201
- {
1202
- name: "system_program",
1203
- address: "11111111111111111111111111111111"
1204
- }
1205
- ],
1206
- args: [
1207
- ]
1208
- },
1209
- {
1210
- name: "create_user_role",
1211
- discriminator: [
1212
- 13,
1213
- 20,
1214
- 224,
1215
- 42,
1216
- 3,
1217
- 120,
1218
- 67,
1219
- 23
1220
- ],
1221
- accounts: [
1222
- {
1223
- name: "payer",
1224
- writable: true,
1225
- signer: true
1226
- },
1227
- {
1228
- name: "user",
1229
- signer: true
1230
- },
1231
- {
1232
- name: "new_user_role",
1233
- writable: true
1234
- },
1235
- {
1236
- name: "asset_access_controller",
1237
- writable: true,
1238
- relations: [
1239
- "authorized_user_role"
1240
- ]
1241
- },
1242
- {
1243
- name: "authorized_user_role",
1244
- optional: true
1245
- },
1246
- {
1247
- name: "system_program",
1248
- address: "11111111111111111111111111111111"
1249
- }
1250
- ],
1251
- args: [
1252
- {
1253
- name: "name",
1254
- type: "string"
1255
- },
1256
- {
1257
- name: "allowed_admin_ixs",
1258
- type: "u64"
1259
- },
1260
- {
1261
- name: "allowed_medici_ixs",
1262
- type: "u64"
1263
- }
1264
- ]
1265
- },
1266
- {
1267
- name: "delete_user_role",
1268
- discriminator: [
1269
- 177,
1270
- 139,
1271
- 27,
1272
- 46,
1273
- 113,
1274
- 250,
1275
- 139,
1276
- 225
1277
- ],
1278
- accounts: [
1279
- {
1280
- name: "receiver",
1281
- writable: true
1282
- },
1283
- {
1284
- name: "user",
1285
- signer: true
1112
+ name: "user",
1113
+ signer: true
1286
1114
  },
1287
1115
  {
1288
1116
  name: "asset_access_controller",
@@ -1352,6 +1180,9 @@ var instructions$2 = [
1352
1180
  {
1353
1181
  name: "system_program",
1354
1182
  address: "11111111111111111111111111111111"
1183
+ },
1184
+ {
1185
+ name: "event_authority"
1355
1186
  }
1356
1187
  ],
1357
1188
  args: [
@@ -1414,6 +1245,9 @@ var instructions$2 = [
1414
1245
  },
1415
1246
  {
1416
1247
  name: "identity_registry"
1248
+ },
1249
+ {
1250
+ name: "event_authority"
1417
1251
  }
1418
1252
  ],
1419
1253
  args: [
@@ -1573,6 +1407,9 @@ var instructions$2 = [
1573
1407
  },
1574
1408
  {
1575
1409
  name: "wallet_identity_account"
1410
+ },
1411
+ {
1412
+ name: "event_authority"
1576
1413
  }
1577
1414
  ],
1578
1415
  args: [
@@ -1748,6 +1585,12 @@ var instructions$2 = [
1748
1585
  name: "wallet_identity",
1749
1586
  writable: true
1750
1587
  },
1588
+ {
1589
+ name: "event_authority_identity_metadata_registry"
1590
+ },
1591
+ {
1592
+ name: "event_authority_identity_registry"
1593
+ },
1751
1594
  {
1752
1595
  name: "system_program",
1753
1596
  address: "11111111111111111111111111111111"
@@ -1760,6 +1603,73 @@ var instructions$2 = [
1760
1603
  }
1761
1604
  ]
1762
1605
  },
1606
+ {
1607
+ name: "remove_identity_account",
1608
+ discriminator: [
1609
+ 78,
1610
+ 35,
1611
+ 174,
1612
+ 50,
1613
+ 72,
1614
+ 181,
1615
+ 12,
1616
+ 42
1617
+ ],
1618
+ accounts: [
1619
+ {
1620
+ name: "payer",
1621
+ writable: true,
1622
+ signer: true
1623
+ },
1624
+ {
1625
+ name: "user",
1626
+ signer: true
1627
+ },
1628
+ {
1629
+ name: "controller_authority",
1630
+ relations: [
1631
+ "asset_access_controller"
1632
+ ]
1633
+ },
1634
+ {
1635
+ name: "asset_access_controller",
1636
+ relations: [
1637
+ "authorized_user_role"
1638
+ ]
1639
+ },
1640
+ {
1641
+ name: "authorized_user_role",
1642
+ optional: true
1643
+ },
1644
+ {
1645
+ name: "identity_registry_program",
1646
+ address: "GZsnjqT3c5zbHqsctrJ4EG4rbEfo7ZXyyUG7aDJNmxfA"
1647
+ },
1648
+ {
1649
+ name: "identity_registry"
1650
+ },
1651
+ {
1652
+ name: "identity_account",
1653
+ writable: true
1654
+ },
1655
+ {
1656
+ name: "wallet_identity",
1657
+ writable: true
1658
+ },
1659
+ {
1660
+ name: "event_authority"
1661
+ },
1662
+ {
1663
+ name: "identity_owner"
1664
+ }
1665
+ ],
1666
+ args: [
1667
+ {
1668
+ name: "cpi_data",
1669
+ type: "bytes"
1670
+ }
1671
+ ]
1672
+ },
1763
1673
  {
1764
1674
  name: "remove_investor",
1765
1675
  discriminator: [
@@ -1828,6 +1738,12 @@ var instructions$2 = [
1828
1738
  {
1829
1739
  name: "tracker_account",
1830
1740
  writable: true
1741
+ },
1742
+ {
1743
+ name: "event_authority_identity_metadata_registry"
1744
+ },
1745
+ {
1746
+ name: "event_authority_identity_registry"
1831
1747
  }
1832
1748
  ],
1833
1749
  args: [
@@ -1905,6 +1821,9 @@ var instructions$2 = [
1905
1821
  },
1906
1822
  {
1907
1823
  name: "asset_mint"
1824
+ },
1825
+ {
1826
+ name: "event_authority"
1908
1827
  }
1909
1828
  ],
1910
1829
  args: [
@@ -1987,6 +1906,9 @@ var instructions$2 = [
1987
1906
  },
1988
1907
  {
1989
1908
  name: "asset_mint"
1909
+ },
1910
+ {
1911
+ name: "event_authority_identity_registry"
1990
1912
  }
1991
1913
  ],
1992
1914
  args: [
@@ -2070,92 +1992,6 @@ var instructions$2 = [
2070
1992
  }
2071
1993
  ]
2072
1994
  },
2073
- {
2074
- name: "remove_token_lock",
2075
- discriminator: [
2076
- 168,
2077
- 128,
2078
- 173,
2079
- 188,
2080
- 172,
2081
- 228,
2082
- 154,
2083
- 90
2084
- ],
2085
- accounts: [
2086
- {
2087
- name: "user",
2088
- signer: true
2089
- },
2090
- {
2091
- name: "controller_authority",
2092
- writable: true,
2093
- relations: [
2094
- "asset_access_controller"
2095
- ]
2096
- },
2097
- {
2098
- name: "asset_access_controller",
2099
- relations: [
2100
- "authorized_user_role"
2101
- ]
2102
- },
2103
- {
2104
- name: "authorized_user_role",
2105
- optional: true
2106
- },
2107
- {
2108
- name: "token_locks_program",
2109
- address: "9bNt3ZiZpDdHqAt5Q1Wq6twFe5RKmMCwA7MJyK2HgGnU"
2110
- },
2111
- {
2112
- name: "investor_locks",
2113
- writable: true
2114
- },
2115
- {
2116
- name: "investor"
2117
- },
2118
- {
2119
- name: "wallet_identity_account"
2120
- },
2121
- {
2122
- name: "identity_account"
2123
- },
2124
- {
2125
- name: "asset_mint",
2126
- writable: true
2127
- },
2128
- {
2129
- name: "unlocked_token_account",
2130
- writable: true
2131
- },
2132
- {
2133
- name: "locked_token_account",
2134
- writable: true
2135
- },
2136
- {
2137
- name: "asset_controller"
2138
- },
2139
- {
2140
- name: "identity_registry",
2141
- writable: true
2142
- },
2143
- {
2144
- name: "asset_controller_program",
2145
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
2146
- },
2147
- {
2148
- name: "token_program",
2149
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
2150
- }
2151
- ],
2152
- args: [
2153
- {
2154
- name: "indices",
2155
- type: "bytes"
2156
- }
2157
- ]
2158
- },
2159
1995
  {
2160
1996
  name: "remove_user_role",
2161
1997
  discriminator: [
@@ -2187,6 +2023,38 @@ var instructions$2 = [
2187
2023
  {
2188
2024
  name: "authorized_user_role",
2189
2025
  optional: true
2026
+ },
2027
+ {
2028
+ name: "event_authority",
2029
+ pda: {
2030
+ seeds: [
2031
+ {
2032
+ kind: "const",
2033
+ value: [
2034
+ 95,
2035
+ 95,
2036
+ 101,
2037
+ 118,
2038
+ 101,
2039
+ 110,
2040
+ 116,
2041
+ 95,
2042
+ 97,
2043
+ 117,
2044
+ 116,
2045
+ 104,
2046
+ 111,
2047
+ 114,
2048
+ 105,
2049
+ 116,
2050
+ 121
2051
+ ]
2052
+ }
2053
+ ]
2054
+ }
2055
+ },
2056
+ {
2057
+ name: "program"
2190
2058
  }
2191
2059
  ],
2192
2060
  args: [
@@ -2278,6 +2146,9 @@ var instructions$2 = [
2278
2146
  {
2279
2147
  name: "system_program",
2280
2148
  address: "11111111111111111111111111111111"
2149
+ },
2150
+ {
2151
+ name: "event_authority"
2281
2152
  }
2282
2153
  ],
2283
2154
  args: [
@@ -2342,6 +2213,9 @@ var instructions$2 = [
2342
2213
  {
2343
2214
  name: "token_program",
2344
2215
  address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
2216
+ },
2217
+ {
2218
+ name: "event_authority"
2345
2219
  }
2346
2220
  ],
2347
2221
  args: [
@@ -2396,6 +2270,9 @@ var instructions$2 = [
2396
2270
  {
2397
2271
  name: "policy_engine",
2398
2272
  writable: true
2273
+ },
2274
+ {
2275
+ name: "event_authority"
2399
2276
  }
2400
2277
  ],
2401
2278
  args: [
@@ -2405,6 +2282,41 @@ var instructions$2 = [
2405
2282
  }
2406
2283
  ]
2407
2284
  },
2285
+ {
2286
+ name: "set_lut_address",
2287
+ discriminator: [
2288
+ 254,
2289
+ 239,
2290
+ 106,
2291
+ 70,
2292
+ 17,
2293
+ 87,
2294
+ 57,
2295
+ 202
2296
+ ],
2297
+ accounts: [
2298
+ {
2299
+ name: "user",
2300
+ signer: true
2301
+ },
2302
+ {
2303
+ name: "asset_access_controller",
2304
+ writable: true,
2305
+ relations: [
2306
+ "authorized_user_role"
2307
+ ]
2308
+ },
2309
+ {
2310
+ name: "authorized_user_role",
2311
+ optional: true
2312
+ },
2313
+ {
2314
+ name: "lut_address"
2315
+ }
2316
+ ],
2317
+ args: [
2318
+ ]
2319
+ },
2408
2320
  {
2409
2321
  name: "thaw_token_account",
2410
2322
  discriminator: [
@@ -2672,7 +2584,7 @@ var instructions$2 = [
2672
2584
  ]
2673
2585
  }
2674
2586
  ];
2675
- var accounts$2 = [
2587
+ var accounts$1 = [
2676
2588
  {
2677
2589
  name: "AssetAccessController",
2678
2590
  discriminator: [
@@ -2700,7 +2612,35 @@ var accounts$2 = [
2700
2612
  ]
2701
2613
  }
2702
2614
  ];
2703
- var errors$2 = [
2615
+ var events$1 = [
2616
+ {
2617
+ name: "AssignUserRoleEvent",
2618
+ discriminator: [
2619
+ 66,
2620
+ 20,
2621
+ 203,
2622
+ 47,
2623
+ 242,
2624
+ 72,
2625
+ 213,
2626
+ 93
2627
+ ]
2628
+ },
2629
+ {
2630
+ name: "RemoveUserRoleEvent",
2631
+ discriminator: [
2632
+ 213,
2633
+ 162,
2634
+ 73,
2635
+ 7,
2636
+ 11,
2637
+ 89,
2638
+ 226,
2639
+ 140
2640
+ ]
2641
+ }
2642
+ ];
2643
+ var errors$1 = [
2704
2644
  {
2705
2645
  code: 6000,
2706
2646
  name: "UnknownInstruction",
@@ -2735,9 +2675,14 @@ var errors$2 = [
2735
2675
  code: 6006,
2736
2676
  name: "InvalidLevel",
2737
2677
  msg: "Invalid level"
2678
+ },
2679
+ {
2680
+ code: 6007,
2681
+ name: "IllegalOperation",
2682
+ msg: "Illegal operation"
2738
2683
  }
2739
2684
  ];
2740
- var types$2 = [
2685
+ var types$1 = [
2741
2686
  {
2742
2687
  name: "AssetAccessController",
2743
2688
  type: {
@@ -2777,6 +2722,73 @@ var types$2 = [
2777
2722
  "Number of UserRoles created since initialization. Used for deriving all created UserRole PDAs."
2778
2723
  ],
2779
2724
  type: "u64"
2725
+ },
2726
+ {
2727
+ name: "lut_address",
2728
+ docs: [
2729
+ "Address of the lookup table."
2730
+ ],
2731
+ type: "pubkey"
2732
+ }
2733
+ ]
2734
+ }
2735
+ },
2736
+ {
2737
+ name: "AssignUserRoleEvent",
2738
+ type: {
2739
+ kind: "struct",
2740
+ fields: [
2741
+ {
2742
+ name: "addresses",
2743
+ type: {
2744
+ vec: "pubkey"
2745
+ }
2746
+ },
2747
+ {
2748
+ name: "role",
2749
+ type: "string"
2750
+ },
2751
+ {
2752
+ name: "role_id",
2753
+ type: "u64"
2754
+ },
2755
+ {
2756
+ name: "sender",
2757
+ type: "pubkey"
2758
+ },
2759
+ {
2760
+ name: "seed",
2761
+ type: "pubkey"
2762
+ }
2763
+ ]
2764
+ }
2765
+ },
2766
+ {
2767
+ name: "RemoveUserRoleEvent",
2768
+ type: {
2769
+ kind: "struct",
2770
+ fields: [
2771
+ {
2772
+ name: "addresses",
2773
+ type: {
2774
+ vec: "pubkey"
2775
+ }
2776
+ },
2777
+ {
2778
+ name: "role",
2779
+ type: "string"
2780
+ },
2781
+ {
2782
+ name: "role_id",
2783
+ type: "u64"
2784
+ },
2785
+ {
2786
+ name: "sender",
2787
+ type: "pubkey"
2788
+ },
2789
+ {
2790
+ name: "seed",
2791
+ type: "pubkey"
2780
2792
  }
2781
2793
  ]
2782
2794
  }
@@ -2835,33 +2847,35 @@ var types$2 = [
2835
2847
  }
2836
2848
  ];
2837
2849
  var rwa_rbac = {
2838
- address: address$2,
2839
- metadata: metadata$2,
2840
- instructions: instructions$2,
2841
- accounts: accounts$2,
2842
- errors: errors$2,
2843
- types: types$2
2850
+ address: address$1,
2851
+ metadata: metadata$1,
2852
+ instructions: instructions$1,
2853
+ accounts: accounts$1,
2854
+ events: events$1,
2855
+ errors: errors$1,
2856
+ types: types$1
2844
2857
  };
2845
2858
 
2846
2859
  var rbacIDL = /*#__PURE__*/Object.freeze({
2847
2860
  __proto__: null,
2848
- address: address$2,
2849
- metadata: metadata$2,
2850
- instructions: instructions$2,
2851
- accounts: accounts$2,
2852
- errors: errors$2,
2853
- types: types$2,
2861
+ address: address$1,
2862
+ metadata: metadata$1,
2863
+ instructions: instructions$1,
2864
+ accounts: accounts$1,
2865
+ events: events$1,
2866
+ errors: errors$1,
2867
+ types: types$1,
2854
2868
  'default': rwa_rbac
2855
2869
  });
2856
2870
 
2857
- var address$1 = "D2V7wTBbNCKgYwirgRUnSmc2QyKnHSVmRotWJ4rz8Jp9";
2858
- var metadata$1 = {
2871
+ var address = "D2V7wTBbNCKgYwirgRUnSmc2QyKnHSVmRotWJ4rz8Jp9";
2872
+ var metadata = {
2859
2873
  name: "rwa_imr",
2860
2874
  version: "0.1.0",
2861
2875
  spec: "0.1.0",
2862
2876
  description: "Created with Anchor"
2863
2877
  };
2864
- var instructions$1 = [
2878
+ var instructions = [
2865
2879
  {
2866
2880
  name: "add_levels",
2867
2881
  discriminator: [
@@ -2918,6 +2932,41 @@ var instructions$1 = [
2918
2932
  },
2919
2933
  {
2920
2934
  name: "asset_mint"
2935
+ },
2936
+ {
2937
+ name: "event_authority_identity_registry"
2938
+ },
2939
+ {
2940
+ name: "event_authority",
2941
+ pda: {
2942
+ seeds: [
2943
+ {
2944
+ kind: "const",
2945
+ value: [
2946
+ 95,
2947
+ 95,
2948
+ 101,
2949
+ 118,
2950
+ 101,
2951
+ 110,
2952
+ 116,
2953
+ 95,
2954
+ 97,
2955
+ 117,
2956
+ 116,
2957
+ 104,
2958
+ 111,
2959
+ 114,
2960
+ 105,
2961
+ 116,
2962
+ 121
2963
+ ]
2964
+ }
2965
+ ]
2966
+ }
2967
+ },
2968
+ {
2969
+ name: "program"
2921
2970
  }
2922
2971
  ],
2923
2972
  args: [
@@ -2998,6 +3047,9 @@ var instructions$1 = [
2998
3047
  {
2999
3048
  name: "system_program",
3000
3049
  address: "11111111111111111111111111111111"
3050
+ },
3051
+ {
3052
+ name: "event_authority_identity_registry"
3001
3053
  }
3002
3054
  ],
3003
3055
  args: [
@@ -3059,6 +3111,9 @@ var instructions$1 = [
3059
3111
  },
3060
3112
  {
3061
3113
  name: "asset_mint"
3114
+ },
3115
+ {
3116
+ name: "event_authority_identity_registry"
3062
3117
  }
3063
3118
  ],
3064
3119
  args: [
@@ -3144,6 +3199,41 @@ var instructions$1 = [
3144
3199
  {
3145
3200
  name: "system_program",
3146
3201
  address: "11111111111111111111111111111111"
3202
+ },
3203
+ {
3204
+ name: "event_authority_identity_registry"
3205
+ },
3206
+ {
3207
+ name: "event_authority",
3208
+ pda: {
3209
+ seeds: [
3210
+ {
3211
+ kind: "const",
3212
+ value: [
3213
+ 95,
3214
+ 95,
3215
+ 101,
3216
+ 118,
3217
+ 101,
3218
+ 110,
3219
+ 116,
3220
+ 95,
3221
+ 97,
3222
+ 117,
3223
+ 116,
3224
+ 104,
3225
+ 111,
3226
+ 114,
3227
+ 105,
3228
+ 116,
3229
+ 121
3230
+ ]
3231
+ }
3232
+ ]
3233
+ }
3234
+ },
3235
+ {
3236
+ name: "program"
3147
3237
  }
3148
3238
  ],
3149
3239
  args: [
@@ -3224,6 +3314,41 @@ var instructions$1 = [
3224
3314
  {
3225
3315
  name: "tracker_account",
3226
3316
  writable: true
3317
+ },
3318
+ {
3319
+ name: "event_authority_identity_registry"
3320
+ },
3321
+ {
3322
+ name: "event_authority",
3323
+ pda: {
3324
+ seeds: [
3325
+ {
3326
+ kind: "const",
3327
+ value: [
3328
+ 95,
3329
+ 95,
3330
+ 101,
3331
+ 118,
3332
+ 101,
3333
+ 110,
3334
+ 116,
3335
+ 95,
3336
+ 97,
3337
+ 117,
3338
+ 116,
3339
+ 104,
3340
+ 111,
3341
+ 114,
3342
+ 105,
3343
+ 116,
3344
+ 121
3345
+ ]
3346
+ }
3347
+ ]
3348
+ }
3349
+ },
3350
+ {
3351
+ name: "program"
3227
3352
  }
3228
3353
  ],
3229
3354
  args: [
@@ -3285,6 +3410,9 @@ var instructions$1 = [
3285
3410
  },
3286
3411
  {
3287
3412
  name: "asset_mint"
3413
+ },
3414
+ {
3415
+ name: "event_authority_identity_registry"
3288
3416
  }
3289
3417
  ],
3290
3418
  args: [
@@ -3299,7 +3427,7 @@ var instructions$1 = [
3299
3427
  ]
3300
3428
  }
3301
3429
  ];
3302
- var accounts$1 = [
3430
+ var accounts = [
3303
3431
  {
3304
3432
  name: "Investor",
3305
3433
  discriminator: [
@@ -3314,584 +3442,57 @@ var accounts$1 = [
3314
3442
  ]
3315
3443
  }
3316
3444
  ];
3317
- var errors$1 = [
3445
+ var events = [
3318
3446
  {
3319
- code: 6000,
3320
- name: "UnknownInstruction",
3321
- msg: "Unknown program instruction from CPI data"
3322
- },
3323
- {
3324
- code: 6001,
3325
- name: "InvalidHash",
3326
- msg: "Invalid hash"
3447
+ name: "AddLevelsEvent",
3448
+ discriminator: [
3449
+ 90,
3450
+ 156,
3451
+ 44,
3452
+ 28,
3453
+ 242,
3454
+ 1,
3455
+ 130,
3456
+ 61
3457
+ ]
3327
3458
  },
3328
3459
  {
3329
- code: 6002,
3330
- name: "InvalidLevels",
3331
- msg: "Invalid levels"
3332
- },
3333
- {
3334
- code: 6003,
3335
- name: "InvalidCountryLevel",
3336
- msg: "Invalid country level"
3337
- },
3338
- {
3339
- code: 6004,
3340
- name: "InvalidRegionLevel",
3341
- msg: "Invalid region level"
3342
- },
3343
- {
3344
- code: 6005,
3345
- name: "InvalidAttribute",
3346
- msg: "Invalid attribute level"
3347
- },
3348
- {
3349
- code: 6006,
3350
- name: "UnknownLevel",
3351
- msg: "Unknown level"
3352
- }
3353
- ];
3354
- var types$1 = [
3355
- {
3356
- name: "Investor",
3357
- type: {
3358
- kind: "struct",
3359
- fields: [
3360
- {
3361
- name: "authority",
3362
- docs: [
3363
- "Authority keypair allowed to write this account, will match authority or delegate of IdentityRegistry",
3364
- "at time of creation of IdentityAccount."
3365
- ],
3366
- type: "pubkey"
3367
- },
3368
- {
3369
- name: "identity_account",
3370
- docs: [
3371
- "IdentityAccount associated with this investor."
3372
- ],
3373
- type: "pubkey"
3374
- },
3375
- {
3376
- name: "identity_registry",
3377
- docs: [
3378
- "IdentityRegistryAccount associated with this investor."
3379
- ],
3380
- type: "pubkey"
3381
- },
3382
- {
3383
- name: "bump",
3384
- docs: [
3385
- "PDA Seed Bump"
3386
- ],
3387
- type: "u8"
3388
- },
3389
- {
3390
- name: "investor_id",
3391
- docs: [
3392
- "Unique ID for Investor, generated off-chain."
3393
- ],
3394
- type: "string"
3395
- },
3396
- {
3397
- name: "collision_hash",
3398
- docs: [
3399
- "Metadata for investor, generated off-chain."
3400
- ],
3401
- type: "string"
3402
- },
3403
- {
3404
- name: "last_updated_by",
3405
- docs: [
3406
- "User that last modified this investor. Read from payer of instruction."
3407
- ],
3408
- type: "pubkey"
3409
- },
3410
- {
3411
- name: "levels",
3412
- docs: [
3413
- "Levels assigned to investor."
3414
- ],
3415
- type: {
3416
- vec: {
3417
- defined: {
3418
- name: "LevelData"
3419
- }
3420
- }
3421
- }
3422
- },
3423
- {
3424
- name: "country",
3425
- type: "u8"
3426
- }
3427
- ]
3428
- }
3429
- },
3430
- {
3431
- name: "LevelData",
3432
- type: {
3433
- kind: "struct",
3434
- fields: [
3435
- {
3436
- name: "level",
3437
- docs: [
3438
- "Maps to IdentityAccount level used in RWA Token."
3439
- ],
3440
- type: "u8"
3441
- },
3442
- {
3443
- name: "proof_hash",
3444
- docs: [
3445
- "Hash generated off-chain."
3446
- ],
3447
- type: "string"
3448
- }
3449
- ]
3450
- }
3451
- }
3452
- ];
3453
- var rwa_imr = {
3454
- address: address$1,
3455
- metadata: metadata$1,
3456
- instructions: instructions$1,
3457
- accounts: accounts$1,
3458
- errors: errors$1,
3459
- types: types$1
3460
- };
3461
-
3462
- var imrIDL = /*#__PURE__*/Object.freeze({
3463
- __proto__: null,
3464
- address: address$1,
3465
- metadata: metadata$1,
3466
- instructions: instructions$1,
3467
- accounts: accounts$1,
3468
- errors: errors$1,
3469
- types: types$1,
3470
- 'default': rwa_imr
3471
- });
3472
-
3473
- var address = "9bNt3ZiZpDdHqAt5Q1Wq6twFe5RKmMCwA7MJyK2HgGnU";
3474
- var metadata = {
3475
- name: "token_locks",
3476
- version: "0.1.0",
3477
- spec: "0.1.0",
3478
- description: "Created with Anchor"
3479
- };
3480
- var instructions = [
3481
- {
3482
- name: "add_token_lock",
3483
- discriminator: [
3484
- 195,
3485
- 26,
3486
- 109,
3487
- 80,
3488
- 46,
3489
- 7,
3490
- 195,
3491
- 55
3492
- ],
3493
- accounts: [
3494
- {
3495
- name: "payer",
3496
- writable: true,
3497
- signer: true
3498
- },
3499
- {
3500
- name: "authority",
3501
- docs: [
3502
- "Authority of AssetController (required to execute seize CPI)."
3503
- ],
3504
- writable: true,
3505
- signer: true,
3506
- relations: [
3507
- "investor"
3508
- ]
3509
- },
3510
- {
3511
- name: "investor_locks",
3512
- writable: true
3513
- },
3514
- {
3515
- name: "investor",
3516
- relations: [
3517
- "investor_locks"
3518
- ]
3519
- },
3520
- {
3521
- name: "wallet_identity_account"
3522
- },
3523
- {
3524
- name: "identity_account",
3525
- relations: [
3526
- "investor"
3527
- ]
3528
- },
3529
- {
3530
- name: "asset_mint",
3531
- writable: true
3532
- },
3533
- {
3534
- name: "unlocked_token_account",
3535
- writable: true
3536
- },
3537
- {
3538
- name: "locked_token_account",
3539
- writable: true,
3540
- relations: [
3541
- "investor_locks"
3542
- ]
3543
- },
3544
- {
3545
- name: "asset_controller"
3546
- },
3547
- {
3548
- name: "identity_registry",
3549
- writable: true,
3550
- relations: [
3551
- "investor"
3552
- ]
3553
- },
3554
- {
3555
- name: "asset_controller_program",
3556
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
3557
- },
3558
- {
3559
- name: "token_program",
3560
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
3561
- },
3562
- {
3563
- name: "system_program",
3564
- address: "11111111111111111111111111111111"
3565
- }
3566
- ],
3567
- args: [
3568
- {
3569
- name: "value",
3570
- type: "u64"
3571
- },
3572
- {
3573
- name: "release_time",
3574
- type: "i64"
3575
- },
3576
- {
3577
- name: "reason_code",
3578
- type: "u64"
3579
- },
3580
- {
3581
- name: "reason_string",
3582
- type: "string"
3583
- }
3584
- ]
3585
- },
3586
- {
3587
- name: "close_investor_locks",
3588
- discriminator: [
3589
- 255,
3590
- 60,
3591
- 220,
3592
- 115,
3593
- 217,
3594
- 104,
3595
- 157,
3596
- 171
3597
- ],
3598
- accounts: [
3599
- {
3600
- name: "payer",
3601
- writable: true,
3602
- signer: true
3603
- },
3604
- {
3605
- name: "authority",
3606
- signer: true,
3607
- relations: [
3608
- "investor"
3609
- ]
3610
- },
3611
- {
3612
- name: "investor_locks",
3613
- writable: true
3614
- },
3615
- {
3616
- name: "investor",
3617
- relations: [
3618
- "investor_locks"
3619
- ]
3620
- },
3621
- {
3622
- name: "locked_token_account",
3623
- writable: true,
3624
- relations: [
3625
- "investor_locks"
3626
- ]
3627
- },
3628
- {
3629
- name: "token_program",
3630
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
3631
- },
3632
- {
3633
- name: "system_program",
3634
- address: "11111111111111111111111111111111"
3635
- }
3636
- ],
3637
- args: [
3638
- ]
3639
- },
3640
- {
3641
- name: "create_investor_locks",
3642
- discriminator: [
3643
- 223,
3644
- 81,
3645
- 139,
3646
- 162,
3647
- 204,
3648
- 48,
3649
- 24,
3650
- 213
3651
- ],
3652
- accounts: [
3653
- {
3654
- name: "payer",
3655
- writable: true,
3656
- signer: true
3657
- },
3658
- {
3659
- name: "authority",
3660
- signer: true,
3661
- relations: [
3662
- "investor"
3663
- ]
3664
- },
3665
- {
3666
- name: "investor_locks",
3667
- writable: true,
3668
- pda: {
3669
- seeds: [
3670
- {
3671
- kind: "account",
3672
- path: "investor.investor_id",
3673
- account: "Investor"
3674
- },
3675
- {
3676
- kind: "account",
3677
- path: "investor.identity_registry",
3678
- account: "Investor"
3679
- },
3680
- {
3681
- kind: "const",
3682
- value: [
3683
- 73,
3684
- 110,
3685
- 118,
3686
- 101,
3687
- 115,
3688
- 116,
3689
- 111,
3690
- 114,
3691
- 76,
3692
- 111,
3693
- 99,
3694
- 107,
3695
- 115
3696
- ]
3697
- }
3698
- ]
3699
- }
3700
- },
3701
- {
3702
- name: "investor"
3703
- },
3704
- {
3705
- name: "identity_account",
3706
- docs: [
3707
- "CHECKED: Matches known address."
3708
- ],
3709
- relations: [
3710
- "investor"
3711
- ]
3712
- },
3713
- {
3714
- name: "asset_mint",
3715
- writable: true
3716
- },
3717
- {
3718
- name: "locked_token_account",
3719
- writable: true,
3720
- pda: {
3721
- seeds: [
3722
- {
3723
- kind: "account",
3724
- path: "investor.investor_id",
3725
- account: "Investor"
3726
- },
3727
- {
3728
- kind: "account",
3729
- path: "investor.identity_registry",
3730
- account: "Investor"
3731
- },
3732
- {
3733
- kind: "const",
3734
- value: [
3735
- 76,
3736
- 111,
3737
- 99,
3738
- 107,
3739
- 101,
3740
- 100,
3741
- 84,
3742
- 111,
3743
- 107,
3744
- 101,
3745
- 110,
3746
- 65,
3747
- 99,
3748
- 99,
3749
- 111,
3750
- 117,
3751
- 110,
3752
- 116
3753
- ]
3754
- }
3755
- ]
3756
- }
3757
- },
3758
- {
3759
- name: "asset_controller"
3760
- },
3761
- {
3762
- name: "asset_controller_program",
3763
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
3764
- },
3765
- {
3766
- name: "token_program",
3767
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
3768
- },
3769
- {
3770
- name: "system_program",
3771
- address: "11111111111111111111111111111111"
3772
- }
3773
- ],
3774
- args: [
3775
- ]
3776
- },
3777
- {
3778
- name: "remove_token_lock",
3460
+ name: "RegisterInvestorEvent",
3779
3461
  discriminator: [
3780
- 168,
3781
- 128,
3782
- 173,
3783
- 188,
3784
- 172,
3785
- 228,
3786
- 154,
3787
- 90
3788
- ],
3789
- accounts: [
3790
- {
3791
- name: "user",
3792
- signer: true
3793
- },
3794
- {
3795
- name: "authority",
3796
- docs: [
3797
- "Authority of AssetController (required to execute seize CPI)."
3798
- ],
3799
- writable: true,
3800
- signer: true,
3801
- relations: [
3802
- "investor"
3803
- ]
3804
- },
3805
- {
3806
- name: "investor_locks",
3807
- writable: true
3808
- },
3809
- {
3810
- name: "investor",
3811
- relations: [
3812
- "investor_locks"
3813
- ]
3814
- },
3815
- {
3816
- name: "wallet_identity_account"
3817
- },
3818
- {
3819
- name: "identity_account",
3820
- relations: [
3821
- "investor"
3822
- ]
3823
- },
3824
- {
3825
- name: "asset_mint",
3826
- writable: true
3827
- },
3828
- {
3829
- name: "unlocked_token_account",
3830
- writable: true
3831
- },
3832
- {
3833
- name: "locked_token_account",
3834
- writable: true,
3835
- relations: [
3836
- "investor_locks"
3837
- ]
3838
- },
3839
- {
3840
- name: "asset_controller"
3841
- },
3842
- {
3843
- name: "identity_registry",
3844
- writable: true,
3845
- relations: [
3846
- "investor"
3847
- ]
3848
- },
3849
- {
3850
- name: "asset_controller_program",
3851
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
3852
- },
3853
- {
3854
- name: "token_program",
3855
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
3856
- }
3857
- ],
3858
- args: [
3859
- {
3860
- name: "is_user_authorized",
3861
- type: "bool"
3862
- },
3863
- {
3864
- name: "indices",
3865
- type: "bytes"
3866
- }
3462
+ 137,
3463
+ 181,
3464
+ 142,
3465
+ 164,
3466
+ 140,
3467
+ 196,
3468
+ 246,
3469
+ 182
3867
3470
  ]
3868
- }
3869
- ];
3870
- var accounts = [
3471
+ },
3871
3472
  {
3872
- name: "Investor",
3473
+ name: "RemoveInvestorEvent",
3873
3474
  discriminator: [
3874
- 174,
3875
- 129,
3876
- 17,
3877
- 83,
3878
- 36,
3879
- 116,
3880
- 26,
3881
- 196
3475
+ 221,
3476
+ 84,
3477
+ 243,
3478
+ 216,
3479
+ 215,
3480
+ 253,
3481
+ 246,
3482
+ 253
3882
3483
  ]
3883
3484
  },
3884
3485
  {
3885
- name: "InvestorLocks",
3486
+ name: "RemoveLevelsEvent",
3886
3487
  discriminator: [
3887
- 199,
3888
- 60,
3889
- 219,
3890
- 46,
3891
- 221,
3892
- 205,
3893
- 1,
3894
- 7
3488
+ 145,
3489
+ 158,
3490
+ 97,
3491
+ 146,
3492
+ 126,
3493
+ 14,
3494
+ 2,
3495
+ 225
3895
3496
  ]
3896
3497
  }
3897
3498
  ];
@@ -3903,46 +3504,68 @@ var errors = [
3903
3504
  },
3904
3505
  {
3905
3506
  code: 6001,
3906
- name: "UnknownAccount",
3907
- msg: "Unknown account discriminator"
3507
+ name: "InvalidHash",
3508
+ msg: "Invalid hash"
3908
3509
  },
3909
3510
  {
3910
3511
  code: 6002,
3911
- name: "FailedDeserialization",
3912
- msg: "Invalid account on deserialization"
3512
+ name: "InvalidLevels",
3513
+ msg: "Invalid levels"
3913
3514
  },
3914
3515
  {
3915
3516
  code: 6003,
3916
- name: "InvalidReleaseTime",
3917
- msg: "Invalid release time"
3517
+ name: "InvalidCountryLevel",
3518
+ msg: "Invalid country level"
3918
3519
  },
3919
3520
  {
3920
3521
  code: 6004,
3921
- name: "InvalidReasonString",
3922
- msg: "Invalid reason string"
3522
+ name: "InvalidRegionLevel",
3523
+ msg: "Invalid region level"
3923
3524
  },
3924
3525
  {
3925
3526
  code: 6005,
3926
- name: "InvalidLockValue",
3927
- msg: "Invalid lock value"
3527
+ name: "InvalidAttribute",
3528
+ msg: "Invalid attribute level"
3928
3529
  },
3929
3530
  {
3930
3531
  code: 6006,
3931
- name: "UnauthorizedUser",
3932
- msg: "User initiating instruction is not authorized by RBAC"
3933
- },
3934
- {
3935
- code: 6007,
3936
- name: "InvalidTokenAccountState",
3937
- msg: "Invalid token account state"
3938
- },
3939
- {
3940
- code: 6008,
3941
- name: "LockNotFound",
3942
- msg: "Lock not found"
3532
+ name: "UnknownLevel",
3533
+ msg: "Unknown level"
3943
3534
  }
3944
3535
  ];
3945
3536
  var types = [
3537
+ {
3538
+ name: "AddLevelsEvent",
3539
+ type: {
3540
+ kind: "struct",
3541
+ fields: [
3542
+ {
3543
+ name: "investor_id",
3544
+ type: "string"
3545
+ },
3546
+ {
3547
+ name: "sender",
3548
+ type: "pubkey"
3549
+ },
3550
+ {
3551
+ name: "levels",
3552
+ type: "bytes"
3553
+ },
3554
+ {
3555
+ name: "expiries",
3556
+ type: {
3557
+ vec: "i64"
3558
+ }
3559
+ },
3560
+ {
3561
+ name: "proof_hashes",
3562
+ type: {
3563
+ vec: "string"
3564
+ }
3565
+ }
3566
+ ]
3567
+ }
3568
+ },
3946
3569
  {
3947
3570
  name: "Investor",
3948
3571
  type: {
@@ -4019,117 +3642,116 @@ var types = [
4019
3642
  }
4020
3643
  },
4021
3644
  {
4022
- name: "InvestorLocks",
3645
+ name: "LevelData",
4023
3646
  type: {
4024
3647
  kind: "struct",
4025
3648
  fields: [
4026
3649
  {
4027
- name: "investor",
3650
+ name: "level",
4028
3651
  docs: [
4029
- "Address of Investor account."
3652
+ "Maps to IdentityAccount level used in RWA Token."
4030
3653
  ],
4031
- type: "pubkey"
3654
+ type: "u8"
4032
3655
  },
4033
3656
  {
4034
- name: "locked_token_account",
3657
+ name: "proof_hash",
4035
3658
  docs: [
4036
- "Account storing locked tokens for wallet. Will be frozen upon initialization of",
4037
- "InvestorLocks."
3659
+ "Hash generated off-chain."
4038
3660
  ],
4039
- type: "pubkey"
4040
- },
4041
- {
4042
- name: "locks",
4043
- type: {
4044
- vec: {
4045
- defined: {
4046
- name: "Lock"
4047
- }
4048
- }
4049
- }
3661
+ type: "string"
4050
3662
  }
4051
3663
  ]
4052
3664
  }
4053
3665
  },
4054
3666
  {
4055
- name: "LevelData",
3667
+ name: "RegisterInvestorEvent",
4056
3668
  type: {
4057
3669
  kind: "struct",
4058
3670
  fields: [
3671
+ {
3672
+ name: "investor_id",
3673
+ type: "string"
3674
+ },
4059
3675
  {
4060
3676
  name: "level",
4061
- docs: [
4062
- "Maps to IdentityAccount level used in RWA Token."
4063
- ],
4064
3677
  type: "u8"
4065
3678
  },
4066
3679
  {
4067
- name: "proof_hash",
4068
- docs: [
4069
- "Hash generated off-chain."
4070
- ],
3680
+ name: "expiry",
3681
+ type: "i64"
3682
+ },
3683
+ {
3684
+ name: "collision_hash",
4071
3685
  type: "string"
3686
+ },
3687
+ {
3688
+ name: "sender",
3689
+ type: "pubkey"
3690
+ },
3691
+ {
3692
+ name: "country",
3693
+ type: "u8"
4072
3694
  }
4073
3695
  ]
4074
3696
  }
4075
3697
  },
4076
3698
  {
4077
- name: "Lock",
3699
+ name: "RemoveInvestorEvent",
4078
3700
  type: {
4079
3701
  kind: "struct",
4080
3702
  fields: [
4081
3703
  {
4082
- name: "value",
4083
- docs: [
4084
- "Amount of tokens to lock."
4085
- ],
4086
- type: "u64"
3704
+ name: "investor_id",
3705
+ type: "string"
4087
3706
  },
4088
3707
  {
4089
- name: "release_time",
4090
- docs: [
4091
- "Timestamp from which the lock will be inactive. If value is 0, the lock",
4092
- "will remain active until removed."
4093
- ],
4094
- type: "i64"
3708
+ name: "sender",
3709
+ type: "pubkey"
3710
+ }
3711
+ ]
3712
+ }
3713
+ },
3714
+ {
3715
+ name: "RemoveLevelsEvent",
3716
+ type: {
3717
+ kind: "struct",
3718
+ fields: [
3719
+ {
3720
+ name: "investor_id",
3721
+ type: "string"
4095
3722
  },
4096
3723
  {
4097
- name: "reason_code",
4098
- docs: [
4099
- "Reason code for locking."
4100
- ],
4101
- type: "u64"
3724
+ name: "sender",
3725
+ type: "pubkey"
4102
3726
  },
4103
3727
  {
4104
- name: "reason_string",
4105
- docs: [
4106
- "Detailed reason for the lock. Since string has no length limit, we calculate",
4107
- "total space needed dynamically at time of resizing."
4108
- ],
4109
- type: "string"
3728
+ name: "levels",
3729
+ type: "bytes"
4110
3730
  }
4111
3731
  ]
4112
3732
  }
4113
3733
  }
4114
3734
  ];
4115
- var token_locks = {
3735
+ var rwa_imr = {
4116
3736
  address: address,
4117
3737
  metadata: metadata,
4118
3738
  instructions: instructions,
4119
3739
  accounts: accounts,
3740
+ events: events,
4120
3741
  errors: errors,
4121
3742
  types: types
4122
3743
  };
4123
3744
 
4124
- var tokenLocksIdl = /*#__PURE__*/Object.freeze({
3745
+ var imrIDL = /*#__PURE__*/Object.freeze({
4125
3746
  __proto__: null,
4126
3747
  address: address,
4127
3748
  metadata: metadata,
4128
3749
  instructions: instructions,
4129
3750
  accounts: accounts,
3751
+ events: events,
4130
3752
  errors: errors,
4131
3753
  types: types,
4132
- 'default': token_locks
3754
+ 'default': rwa_imr
4133
3755
  });
4134
3756
 
4135
3757
  var AdminFlags;
@@ -4139,7 +3761,8 @@ var AdminFlags;
4139
3761
  AdminFlags[AdminFlags["MODIFY_USER_ROLE"] = 2] = "MODIFY_USER_ROLE";
4140
3762
  AdminFlags[AdminFlags["ASSIGN_OR_REMOVE_ANY_USER_ROLE"] = 4] = "ASSIGN_OR_REMOVE_ANY_USER_ROLE";
4141
3763
  AdminFlags[AdminFlags["ASSIGN_OR_REMOVE_CURRENT_ROLE"] = 8] = "ASSIGN_OR_REMOVE_CURRENT_ROLE";
4142
- AdminFlags[AdminFlags["ALL"] = 15] = "ALL";
3764
+ AdminFlags[AdminFlags["SET_LUT_ADDRESS"] = 16] = "SET_LUT_ADDRESS";
3765
+ AdminFlags[AdminFlags["ALL"] = 31] = "ALL";
4143
3766
  })(AdminFlags || (AdminFlags = {}));
4144
3767
  var MediciFlags;
4145
3768
  (function (MediciFlags) {
@@ -4174,7 +3797,8 @@ var MediciFlags;
4174
3797
  MediciFlags[MediciFlags["CHANGE_COUNTRY"] = 134217728] = "CHANGE_COUNTRY";
4175
3798
  MediciFlags[MediciFlags["CHANGE_MAPPING"] = 268435456] = "CHANGE_MAPPING";
4176
3799
  MediciFlags[MediciFlags["CHANGE_ISSUANCE_POLICIES"] = 536870912] = "CHANGE_ISSUANCE_POLICIES";
4177
- MediciFlags[MediciFlags["ALL"] = 1073741823] = "ALL";
3800
+ MediciFlags[MediciFlags["REMOVE_IDENTITY_ACCOUNT"] = 1073741824] = "REMOVE_IDENTITY_ACCOUNT";
3801
+ MediciFlags[MediciFlags["ALL"] = 2147483647] = "ALL";
4178
3802
  })(MediciFlags || (MediciFlags = {}));
4179
3803
 
4180
3804
  /******************************************************************************
@@ -4300,6 +3924,7 @@ class AssetController {
4300
3924
  associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
4301
3925
  systemProgram: SystemProgram.programId,
4302
3926
  walletIdentityAccount: getWalletIdentityAccountPda(args.assetMint, args.wallet),
3927
+ eventAuthority: getAssetControllerEventAuthority(),
4303
3928
  })
4304
3929
  .instruction();
4305
3930
  });
@@ -4423,6 +4048,7 @@ class AssetController {
4423
4048
  tokenProgram: TOKEN_2022_PROGRAM_ID,
4424
4049
  associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
4425
4050
  systemProgram: SystemProgram.programId,
4051
+ eventAuthority: getAssetControllerEventAuthority(),
4426
4052
  })
4427
4053
  .instruction();
4428
4054
  });
@@ -4506,6 +4132,7 @@ class AssetController {
4506
4132
  sourceTokenAccount: getAssociatedTokenAddressSync(new PublicKey(args.assetMint), new PublicKey(args.from), false, TOKEN_2022_PROGRAM_ID),
4507
4133
  destinationTokenAccount: getAssociatedTokenAddressSync(new PublicKey(args.assetMint), new PublicKey(args.to), true, TOKEN_2022_PROGRAM_ID),
4508
4134
  tokenProgram: TOKEN_2022_PROGRAM_ID,
4135
+ eventAuthority: getAssetControllerEventAuthority(),
4509
4136
  })
4510
4137
  .remainingAccounts([
4511
4138
  {
@@ -4600,6 +4227,7 @@ class PolicyEngine {
4600
4227
  policyEngineProgram: policyEngineProgramId,
4601
4228
  policyEngine: getPolicyEnginePda(args.assetMint),
4602
4229
  systemProgram: SystemProgram.programId,
4230
+ eventAuthority: getPolicyEngineEventAuthority(),
4603
4231
  })
4604
4232
  .instruction();
4605
4233
  });
@@ -4627,6 +4255,7 @@ class PolicyEngine {
4627
4255
  policyEngineProgram: policyEngineProgramId,
4628
4256
  policyEngine: getPolicyEnginePda(args.assetMint),
4629
4257
  systemProgram: SystemProgram.programId,
4258
+ eventAuthority: getPolicyEngineEventAuthority(),
4630
4259
  })
4631
4260
  .instruction();
4632
4261
  });
@@ -4654,6 +4283,7 @@ class PolicyEngine {
4654
4283
  policyEngineProgram: policyEngineProgramId,
4655
4284
  policyEngine: getPolicyEnginePda(args.assetMint),
4656
4285
  systemProgram: SystemProgram.programId,
4286
+ eventAuthority: getPolicyEngineEventAuthority(),
4657
4287
  })
4658
4288
  .instruction();
4659
4289
  });
@@ -4680,6 +4310,7 @@ class PolicyEngine {
4680
4310
  authorizedUserRole: authorizedUserRole || null,
4681
4311
  policyEngineProgram: policyEngineProgramId,
4682
4312
  policyEngine: getPolicyEnginePda(args.assetMint),
4313
+ eventAuthority: getPolicyEngineEventAuthority(),
4683
4314
  })
4684
4315
  .instruction();
4685
4316
  });
@@ -4707,6 +4338,7 @@ class PolicyEngine {
4707
4338
  policyEngineProgram: policyEngineProgramId,
4708
4339
  policyEngine: getPolicyEnginePda(args.assetMint),
4709
4340
  systemProgram: SystemProgram.programId,
4341
+ eventAuthority: getPolicyEngineEventAuthority(),
4710
4342
  })
4711
4343
  .instruction();
4712
4344
  });
@@ -4732,6 +4364,7 @@ class PolicyEngine {
4732
4364
  authorizedUserRole: authorizedUserRole || null,
4733
4365
  policyEngineProgram: policyEngineProgramId,
4734
4366
  policyEngine: getPolicyEnginePda(args.assetMint),
4367
+ eventAuthority: getPolicyEngineEventAuthority(),
4735
4368
  })
4736
4369
  .instruction();
4737
4370
  });
@@ -4757,6 +4390,7 @@ class PolicyEngine {
4757
4390
  authorizedUserRole: authorizedUserRole || null,
4758
4391
  policyEngineProgram: policyEngineProgramId,
4759
4392
  policyEngine: getPolicyEnginePda(args.assetMint),
4393
+ eventAuthority: getPolicyEngineEventAuthority(),
4760
4394
  })
4761
4395
  .instruction();
4762
4396
  });
@@ -4850,6 +4484,7 @@ class IdentityRegistry {
4850
4484
  identityAccount,
4851
4485
  walletIdentity: getWalletIdentityAccountPda(args.assetMint, args.owner),
4852
4486
  systemProgram: SystemProgram.programId,
4487
+ eventAuthority: getIdentityRegistryEventAuthority(),
4853
4488
  })
4854
4489
  .instruction());
4855
4490
  returnIxs.push(trackerAccountIx);
@@ -4859,6 +4494,41 @@ class IdentityRegistry {
4859
4494
  };
4860
4495
  });
4861
4496
  }
4497
+ /**
4498
+ * Asynchronously generates instructions to remove a non-investor user with an identity account.
4499
+ * @param args - {@link SetupUserArgs}
4500
+ * @param authority - RBAC AssetAccessController ControllerAuthority.
4501
+ * @param assetAccessController - RBAC AssetAccessController account.
4502
+ * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4503
+ * @returns A Promise that resolves to the instructions to setup a user.
4504
+ *
4505
+ * It is required for at least a single user to be setup before issuing tokens.
4506
+ */
4507
+ removeUserIxn(args, assetAccessController, authorizedUserRole) {
4508
+ return __awaiter(this, void 0, void 0, function* () {
4509
+ const ix = yield this.rwaClient.identityRegistry.revokeIdentityAccount(args);
4510
+ const identityAccountAddress = getIdentityAccountPda(args.assetMint, args.owner);
4511
+ const identityAccount = yield getIdentityAccount(identityAccountAddress, this.rwaClient.provider);
4512
+ const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
4513
+ const returnIx = yield this.rbacProgram.methods
4514
+ .removeIdentityAccount(ix.data)
4515
+ .accountsStrict({
4516
+ payer: args.payer,
4517
+ user: args.signer,
4518
+ controllerAuthority,
4519
+ assetAccessController,
4520
+ authorizedUserRole: authorizedUserRole || null,
4521
+ identityRegistryProgram: identityRegistryProgramId,
4522
+ identityRegistry: getIdentityRegistryPda(args.assetMint),
4523
+ identityAccount: identityAccountAddress,
4524
+ walletIdentity: getWalletIdentityAccountPda(args.assetMint, args.owner),
4525
+ eventAuthority: getIdentityRegistryEventAuthority(),
4526
+ identityOwner: identityAccount.owner,
4527
+ })
4528
+ .instruction();
4529
+ return returnIx;
4530
+ });
4531
+ }
4862
4532
  /**
4863
4533
  * Asynchronously update a non-investor user identity account level.
4864
4534
  * @param args - {@link AddLevelToIdentityAccountArgs}
@@ -4888,6 +4558,7 @@ class IdentityRegistry {
4888
4558
  policyEngine: getPolicyEnginePda(args.assetMint),
4889
4559
  trackerAccount: getTrackerAccountPda(args.assetMint, args.owner),
4890
4560
  assetMint: args.assetMint,
4561
+ eventAuthority: getIdentityRegistryEventAuthority(),
4891
4562
  })
4892
4563
  .instruction();
4893
4564
  });
@@ -4922,6 +4593,7 @@ class IdentityRegistry {
4922
4593
  policyEngine: getPolicyEnginePda(args.assetMint),
4923
4594
  trackerAccount: getTrackerAccountPda(args.assetMint, args.owner),
4924
4595
  assetMint: args.assetMint,
4596
+ eventAuthority: getIdentityRegistryEventAuthority(),
4925
4597
  })
4926
4598
  .instruction();
4927
4599
  });
@@ -4988,6 +4660,8 @@ class IdentityRegistry {
4988
4660
  assetMint: args.assetMint,
4989
4661
  walletIdentity,
4990
4662
  systemProgram: SystemProgram.programId,
4663
+ eventAuthority: getIdentityRegistryEventAuthority(),
4664
+ program: identityRegistryProgramId,
4991
4665
  })
4992
4666
  .instruction();
4993
4667
  return this.rbacProgram.methods
@@ -5004,6 +4678,7 @@ class IdentityRegistry {
5004
4678
  assetMint: args.assetMint,
5005
4679
  walletIdentity,
5006
4680
  systemProgram: SystemProgram.programId,
4681
+ eventAuthority: getIdentityRegistryEventAuthority(),
5007
4682
  })
5008
4683
  .instruction();
5009
4684
  });
@@ -5030,6 +4705,8 @@ class IdentityRegistry {
5030
4705
  walletIdentity,
5031
4706
  identityAccount,
5032
4707
  identityRegistry,
4708
+ eventAuthority: getIdentityRegistryEventAuthority(),
4709
+ program: identityRegistryProgramId,
5033
4710
  })
5034
4711
  .instruction();
5035
4712
  return this.rbacProgram.methods
@@ -5044,6 +4721,7 @@ class IdentityRegistry {
5044
4721
  walletIdentity,
5045
4722
  identityAccount,
5046
4723
  identityRegistry,
4724
+ eventAuthority: getIdentityRegistryEventAuthority(),
5047
4725
  })
5048
4726
  .instruction();
5049
4727
  });
@@ -5059,6 +4737,27 @@ class IdentityMetadataRegistry {
5059
4737
  this.rbacProgram = rbacProgram;
5060
4738
  this.imrProgram = imrProgram;
5061
4739
  }
4740
+ /**
4741
+ * Parses inner instructions data field for array of events emitted by program using CPI Events.
4742
+ * @param ixs - Array of CompiledInstruction from a transaction inner instructions.
4743
+ * @returns Array of Events
4744
+ * */
4745
+ parseEvents(ixs) {
4746
+ const eventCoder = this.imrProgram.coder.events;
4747
+ const events = ixs
4748
+ .map(({ data }) => {
4749
+ try {
4750
+ const buffer = Buffer.from(utils.bytes.bs58.decode(data));
4751
+ const event = eventCoder.decode(utils.bytes.base64.encode(buffer.slice(8)));
4752
+ return event;
4753
+ }
4754
+ catch (err) {
4755
+ console.error("Error decoding events", err);
4756
+ }
4757
+ })
4758
+ .filter((v) => v != null);
4759
+ return events;
4760
+ }
5062
4761
  /**
5063
4762
  * Asynchronously generates instructions to setup an investor.
5064
4763
  * @param args - {@link SetupInvestorArgs}
@@ -5090,6 +4789,9 @@ class IdentityMetadataRegistry {
5090
4789
  walletIdentity: getWalletIdentityAccountPda(args.assetMint, investor.toString() // Investor is owner of IdentityAccount
5091
4790
  ),
5092
4791
  systemProgram: SystemProgram.programId,
4792
+ eventAuthority: getEventAuthority(IMR_PROGRAM),
4793
+ eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
4794
+ program: identityRegistryProgramId,
5093
4795
  })
5094
4796
  .instruction();
5095
4797
  returnIxs.push(yield this.rbacProgram.methods
@@ -5107,6 +4809,8 @@ class IdentityMetadataRegistry {
5107
4809
  identityAccount,
5108
4810
  walletIdentity: getWalletIdentityAccountPda(args.assetMint, investor.toString()),
5109
4811
  systemProgram: SystemProgram.programId,
4812
+ eventAuthorityIdentityMetadataRegistry: getEventAuthority(IMR_PROGRAM),
4813
+ eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
5110
4814
  })
5111
4815
  .instruction());
5112
4816
  const policyProgram = getPolicyEngineProgram(this.imrProgram.provider);
@@ -5171,6 +4875,9 @@ class IdentityMetadataRegistry {
5171
4875
  policyEngine: getPolicyEnginePda(args.assetMint),
5172
4876
  trackerAccount,
5173
4877
  assetMint: args.assetMint,
4878
+ eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
4879
+ eventAuthority: getEventAuthority(IMR_PROGRAM),
4880
+ program: IMR_PROGRAM,
5174
4881
  })
5175
4882
  .instruction();
5176
4883
  return this.rbacProgram.methods
@@ -5191,6 +4898,8 @@ class IdentityMetadataRegistry {
5191
4898
  policyEngine: getPolicyEnginePda(args.assetMint),
5192
4899
  trackerAccount,
5193
4900
  assetMint: args.assetMint,
4901
+ eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
4902
+ eventAuthorityIdentityMetadataRegistry: getEventAuthority(IMR_PROGRAM),
5194
4903
  })
5195
4904
  .instruction();
5196
4905
  });
@@ -5223,6 +4932,7 @@ class IdentityMetadataRegistry {
5223
4932
  policyEngine: getPolicyEnginePda(args.assetMint),
5224
4933
  trackerAccount,
5225
4934
  assetMint: args.assetMint,
4935
+ eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
5226
4936
  })
5227
4937
  .instruction();
5228
4938
  return this.rbacProgram.methods
@@ -5242,6 +4952,7 @@ class IdentityMetadataRegistry {
5242
4952
  policyEngine: getPolicyEnginePda(args.assetMint),
5243
4953
  trackerAccount,
5244
4954
  assetMint: args.assetMint,
4955
+ eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
5245
4956
  })
5246
4957
  .instruction();
5247
4958
  });
@@ -5275,6 +4986,7 @@ class IdentityMetadataRegistry {
5275
4986
  policyEngine: getPolicyEnginePda(args.assetMint),
5276
4987
  trackerAccount,
5277
4988
  assetMint: args.assetMint,
4989
+ eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
5278
4990
  })
5279
4991
  .instruction();
5280
4992
  return this.rbacProgram.methods
@@ -5295,6 +5007,7 @@ class IdentityMetadataRegistry {
5295
5007
  policyEngine: getPolicyEnginePda(args.assetMint),
5296
5008
  trackerAccount,
5297
5009
  assetMint: args.assetMint,
5010
+ eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
5298
5011
  })
5299
5012
  .instruction();
5300
5013
  });
@@ -5328,6 +5041,8 @@ class IdentityMetadataRegistry {
5328
5041
  walletIdentity: getWalletIdentityAccountPda(args.assetMint, investor.toString()),
5329
5042
  policyEngineProgram: policyEngineProgramId,
5330
5043
  trackerAccount: getTrackerAccountPda(args.assetMint, investor.toString()),
5044
+ eventAuthorityIdentityMetadataRegistry: getEventAuthority(IMR_PROGRAM),
5045
+ eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
5331
5046
  })
5332
5047
  .instruction();
5333
5048
  });
@@ -5354,266 +5069,13 @@ class IdentityMetadataRegistry {
5354
5069
  identityRegistry,
5355
5070
  assetMint: args.assetMint,
5356
5071
  systemProgram: SystemProgram.programId,
5072
+ eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
5357
5073
  })
5358
5074
  .instruction();
5359
5075
  });
5360
5076
  }
5361
5077
  }
5362
5078
 
5363
- /**
5364
- * Role-based access client for accessing Token Locks
5365
- */
5366
- class TokenLocks {
5367
- constructor(rwaClient, rbacProgram, tokenLocksProgram) {
5368
- this.rwaClient = rwaClient;
5369
- this.rbacProgram = rbacProgram;
5370
- this.tokenLocksProgram = tokenLocksProgram;
5371
- }
5372
- /**
5373
- * Asynchronously create InvestorLocks account for a wallet.
5374
- * @param args - {@link CreateOrCloseInvestorLocksArgs}
5375
- * @param assetAccessController - RBAC AssetAccessController account.
5376
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
5377
- * @returns A Promise that resolves to a transaction instruction.
5378
- * */
5379
- createInvestorLocks(args, assetAccessController, authorizedUserRole) {
5380
- return __awaiter(this, void 0, void 0, function* () {
5381
- const identityRegistry = getIdentityRegistryPda(args.assetMint);
5382
- const investor = deriveInvestorPda(args.investorId, identityRegistry);
5383
- return this.rbacProgram.methods
5384
- .createInvestorLocks()
5385
- .accountsStrict({
5386
- payer: args.payer,
5387
- user: args.signer,
5388
- controllerAuthority: deriveControllerAuthorityPda(assetAccessController),
5389
- assetAccessController,
5390
- authorizedUserRole: authorizedUserRole || null,
5391
- tokenLocksProgram: TL_PROGRAM,
5392
- investorLocks: deriveInvestorLocks(args.investorId, identityRegistry),
5393
- investor,
5394
- identityAccount: getIdentityAccountPda(args.assetMint, investor.toString()),
5395
- assetMint: args.assetMint,
5396
- lockedTokenAccount: deriveLockedTokenAccount(args.investorId, identityRegistry),
5397
- assetController: getAssetControllerPda(args.assetMint),
5398
- assetControllerProgram: assetControllerProgramId,
5399
- tokenProgram: TOKEN_2022_PROGRAM_ID,
5400
- systemProgram: SystemProgram.programId,
5401
- })
5402
- .instruction();
5403
- });
5404
- }
5405
- /**
5406
- * Asynchronously close InvestorLocks account for a wallet.
5407
- * @param args - {@link CreateOrCloseInvestorLocksArgs}
5408
- * @param assetAccessController - RBAC AssetAccessController account.
5409
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
5410
- * @returns A Promise that resolves to a transaction instruction.
5411
- * */
5412
- closeInvestorLocks(args, assetAccessController, authorizedUserRole) {
5413
- return __awaiter(this, void 0, void 0, function* () {
5414
- const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
5415
- const identityRegistry = getIdentityRegistryPda(args.assetMint);
5416
- return this.rbacProgram.methods
5417
- .closeInvestorLocks()
5418
- .accountsStrict({
5419
- payer: args.payer,
5420
- user: args.signer,
5421
- controllerAuthority,
5422
- assetAccessController,
5423
- authorizedUserRole: authorizedUserRole || null,
5424
- tokenLocksProgram: TL_PROGRAM,
5425
- investorLocks: deriveInvestorLocks(args.investorId, identityRegistry),
5426
- investor: deriveInvestorPda(args.investorId, identityRegistry),
5427
- systemProgram: SystemProgram.programId,
5428
- tokenProgram: TOKEN_2022_PROGRAM_ID,
5429
- lockedTokenAccount: deriveLockedTokenAccount(args.investorId, identityRegistry),
5430
- })
5431
- .instruction();
5432
- });
5433
- }
5434
- /**
5435
- * Asynchronously add a lock to InvestorLocks.
5436
- * @param args - {@link AddTokenLockArgs}
5437
- * @param assetAccessController - RBAC AssetAccessController account.
5438
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
5439
- * @returns A Promise that resolves to a transaction instruction.
5440
- * */
5441
- addTokenLock(args, assetAccessController, authorizedUserRole) {
5442
- return __awaiter(this, void 0, void 0, function* () {
5443
- const assetController = getAssetControllerPda(args.assetMint);
5444
- const identityRegistry = getIdentityRegistryPda(args.assetMint);
5445
- const investorLocks = deriveInvestorLocks(args.investorId, identityRegistry);
5446
- const investor = deriveInvestorPda(args.investorId, identityRegistry);
5447
- const unlockedTokenAccount = getAssociatedTokenAddressSync(new PublicKey(args.assetMint), args.wallet, false, TOKEN_2022_PROGRAM_ID);
5448
- const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
5449
- const ix = yield this.tokenLocksProgram.methods
5450
- .addTokenLock(args.value, args.releaseTime, args.reasonCode, args.reasonString)
5451
- .accountsStrict({
5452
- payer: args.payer,
5453
- authority: controllerAuthority,
5454
- investorLocks,
5455
- investor,
5456
- assetMint: args.assetMint,
5457
- identityAccount: getIdentityAccountPda(args.assetMint, investor.toString()),
5458
- unlockedTokenAccount,
5459
- lockedTokenAccount: deriveLockedTokenAccount(args.investorId, identityRegistry),
5460
- assetController,
5461
- assetControllerProgram: assetControllerProgramId,
5462
- tokenProgram: TOKEN_2022_PROGRAM_ID,
5463
- identityRegistry: getIdentityRegistryPda(args.assetMint),
5464
- systemProgram: SystemProgram.programId,
5465
- walletIdentityAccount: getWalletIdentityAccountPda(args.assetMint, args.wallet.toString()),
5466
- })
5467
- .instruction();
5468
- return this.rbacProgram.methods
5469
- .addTokenLock(ix.data)
5470
- .accountsStrict({
5471
- payer: args.payer,
5472
- user: args.signer,
5473
- controllerAuthority,
5474
- assetAccessController,
5475
- authorizedUserRole: authorizedUserRole || null,
5476
- tokenLocksProgram: TL_PROGRAM,
5477
- investorLocks,
5478
- investor,
5479
- assetMint: args.assetMint,
5480
- unlockedTokenAccount,
5481
- lockedTokenAccount: deriveLockedTokenAccount(args.investorId, identityRegistry),
5482
- assetController,
5483
- identityRegistry: getIdentityRegistryPda(args.assetMint),
5484
- assetControllerProgram: assetControllerProgramId,
5485
- tokenProgram: TOKEN_2022_PROGRAM_ID,
5486
- systemProgram: SystemProgram.programId,
5487
- identityAccount: getIdentityAccountPda(args.assetMint, investor.toString()),
5488
- walletIdentityAccount: getWalletIdentityAccountPda(args.assetMint, args.wallet.toString()),
5489
- })
5490
- .remainingAccounts([
5491
- {
5492
- pubkey: getPolicyEnginePda(args.assetMint),
5493
- isWritable: true,
5494
- isSigner: false,
5495
- },
5496
- {
5497
- pubkey: identityRegistryProgramId,
5498
- isWritable: false,
5499
- isSigner: false,
5500
- },
5501
- {
5502
- pubkey: policyEngineProgramId,
5503
- isWritable: false,
5504
- isSigner: false,
5505
- },
5506
- {
5507
- pubkey: getIdentityRegistryPda(args.assetMint),
5508
- isWritable: false,
5509
- isSigner: false,
5510
- },
5511
- {
5512
- pubkey: getTrackerAccountPda(args.assetMint, investor.toString()),
5513
- isWritable: true,
5514
- isSigner: false,
5515
- },
5516
- {
5517
- pubkey: getExtraMetasListPda(args.assetMint),
5518
- isWritable: false,
5519
- isSigner: false,
5520
- },
5521
- {
5522
- pubkey: getWalletIdentityAccountPda(args.assetMint, investor.toString()),
5523
- isWritable: false,
5524
- isSigner: false,
5525
- },
5526
- ])
5527
- .instruction();
5528
- });
5529
- }
5530
- /**
5531
- * Asynchronously remove a lock from InvestorLocks using RBAC authority.
5532
- * @param args - {@link RemoveTokenLockArgs}
5533
- * @param assetAccessController - RBAC AssetAccessController account.
5534
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
5535
- * @returns A Promise that resolves to a transaction instruction.
5536
- * */
5537
- removeTokenLock(args, assetAccessController, authorizedUserRole) {
5538
- return __awaiter(this, void 0, void 0, function* () {
5539
- const assetController = getAssetControllerPda(args.assetMint);
5540
- const identityRegistry = getIdentityRegistryPda(args.assetMint);
5541
- const investorLocks = deriveInvestorLocks(args.investorId, identityRegistry);
5542
- const investor = deriveInvestorPda(args.investorId, identityRegistry);
5543
- const unlockedTokenAccount = getAssociatedTokenAddressSync(new PublicKey(args.assetMint), args.wallet, false, TOKEN_2022_PROGRAM_ID);
5544
- const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
5545
- return this.rbacProgram.methods
5546
- .removeTokenLock(Buffer.from(args.indices))
5547
- .accountsStrict({
5548
- user: args.signer,
5549
- controllerAuthority,
5550
- assetAccessController,
5551
- authorizedUserRole: authorizedUserRole || null,
5552
- tokenLocksProgram: TL_PROGRAM,
5553
- investorLocks,
5554
- investor,
5555
- identityAccount: getIdentityAccountPda(args.assetMint, investor.toString()),
5556
- walletIdentityAccount: getWalletIdentityAccountPda(args.assetMint, args.wallet.toString()),
5557
- assetMint: args.assetMint,
5558
- unlockedTokenAccount,
5559
- lockedTokenAccount: deriveLockedTokenAccount(args.investorId, identityRegistry),
5560
- assetController,
5561
- identityRegistry: getIdentityRegistryPda(args.assetMint),
5562
- assetControllerProgram: assetControllerProgramId,
5563
- tokenProgram: TOKEN_2022_PROGRAM_ID,
5564
- })
5565
- .remainingAccounts([
5566
- {
5567
- pubkey: getPolicyEnginePda(args.assetMint),
5568
- isWritable: true,
5569
- isSigner: false,
5570
- },
5571
- {
5572
- pubkey: identityRegistryProgramId,
5573
- isWritable: false,
5574
- isSigner: false,
5575
- },
5576
- {
5577
- pubkey: policyEngineProgramId,
5578
- isWritable: false,
5579
- isSigner: false,
5580
- },
5581
- {
5582
- pubkey: getIdentityRegistryPda(args.assetMint),
5583
- isWritable: false,
5584
- isSigner: false,
5585
- },
5586
- {
5587
- pubkey: getTrackerAccountPda(args.assetMint, investor.toString()),
5588
- isWritable: true,
5589
- isSigner: false,
5590
- },
5591
- {
5592
- pubkey: getExtraMetasListPda(args.assetMint),
5593
- isWritable: false,
5594
- isSigner: false,
5595
- },
5596
- {
5597
- pubkey: getWalletIdentityAccountPda(args.assetMint, investor.toString()),
5598
- isWritable: false,
5599
- isSigner: false,
5600
- },
5601
- ])
5602
- .instruction();
5603
- });
5604
- }
5605
- /**
5606
- * Asynchronously fetches a token account.
5607
- * @param account - Account to load.
5608
- * @returns A Promise that resolves to a token account.
5609
- * */
5610
- fetchTokenAccount(account_1) {
5611
- return __awaiter(this, arguments, void 0, function* (account, commitment = "processed") {
5612
- return getAccount(this.rwaClient.provider.connection, account, commitment, TOKEN_2022_PROGRAM_ID);
5613
- });
5614
- }
5615
- }
5616
-
5617
5079
  class RwaRbacClient {
5618
5080
  constructor(config, provider) {
5619
5081
  this.rwaClient = new RwaClient(config, provider);
@@ -5623,7 +5085,27 @@ class RwaRbacClient {
5623
5085
  this.policyEngine = new PolicyEngine(this.rwaClient, this.rbacProgram);
5624
5086
  this.identityRegistry = new IdentityRegistry(this.rwaClient, this.rbacProgram);
5625
5087
  this.identityMetadataRegistry = new IdentityMetadataRegistry(this.rwaClient, this.rbacProgram, new Program(imrIDL, this.provider));
5626
- this.tokenLocks = new TokenLocks(this.rwaClient, this.rbacProgram, new Program(tokenLocksIdl, this.provider));
5088
+ }
5089
+ /**
5090
+ * Parses inner instructions data field for array of events emitted by program using CPI Events.
5091
+ * @param ixs - Array of CompiledInstruction from a transaction inner instructions.
5092
+ * @returns Array of Events
5093
+ * */
5094
+ parseEvents(ixs) {
5095
+ const eventCoder = this.rbacProgram.coder.events;
5096
+ const events = ixs
5097
+ .map(({ data }) => {
5098
+ try {
5099
+ const buffer = Buffer.from(utils.bytes.bs58.decode(data));
5100
+ const event = eventCoder.decode(utils.bytes.base64.encode(buffer.slice(8)));
5101
+ return event;
5102
+ }
5103
+ catch (err) {
5104
+ console.error("Error decoding events", err);
5105
+ }
5106
+ })
5107
+ .filter((v) => v != null);
5108
+ return events;
5627
5109
  }
5628
5110
  /**
5629
5111
  * Asynchronously generates instruction to create AssetAccessController for an organization.
@@ -5734,6 +5216,8 @@ class RwaRbacClient {
5734
5216
  authorizedUserRole: args.authorizedUserRole || null,
5735
5217
  assetAccessController: args.assetAccessController,
5736
5218
  systemProgram: SystemProgram.programId,
5219
+ eventAuthority: getEventAuthority(RBAC_PROGRAM),
5220
+ program: RBAC_PROGRAM,
5737
5221
  })
5738
5222
  .instruction();
5739
5223
  });
@@ -5752,6 +5236,8 @@ class RwaRbacClient {
5752
5236
  userRole: args.userRole,
5753
5237
  authorizedUserRole: args.authorizedUserRole || null,
5754
5238
  assetAccessController: args.assetAccessController,
5239
+ eventAuthority: getEventAuthority(RBAC_PROGRAM),
5240
+ program: RBAC_PROGRAM,
5755
5241
  })
5756
5242
  .instruction();
5757
5243
  });
@@ -5775,6 +5261,24 @@ class RwaRbacClient {
5775
5261
  .instruction();
5776
5262
  });
5777
5263
  }
5264
+ /**
5265
+ * Asynchronously generates instruction to set lookup table address field in the AssetAccessController.
5266
+ * @param args - {@link SetLookuptableAddressArgs}
5267
+ * @returns A Promise that resolves to the instruction to set lookup table address.
5268
+ */
5269
+ setLookuptableAddressIxn(args) {
5270
+ return __awaiter(this, void 0, void 0, function* () {
5271
+ return this.rbacProgram.methods
5272
+ .setLutAddress()
5273
+ .accountsStrict({
5274
+ user: args.signer,
5275
+ assetAccessController: args.assetAccessController,
5276
+ authorizedUserRole: args.authorizedUserRole || null,
5277
+ lutAddress: args.lutAddress,
5278
+ })
5279
+ .instruction();
5280
+ });
5281
+ }
5778
5282
  }
5779
5283
 
5780
5284
  /**
@@ -5785,4 +5289,4 @@ const computeFlags = (...flags) => {
5785
5289
  return flags.reduce((accumulator, flag) => accumulator | flag, 0);
5786
5290
  };
5787
5291
 
5788
- export { AdminFlags, AssetController, IMR_PROGRAM, IdentityMetadataRegistry, IdentityRegistry, MediciFlags, PolicyEngine, RBAC_PROGRAM, rwa_imr as RwaImrIdl, RwaRbacClient, rwa_rbac as RwaRbacIdl, TL_PROGRAM, TokenLocks, token_locks as TokenLocksIdl, computeFlags, deriveAssetAccessControllerPda, deriveControllerAuthorityPda, deriveInvestorLocks, deriveInvestorPda, deriveLockedTokenAccount, deriveUserRolePda };
5292
+ export { AdminFlags, AssetController, IMR_PROGRAM, IdentityMetadataRegistry, IdentityRegistry, MediciFlags, PolicyEngine, RBAC_PROGRAM, rwa_imr as RwaImrIdl, RwaRbacClient, rwa_rbac as RwaRbacIdl, TL_PROGRAM, computeFlags, deriveAssetAccessControllerPda, deriveControllerAuthorityPda, deriveInvestorLocks, deriveInvestorPda, deriveLockedTokenAccount, deriveUserRolePda, getEventAuthority };