@dstoken-solana/rwa-rbac 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -45,15 +45,16 @@ const deriveUserRolePda = (id, assetAccessController, programId = RBAC_PROGRAM)
45
45
  Buffer.from("UserRole"),
46
46
  ], programId)[0];
47
47
  };
48
+ const getEventAuthority = (programId) => web3_js.PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], programId)[0];
48
49
 
49
- var address$2 = "3g6fUgMsJQhjPUYxNjEU5PyzGf8DerbDx8p5Qh4yMnRR";
50
- var metadata$2 = {
50
+ var address$1 = "3g6fUgMsJQhjPUYxNjEU5PyzGf8DerbDx8p5Qh4yMnRR";
51
+ var metadata$1 = {
51
52
  name: "rwa_rbac",
52
53
  version: "0.1.0",
53
54
  spec: "0.1.0",
54
55
  description: "Created with Anchor"
55
56
  };
56
- var instructions$2 = [
57
+ var instructions$1 = [
57
58
  {
58
59
  name: "add_level_to_identity_account",
59
60
  discriminator: [
@@ -126,6 +127,9 @@ var instructions$2 = [
126
127
  },
127
128
  {
128
129
  name: "asset_mint"
130
+ },
131
+ {
132
+ name: "event_authority"
129
133
  }
130
134
  ],
131
135
  args: [
@@ -216,6 +220,12 @@ var instructions$2 = [
216
220
  },
217
221
  {
218
222
  name: "asset_mint"
223
+ },
224
+ {
225
+ name: "event_authority_identity_metadata_registry"
226
+ },
227
+ {
228
+ name: "event_authority_identity_registry"
219
229
  }
220
230
  ],
221
231
  args: [
@@ -299,101 +309,6 @@ var instructions$2 = [
299
309
  }
300
310
  ]
301
311
  },
302
- {
303
- name: "add_token_lock",
304
- discriminator: [
305
- 195,
306
- 26,
307
- 109,
308
- 80,
309
- 46,
310
- 7,
311
- 195,
312
- 55
313
- ],
314
- accounts: [
315
- {
316
- name: "payer",
317
- writable: true,
318
- signer: true
319
- },
320
- {
321
- name: "user",
322
- signer: true
323
- },
324
- {
325
- name: "controller_authority",
326
- writable: true,
327
- relations: [
328
- "asset_access_controller"
329
- ]
330
- },
331
- {
332
- name: "asset_access_controller",
333
- relations: [
334
- "authorized_user_role"
335
- ]
336
- },
337
- {
338
- name: "authorized_user_role",
339
- optional: true
340
- },
341
- {
342
- name: "token_locks_program",
343
- address: "9bNt3ZiZpDdHqAt5Q1Wq6twFe5RKmMCwA7MJyK2HgGnU"
344
- },
345
- {
346
- name: "investor_locks",
347
- writable: true
348
- },
349
- {
350
- name: "investor"
351
- },
352
- {
353
- name: "wallet_identity_account"
354
- },
355
- {
356
- name: "identity_account"
357
- },
358
- {
359
- name: "asset_mint",
360
- writable: true
361
- },
362
- {
363
- name: "unlocked_token_account",
364
- writable: true
365
- },
366
- {
367
- name: "locked_token_account",
368
- writable: true
369
- },
370
- {
371
- name: "asset_controller"
372
- },
373
- {
374
- name: "identity_registry",
375
- writable: true
376
- },
377
- {
378
- name: "asset_controller_program",
379
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
380
- },
381
- {
382
- name: "token_program",
383
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
384
- },
385
- {
386
- name: "system_program",
387
- address: "11111111111111111111111111111111"
388
- }
389
- ],
390
- args: [
391
- {
392
- name: "cpi_data",
393
- type: "bytes"
394
- }
395
- ]
396
- },
397
312
  {
398
313
  name: "assign_user_role",
399
314
  discriminator: [
@@ -434,6 +349,38 @@ var instructions$2 = [
434
349
  {
435
350
  name: "system_program",
436
351
  address: "11111111111111111111111111111111"
352
+ },
353
+ {
354
+ name: "event_authority",
355
+ pda: {
356
+ seeds: [
357
+ {
358
+ kind: "const",
359
+ value: [
360
+ 95,
361
+ 95,
362
+ 101,
363
+ 118,
364
+ 101,
365
+ 110,
366
+ 116,
367
+ 95,
368
+ 97,
369
+ 117,
370
+ 116,
371
+ 104,
372
+ 111,
373
+ 114,
374
+ 105,
375
+ 116,
376
+ 121
377
+ ]
378
+ }
379
+ ]
380
+ }
381
+ },
382
+ {
383
+ name: "program"
437
384
  }
438
385
  ],
439
386
  args: [
@@ -494,6 +441,9 @@ var instructions$2 = [
494
441
  {
495
442
  name: "system_program",
496
443
  address: "11111111111111111111111111111111"
444
+ },
445
+ {
446
+ name: "event_authority"
497
447
  }
498
448
  ],
499
449
  args: [
@@ -562,6 +512,9 @@ var instructions$2 = [
562
512
  {
563
513
  name: "system_program",
564
514
  address: "11111111111111111111111111111111"
515
+ },
516
+ {
517
+ name: "event_authority"
565
518
  }
566
519
  ],
567
520
  args: [
@@ -620,6 +573,9 @@ var instructions$2 = [
620
573
  {
621
574
  name: "system_program",
622
575
  address: "11111111111111111111111111111111"
576
+ },
577
+ {
578
+ name: "event_authority"
623
579
  }
624
580
  ],
625
581
  args: [
@@ -678,6 +634,9 @@ var instructions$2 = [
678
634
  {
679
635
  name: "system_program",
680
636
  address: "11111111111111111111111111111111"
637
+ },
638
+ {
639
+ name: "event_authority"
681
640
  }
682
641
  ],
683
642
  args: [
@@ -756,6 +715,9 @@ var instructions$2 = [
756
715
  },
757
716
  {
758
717
  name: "asset_mint"
718
+ },
719
+ {
720
+ name: "event_authority_identity_registry"
759
721
  }
760
722
  ],
761
723
  args: [
@@ -810,6 +772,9 @@ var instructions$2 = [
810
772
  {
811
773
  name: "policy_engine",
812
774
  writable: true
775
+ },
776
+ {
777
+ name: "event_authority"
813
778
  }
814
779
  ],
815
780
  args: [
@@ -864,6 +829,9 @@ var instructions$2 = [
864
829
  {
865
830
  name: "policy_engine",
866
831
  writable: true
832
+ },
833
+ {
834
+ name: "event_authority"
867
835
  }
868
836
  ],
869
837
  args: [
@@ -873,70 +841,6 @@ var instructions$2 = [
873
841
  }
874
842
  ]
875
843
  },
876
- {
877
- name: "close_investor_locks",
878
- discriminator: [
879
- 255,
880
- 60,
881
- 220,
882
- 115,
883
- 217,
884
- 104,
885
- 157,
886
- 171
887
- ],
888
- accounts: [
889
- {
890
- name: "payer",
891
- writable: true,
892
- signer: true
893
- },
894
- {
895
- name: "user",
896
- signer: true
897
- },
898
- {
899
- name: "controller_authority",
900
- relations: [
901
- "asset_access_controller"
902
- ]
903
- },
904
- {
905
- name: "asset_access_controller",
906
- relations: [
907
- "authorized_user_role"
908
- ]
909
- },
910
- {
911
- name: "authorized_user_role",
912
- optional: true
913
- },
914
- {
915
- name: "token_locks_program",
916
- address: "9bNt3ZiZpDdHqAt5Q1Wq6twFe5RKmMCwA7MJyK2HgGnU"
917
- },
918
- {
919
- name: "investor_locks",
920
- writable: true
921
- },
922
- {
923
- name: "investor"
924
- },
925
- {
926
- name: "locked_token_account",
927
- writable: true
928
- },
929
- {
930
- name: "token_program"
931
- },
932
- {
933
- name: "system_program",
934
- address: "11111111111111111111111111111111"
935
- }
936
- ],
937
- args: [
938
- ]
939
- },
940
844
  {
941
845
  name: "close_mint_account",
942
846
  discriminator: [
@@ -1122,6 +1026,9 @@ var instructions$2 = [
1122
1026
  {
1123
1027
  name: "system_program",
1124
1028
  address: "11111111111111111111111111111111"
1029
+ },
1030
+ {
1031
+ name: "event_authority"
1125
1032
  }
1126
1033
  ],
1127
1034
  args: [
@@ -1132,16 +1039,16 @@ var instructions$2 = [
1132
1039
  ]
1133
1040
  },
1134
1041
  {
1135
- name: "create_investor_locks",
1042
+ name: "create_user_role",
1136
1043
  discriminator: [
1137
- 223,
1138
- 81,
1139
- 139,
1140
- 162,
1141
- 204,
1142
- 48,
1143
- 24,
1144
- 213
1044
+ 13,
1045
+ 20,
1046
+ 224,
1047
+ 42,
1048
+ 3,
1049
+ 120,
1050
+ 67,
1051
+ 23
1145
1052
  ],
1146
1053
  accounts: [
1147
1054
  {
@@ -1154,13 +1061,12 @@ var instructions$2 = [
1154
1061
  signer: true
1155
1062
  },
1156
1063
  {
1157
- name: "controller_authority",
1158
- relations: [
1159
- "asset_access_controller"
1160
- ]
1064
+ name: "new_user_role",
1065
+ writable: true
1161
1066
  },
1162
1067
  {
1163
1068
  name: "asset_access_controller",
1069
+ writable: true,
1164
1070
  relations: [
1165
1071
  "authorized_user_role"
1166
1072
  ]
@@ -1170,123 +1076,45 @@ var instructions$2 = [
1170
1076
  optional: true
1171
1077
  },
1172
1078
  {
1173
- name: "token_locks_program",
1174
- address: "9bNt3ZiZpDdHqAt5Q1Wq6twFe5RKmMCwA7MJyK2HgGnU"
1175
- },
1079
+ name: "system_program",
1080
+ address: "11111111111111111111111111111111"
1081
+ }
1082
+ ],
1083
+ args: [
1176
1084
  {
1177
- name: "investor_locks",
1178
- writable: true
1085
+ name: "name",
1086
+ type: "string"
1179
1087
  },
1180
1088
  {
1181
- name: "investor"
1089
+ name: "allowed_admin_ixs",
1090
+ type: "u64"
1182
1091
  },
1183
1092
  {
1184
- name: "identity_account"
1185
- },
1093
+ name: "allowed_medici_ixs",
1094
+ type: "u64"
1095
+ }
1096
+ ]
1097
+ },
1098
+ {
1099
+ name: "delete_user_role",
1100
+ discriminator: [
1101
+ 177,
1102
+ 139,
1103
+ 27,
1104
+ 46,
1105
+ 113,
1106
+ 250,
1107
+ 139,
1108
+ 225
1109
+ ],
1110
+ accounts: [
1186
1111
  {
1187
- name: "asset_mint",
1112
+ name: "receiver",
1188
1113
  writable: true
1189
1114
  },
1190
1115
  {
1191
- name: "locked_token_account",
1192
- writable: true
1193
- },
1194
- {
1195
- name: "asset_controller"
1196
- },
1197
- {
1198
- name: "asset_controller_program",
1199
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
1200
- },
1201
- {
1202
- name: "token_program",
1203
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
1204
- },
1205
- {
1206
- name: "system_program",
1207
- address: "11111111111111111111111111111111"
1208
- }
1209
- ],
1210
- args: [
1211
- ]
1212
- },
1213
- {
1214
- name: "create_user_role",
1215
- discriminator: [
1216
- 13,
1217
- 20,
1218
- 224,
1219
- 42,
1220
- 3,
1221
- 120,
1222
- 67,
1223
- 23
1224
- ],
1225
- accounts: [
1226
- {
1227
- name: "payer",
1228
- writable: true,
1229
- signer: true
1230
- },
1231
- {
1232
- name: "user",
1233
- signer: true
1234
- },
1235
- {
1236
- name: "new_user_role",
1237
- writable: true
1238
- },
1239
- {
1240
- name: "asset_access_controller",
1241
- writable: true,
1242
- relations: [
1243
- "authorized_user_role"
1244
- ]
1245
- },
1246
- {
1247
- name: "authorized_user_role",
1248
- optional: true
1249
- },
1250
- {
1251
- name: "system_program",
1252
- address: "11111111111111111111111111111111"
1253
- }
1254
- ],
1255
- args: [
1256
- {
1257
- name: "name",
1258
- type: "string"
1259
- },
1260
- {
1261
- name: "allowed_admin_ixs",
1262
- type: "u64"
1263
- },
1264
- {
1265
- name: "allowed_medici_ixs",
1266
- type: "u64"
1267
- }
1268
- ]
1269
- },
1270
- {
1271
- name: "delete_user_role",
1272
- discriminator: [
1273
- 177,
1274
- 139,
1275
- 27,
1276
- 46,
1277
- 113,
1278
- 250,
1279
- 139,
1280
- 225
1281
- ],
1282
- accounts: [
1283
- {
1284
- name: "receiver",
1285
- writable: true
1286
- },
1287
- {
1288
- name: "user",
1289
- signer: true
1116
+ name: "user",
1117
+ signer: true
1290
1118
  },
1291
1119
  {
1292
1120
  name: "asset_access_controller",
@@ -1356,6 +1184,9 @@ var instructions$2 = [
1356
1184
  {
1357
1185
  name: "system_program",
1358
1186
  address: "11111111111111111111111111111111"
1187
+ },
1188
+ {
1189
+ name: "event_authority"
1359
1190
  }
1360
1191
  ],
1361
1192
  args: [
@@ -1418,6 +1249,9 @@ var instructions$2 = [
1418
1249
  },
1419
1250
  {
1420
1251
  name: "identity_registry"
1252
+ },
1253
+ {
1254
+ name: "event_authority"
1421
1255
  }
1422
1256
  ],
1423
1257
  args: [
@@ -1577,6 +1411,9 @@ var instructions$2 = [
1577
1411
  },
1578
1412
  {
1579
1413
  name: "wallet_identity_account"
1414
+ },
1415
+ {
1416
+ name: "event_authority"
1580
1417
  }
1581
1418
  ],
1582
1419
  args: [
@@ -1752,6 +1589,12 @@ var instructions$2 = [
1752
1589
  name: "wallet_identity",
1753
1590
  writable: true
1754
1591
  },
1592
+ {
1593
+ name: "event_authority_identity_metadata_registry"
1594
+ },
1595
+ {
1596
+ name: "event_authority_identity_registry"
1597
+ },
1755
1598
  {
1756
1599
  name: "system_program",
1757
1600
  address: "11111111111111111111111111111111"
@@ -1764,6 +1607,73 @@ var instructions$2 = [
1764
1607
  }
1765
1608
  ]
1766
1609
  },
1610
+ {
1611
+ name: "remove_identity_account",
1612
+ discriminator: [
1613
+ 78,
1614
+ 35,
1615
+ 174,
1616
+ 50,
1617
+ 72,
1618
+ 181,
1619
+ 12,
1620
+ 42
1621
+ ],
1622
+ accounts: [
1623
+ {
1624
+ name: "payer",
1625
+ writable: true,
1626
+ signer: true
1627
+ },
1628
+ {
1629
+ name: "user",
1630
+ signer: true
1631
+ },
1632
+ {
1633
+ name: "controller_authority",
1634
+ relations: [
1635
+ "asset_access_controller"
1636
+ ]
1637
+ },
1638
+ {
1639
+ name: "asset_access_controller",
1640
+ relations: [
1641
+ "authorized_user_role"
1642
+ ]
1643
+ },
1644
+ {
1645
+ name: "authorized_user_role",
1646
+ optional: true
1647
+ },
1648
+ {
1649
+ name: "identity_registry_program",
1650
+ address: "GZsnjqT3c5zbHqsctrJ4EG4rbEfo7ZXyyUG7aDJNmxfA"
1651
+ },
1652
+ {
1653
+ name: "identity_registry"
1654
+ },
1655
+ {
1656
+ name: "identity_account",
1657
+ writable: true
1658
+ },
1659
+ {
1660
+ name: "wallet_identity",
1661
+ writable: true
1662
+ },
1663
+ {
1664
+ name: "event_authority"
1665
+ },
1666
+ {
1667
+ name: "identity_owner"
1668
+ }
1669
+ ],
1670
+ args: [
1671
+ {
1672
+ name: "cpi_data",
1673
+ type: "bytes"
1674
+ }
1675
+ ]
1676
+ },
1767
1677
  {
1768
1678
  name: "remove_investor",
1769
1679
  discriminator: [
@@ -1832,6 +1742,12 @@ var instructions$2 = [
1832
1742
  {
1833
1743
  name: "tracker_account",
1834
1744
  writable: true
1745
+ },
1746
+ {
1747
+ name: "event_authority_identity_metadata_registry"
1748
+ },
1749
+ {
1750
+ name: "event_authority_identity_registry"
1835
1751
  }
1836
1752
  ],
1837
1753
  args: [
@@ -1909,6 +1825,9 @@ var instructions$2 = [
1909
1825
  },
1910
1826
  {
1911
1827
  name: "asset_mint"
1828
+ },
1829
+ {
1830
+ name: "event_authority"
1912
1831
  }
1913
1832
  ],
1914
1833
  args: [
@@ -1991,6 +1910,9 @@ var instructions$2 = [
1991
1910
  },
1992
1911
  {
1993
1912
  name: "asset_mint"
1913
+ },
1914
+ {
1915
+ name: "event_authority_identity_registry"
1994
1916
  }
1995
1917
  ],
1996
1918
  args: [
@@ -2074,92 +1996,6 @@ var instructions$2 = [
2074
1996
  }
2075
1997
  ]
2076
1998
  },
2077
- {
2078
- name: "remove_token_lock",
2079
- discriminator: [
2080
- 168,
2081
- 128,
2082
- 173,
2083
- 188,
2084
- 172,
2085
- 228,
2086
- 154,
2087
- 90
2088
- ],
2089
- accounts: [
2090
- {
2091
- name: "user",
2092
- signer: true
2093
- },
2094
- {
2095
- name: "controller_authority",
2096
- writable: true,
2097
- relations: [
2098
- "asset_access_controller"
2099
- ]
2100
- },
2101
- {
2102
- name: "asset_access_controller",
2103
- relations: [
2104
- "authorized_user_role"
2105
- ]
2106
- },
2107
- {
2108
- name: "authorized_user_role",
2109
- optional: true
2110
- },
2111
- {
2112
- name: "token_locks_program",
2113
- address: "9bNt3ZiZpDdHqAt5Q1Wq6twFe5RKmMCwA7MJyK2HgGnU"
2114
- },
2115
- {
2116
- name: "investor_locks",
2117
- writable: true
2118
- },
2119
- {
2120
- name: "investor"
2121
- },
2122
- {
2123
- name: "wallet_identity_account"
2124
- },
2125
- {
2126
- name: "identity_account"
2127
- },
2128
- {
2129
- name: "asset_mint",
2130
- writable: true
2131
- },
2132
- {
2133
- name: "unlocked_token_account",
2134
- writable: true
2135
- },
2136
- {
2137
- name: "locked_token_account",
2138
- writable: true
2139
- },
2140
- {
2141
- name: "asset_controller"
2142
- },
2143
- {
2144
- name: "identity_registry",
2145
- writable: true
2146
- },
2147
- {
2148
- name: "asset_controller_program",
2149
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
2150
- },
2151
- {
2152
- name: "token_program",
2153
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
2154
- }
2155
- ],
2156
- args: [
2157
- {
2158
- name: "indices",
2159
- type: "bytes"
2160
- }
2161
- ]
2162
- },
2163
1999
  {
2164
2000
  name: "remove_user_role",
2165
2001
  discriminator: [
@@ -2191,6 +2027,38 @@ var instructions$2 = [
2191
2027
  {
2192
2028
  name: "authorized_user_role",
2193
2029
  optional: true
2030
+ },
2031
+ {
2032
+ name: "event_authority",
2033
+ pda: {
2034
+ seeds: [
2035
+ {
2036
+ kind: "const",
2037
+ value: [
2038
+ 95,
2039
+ 95,
2040
+ 101,
2041
+ 118,
2042
+ 101,
2043
+ 110,
2044
+ 116,
2045
+ 95,
2046
+ 97,
2047
+ 117,
2048
+ 116,
2049
+ 104,
2050
+ 111,
2051
+ 114,
2052
+ 105,
2053
+ 116,
2054
+ 121
2055
+ ]
2056
+ }
2057
+ ]
2058
+ }
2059
+ },
2060
+ {
2061
+ name: "program"
2194
2062
  }
2195
2063
  ],
2196
2064
  args: [
@@ -2282,6 +2150,9 @@ var instructions$2 = [
2282
2150
  {
2283
2151
  name: "system_program",
2284
2152
  address: "11111111111111111111111111111111"
2153
+ },
2154
+ {
2155
+ name: "event_authority"
2285
2156
  }
2286
2157
  ],
2287
2158
  args: [
@@ -2346,6 +2217,9 @@ var instructions$2 = [
2346
2217
  {
2347
2218
  name: "token_program",
2348
2219
  address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
2220
+ },
2221
+ {
2222
+ name: "event_authority"
2349
2223
  }
2350
2224
  ],
2351
2225
  args: [
@@ -2400,6 +2274,9 @@ var instructions$2 = [
2400
2274
  {
2401
2275
  name: "policy_engine",
2402
2276
  writable: true
2277
+ },
2278
+ {
2279
+ name: "event_authority"
2403
2280
  }
2404
2281
  ],
2405
2282
  args: [
@@ -2676,7 +2553,7 @@ var instructions$2 = [
2676
2553
  ]
2677
2554
  }
2678
2555
  ];
2679
- var accounts$2 = [
2556
+ var accounts$1 = [
2680
2557
  {
2681
2558
  name: "AssetAccessController",
2682
2559
  discriminator: [
@@ -2704,7 +2581,35 @@ var accounts$2 = [
2704
2581
  ]
2705
2582
  }
2706
2583
  ];
2707
- var errors$2 = [
2584
+ var events$1 = [
2585
+ {
2586
+ name: "AssignUserRoleEvent",
2587
+ discriminator: [
2588
+ 66,
2589
+ 20,
2590
+ 203,
2591
+ 47,
2592
+ 242,
2593
+ 72,
2594
+ 213,
2595
+ 93
2596
+ ]
2597
+ },
2598
+ {
2599
+ name: "RemoveUserRoleEvent",
2600
+ discriminator: [
2601
+ 213,
2602
+ 162,
2603
+ 73,
2604
+ 7,
2605
+ 11,
2606
+ 89,
2607
+ 226,
2608
+ 140
2609
+ ]
2610
+ }
2611
+ ];
2612
+ var errors$1 = [
2708
2613
  {
2709
2614
  code: 6000,
2710
2615
  name: "UnknownInstruction",
@@ -2739,9 +2644,14 @@ var errors$2 = [
2739
2644
  code: 6006,
2740
2645
  name: "InvalidLevel",
2741
2646
  msg: "Invalid level"
2647
+ },
2648
+ {
2649
+ code: 6007,
2650
+ name: "IllegalOperation",
2651
+ msg: "Illegal operation"
2742
2652
  }
2743
2653
  ];
2744
- var types$2 = [
2654
+ var types$1 = [
2745
2655
  {
2746
2656
  name: "AssetAccessController",
2747
2657
  type: {
@@ -2785,6 +2695,66 @@ var types$2 = [
2785
2695
  ]
2786
2696
  }
2787
2697
  },
2698
+ {
2699
+ name: "AssignUserRoleEvent",
2700
+ type: {
2701
+ kind: "struct",
2702
+ fields: [
2703
+ {
2704
+ name: "addresses",
2705
+ type: {
2706
+ vec: "pubkey"
2707
+ }
2708
+ },
2709
+ {
2710
+ name: "role",
2711
+ type: "string"
2712
+ },
2713
+ {
2714
+ name: "role_id",
2715
+ type: "u64"
2716
+ },
2717
+ {
2718
+ name: "sender",
2719
+ type: "pubkey"
2720
+ },
2721
+ {
2722
+ name: "seed",
2723
+ type: "pubkey"
2724
+ }
2725
+ ]
2726
+ }
2727
+ },
2728
+ {
2729
+ name: "RemoveUserRoleEvent",
2730
+ type: {
2731
+ kind: "struct",
2732
+ fields: [
2733
+ {
2734
+ name: "addresses",
2735
+ type: {
2736
+ vec: "pubkey"
2737
+ }
2738
+ },
2739
+ {
2740
+ name: "role",
2741
+ type: "string"
2742
+ },
2743
+ {
2744
+ name: "role_id",
2745
+ type: "u64"
2746
+ },
2747
+ {
2748
+ name: "sender",
2749
+ type: "pubkey"
2750
+ },
2751
+ {
2752
+ name: "seed",
2753
+ type: "pubkey"
2754
+ }
2755
+ ]
2756
+ }
2757
+ },
2788
2758
  {
2789
2759
  name: "UserRole",
2790
2760
  type: {
@@ -2839,33 +2809,35 @@ var types$2 = [
2839
2809
  }
2840
2810
  ];
2841
2811
  var rwa_rbac = {
2842
- address: address$2,
2843
- metadata: metadata$2,
2844
- instructions: instructions$2,
2845
- accounts: accounts$2,
2846
- errors: errors$2,
2847
- types: types$2
2812
+ address: address$1,
2813
+ metadata: metadata$1,
2814
+ instructions: instructions$1,
2815
+ accounts: accounts$1,
2816
+ events: events$1,
2817
+ errors: errors$1,
2818
+ types: types$1
2848
2819
  };
2849
2820
 
2850
2821
  var rbacIDL = /*#__PURE__*/Object.freeze({
2851
2822
  __proto__: null,
2852
- address: address$2,
2853
- metadata: metadata$2,
2854
- instructions: instructions$2,
2855
- accounts: accounts$2,
2856
- errors: errors$2,
2857
- types: types$2,
2823
+ address: address$1,
2824
+ metadata: metadata$1,
2825
+ instructions: instructions$1,
2826
+ accounts: accounts$1,
2827
+ events: events$1,
2828
+ errors: errors$1,
2829
+ types: types$1,
2858
2830
  'default': rwa_rbac
2859
2831
  });
2860
2832
 
2861
- var address$1 = "D2V7wTBbNCKgYwirgRUnSmc2QyKnHSVmRotWJ4rz8Jp9";
2862
- var metadata$1 = {
2833
+ var address = "D2V7wTBbNCKgYwirgRUnSmc2QyKnHSVmRotWJ4rz8Jp9";
2834
+ var metadata = {
2863
2835
  name: "rwa_imr",
2864
2836
  version: "0.1.0",
2865
2837
  spec: "0.1.0",
2866
2838
  description: "Created with Anchor"
2867
2839
  };
2868
- var instructions$1 = [
2840
+ var instructions = [
2869
2841
  {
2870
2842
  name: "add_levels",
2871
2843
  discriminator: [
@@ -2922,6 +2894,41 @@ var instructions$1 = [
2922
2894
  },
2923
2895
  {
2924
2896
  name: "asset_mint"
2897
+ },
2898
+ {
2899
+ name: "event_authority_identity_registry"
2900
+ },
2901
+ {
2902
+ name: "event_authority",
2903
+ pda: {
2904
+ seeds: [
2905
+ {
2906
+ kind: "const",
2907
+ value: [
2908
+ 95,
2909
+ 95,
2910
+ 101,
2911
+ 118,
2912
+ 101,
2913
+ 110,
2914
+ 116,
2915
+ 95,
2916
+ 97,
2917
+ 117,
2918
+ 116,
2919
+ 104,
2920
+ 111,
2921
+ 114,
2922
+ 105,
2923
+ 116,
2924
+ 121
2925
+ ]
2926
+ }
2927
+ ]
2928
+ }
2929
+ },
2930
+ {
2931
+ name: "program"
2925
2932
  }
2926
2933
  ],
2927
2934
  args: [
@@ -3002,6 +3009,9 @@ var instructions$1 = [
3002
3009
  {
3003
3010
  name: "system_program",
3004
3011
  address: "11111111111111111111111111111111"
3012
+ },
3013
+ {
3014
+ name: "event_authority_identity_registry"
3005
3015
  }
3006
3016
  ],
3007
3017
  args: [
@@ -3063,6 +3073,9 @@ var instructions$1 = [
3063
3073
  },
3064
3074
  {
3065
3075
  name: "asset_mint"
3076
+ },
3077
+ {
3078
+ name: "event_authority_identity_registry"
3066
3079
  }
3067
3080
  ],
3068
3081
  args: [
@@ -3148,6 +3161,41 @@ var instructions$1 = [
3148
3161
  {
3149
3162
  name: "system_program",
3150
3163
  address: "11111111111111111111111111111111"
3164
+ },
3165
+ {
3166
+ name: "event_authority_identity_registry"
3167
+ },
3168
+ {
3169
+ name: "event_authority",
3170
+ pda: {
3171
+ seeds: [
3172
+ {
3173
+ kind: "const",
3174
+ value: [
3175
+ 95,
3176
+ 95,
3177
+ 101,
3178
+ 118,
3179
+ 101,
3180
+ 110,
3181
+ 116,
3182
+ 95,
3183
+ 97,
3184
+ 117,
3185
+ 116,
3186
+ 104,
3187
+ 111,
3188
+ 114,
3189
+ 105,
3190
+ 116,
3191
+ 121
3192
+ ]
3193
+ }
3194
+ ]
3195
+ }
3196
+ },
3197
+ {
3198
+ name: "program"
3151
3199
  }
3152
3200
  ],
3153
3201
  args: [
@@ -3228,6 +3276,41 @@ var instructions$1 = [
3228
3276
  {
3229
3277
  name: "tracker_account",
3230
3278
  writable: true
3279
+ },
3280
+ {
3281
+ name: "event_authority_identity_registry"
3282
+ },
3283
+ {
3284
+ name: "event_authority",
3285
+ pda: {
3286
+ seeds: [
3287
+ {
3288
+ kind: "const",
3289
+ value: [
3290
+ 95,
3291
+ 95,
3292
+ 101,
3293
+ 118,
3294
+ 101,
3295
+ 110,
3296
+ 116,
3297
+ 95,
3298
+ 97,
3299
+ 117,
3300
+ 116,
3301
+ 104,
3302
+ 111,
3303
+ 114,
3304
+ 105,
3305
+ 116,
3306
+ 121
3307
+ ]
3308
+ }
3309
+ ]
3310
+ }
3311
+ },
3312
+ {
3313
+ name: "program"
3231
3314
  }
3232
3315
  ],
3233
3316
  args: [
@@ -3289,6 +3372,9 @@ var instructions$1 = [
3289
3372
  },
3290
3373
  {
3291
3374
  name: "asset_mint"
3375
+ },
3376
+ {
3377
+ name: "event_authority_identity_registry"
3292
3378
  }
3293
3379
  ],
3294
3380
  args: [
@@ -3303,7 +3389,7 @@ var instructions$1 = [
3303
3389
  ]
3304
3390
  }
3305
3391
  ];
3306
- var accounts$1 = [
3392
+ var accounts = [
3307
3393
  {
3308
3394
  name: "Investor",
3309
3395
  discriminator: [
@@ -3318,7 +3404,61 @@ var accounts$1 = [
3318
3404
  ]
3319
3405
  }
3320
3406
  ];
3321
- var errors$1 = [
3407
+ var events = [
3408
+ {
3409
+ name: "AddLevelsEvent",
3410
+ discriminator: [
3411
+ 90,
3412
+ 156,
3413
+ 44,
3414
+ 28,
3415
+ 242,
3416
+ 1,
3417
+ 130,
3418
+ 61
3419
+ ]
3420
+ },
3421
+ {
3422
+ name: "RegisterInvestorEvent",
3423
+ discriminator: [
3424
+ 137,
3425
+ 181,
3426
+ 142,
3427
+ 164,
3428
+ 140,
3429
+ 196,
3430
+ 246,
3431
+ 182
3432
+ ]
3433
+ },
3434
+ {
3435
+ name: "RemoveInvestorEvent",
3436
+ discriminator: [
3437
+ 221,
3438
+ 84,
3439
+ 243,
3440
+ 216,
3441
+ 215,
3442
+ 253,
3443
+ 246,
3444
+ 253
3445
+ ]
3446
+ },
3447
+ {
3448
+ name: "RemoveLevelsEvent",
3449
+ discriminator: [
3450
+ 145,
3451
+ 158,
3452
+ 97,
3453
+ 146,
3454
+ 126,
3455
+ 14,
3456
+ 2,
3457
+ 225
3458
+ ]
3459
+ }
3460
+ ];
3461
+ var errors = [
3322
3462
  {
3323
3463
  code: 6000,
3324
3464
  name: "UnknownInstruction",
@@ -3355,598 +3495,39 @@ var errors$1 = [
3355
3495
  msg: "Unknown level"
3356
3496
  }
3357
3497
  ];
3358
- var types$1 = [
3498
+ var types = [
3359
3499
  {
3360
- name: "Investor",
3500
+ name: "AddLevelsEvent",
3361
3501
  type: {
3362
3502
  kind: "struct",
3363
3503
  fields: [
3364
3504
  {
3365
- name: "authority",
3366
- docs: [
3367
- "Authority keypair allowed to write this account, will match authority or delegate of IdentityRegistry",
3368
- "at time of creation of IdentityAccount."
3369
- ],
3370
- type: "pubkey"
3505
+ name: "investor_id",
3506
+ type: "string"
3371
3507
  },
3372
3508
  {
3373
- name: "identity_account",
3374
- docs: [
3375
- "IdentityAccount associated with this investor."
3376
- ],
3509
+ name: "sender",
3377
3510
  type: "pubkey"
3378
3511
  },
3379
3512
  {
3380
- name: "identity_registry",
3381
- docs: [
3382
- "IdentityRegistryAccount associated with this investor."
3383
- ],
3384
- type: "pubkey"
3385
- },
3386
- {
3387
- name: "bump",
3388
- docs: [
3389
- "PDA Seed Bump"
3390
- ],
3391
- type: "u8"
3392
- },
3393
- {
3394
- name: "investor_id",
3395
- docs: [
3396
- "Unique ID for Investor, generated off-chain."
3397
- ],
3398
- type: "string"
3399
- },
3400
- {
3401
- name: "collision_hash",
3402
- docs: [
3403
- "Metadata for investor, generated off-chain."
3404
- ],
3405
- type: "string"
3406
- },
3407
- {
3408
- name: "last_updated_by",
3409
- docs: [
3410
- "User that last modified this investor. Read from payer of instruction."
3411
- ],
3412
- type: "pubkey"
3413
- },
3414
- {
3415
- name: "levels",
3416
- docs: [
3417
- "Levels assigned to investor."
3418
- ],
3419
- type: {
3420
- vec: {
3421
- defined: {
3422
- name: "LevelData"
3423
- }
3424
- }
3425
- }
3426
- },
3427
- {
3428
- name: "country",
3429
- type: "u8"
3430
- }
3431
- ]
3432
- }
3433
- },
3434
- {
3435
- name: "LevelData",
3436
- type: {
3437
- kind: "struct",
3438
- fields: [
3439
- {
3440
- name: "level",
3441
- docs: [
3442
- "Maps to IdentityAccount level used in RWA Token."
3443
- ],
3444
- type: "u8"
3445
- },
3446
- {
3447
- name: "proof_hash",
3448
- docs: [
3449
- "Hash generated off-chain."
3450
- ],
3451
- type: "string"
3452
- }
3453
- ]
3454
- }
3455
- }
3456
- ];
3457
- var rwa_imr = {
3458
- address: address$1,
3459
- metadata: metadata$1,
3460
- instructions: instructions$1,
3461
- accounts: accounts$1,
3462
- errors: errors$1,
3463
- types: types$1
3464
- };
3465
-
3466
- var imrIDL = /*#__PURE__*/Object.freeze({
3467
- __proto__: null,
3468
- address: address$1,
3469
- metadata: metadata$1,
3470
- instructions: instructions$1,
3471
- accounts: accounts$1,
3472
- errors: errors$1,
3473
- types: types$1,
3474
- 'default': rwa_imr
3475
- });
3476
-
3477
- var address = "9bNt3ZiZpDdHqAt5Q1Wq6twFe5RKmMCwA7MJyK2HgGnU";
3478
- var metadata = {
3479
- name: "token_locks",
3480
- version: "0.1.0",
3481
- spec: "0.1.0",
3482
- description: "Created with Anchor"
3483
- };
3484
- var instructions = [
3485
- {
3486
- name: "add_token_lock",
3487
- discriminator: [
3488
- 195,
3489
- 26,
3490
- 109,
3491
- 80,
3492
- 46,
3493
- 7,
3494
- 195,
3495
- 55
3496
- ],
3497
- accounts: [
3498
- {
3499
- name: "payer",
3500
- writable: true,
3501
- signer: true
3502
- },
3503
- {
3504
- name: "authority",
3505
- docs: [
3506
- "Authority of AssetController (required to execute seize CPI)."
3507
- ],
3508
- writable: true,
3509
- signer: true,
3510
- relations: [
3511
- "investor"
3512
- ]
3513
- },
3514
- {
3515
- name: "investor_locks",
3516
- writable: true
3517
- },
3518
- {
3519
- name: "investor",
3520
- relations: [
3521
- "investor_locks"
3522
- ]
3523
- },
3524
- {
3525
- name: "wallet_identity_account"
3526
- },
3527
- {
3528
- name: "identity_account",
3529
- relations: [
3530
- "investor"
3531
- ]
3532
- },
3533
- {
3534
- name: "asset_mint",
3535
- writable: true
3536
- },
3537
- {
3538
- name: "unlocked_token_account",
3539
- writable: true
3540
- },
3541
- {
3542
- name: "locked_token_account",
3543
- writable: true,
3544
- relations: [
3545
- "investor_locks"
3546
- ]
3547
- },
3548
- {
3549
- name: "asset_controller"
3550
- },
3551
- {
3552
- name: "identity_registry",
3553
- writable: true,
3554
- relations: [
3555
- "investor"
3556
- ]
3557
- },
3558
- {
3559
- name: "asset_controller_program",
3560
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
3561
- },
3562
- {
3563
- name: "token_program",
3564
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
3565
- },
3566
- {
3567
- name: "system_program",
3568
- address: "11111111111111111111111111111111"
3569
- }
3570
- ],
3571
- args: [
3572
- {
3573
- name: "value",
3574
- type: "u64"
3575
- },
3576
- {
3577
- name: "release_time",
3578
- type: "i64"
3579
- },
3580
- {
3581
- name: "reason_code",
3582
- type: "u64"
3583
- },
3584
- {
3585
- name: "reason_string",
3586
- type: "string"
3587
- }
3588
- ]
3589
- },
3590
- {
3591
- name: "close_investor_locks",
3592
- discriminator: [
3593
- 255,
3594
- 60,
3595
- 220,
3596
- 115,
3597
- 217,
3598
- 104,
3599
- 157,
3600
- 171
3601
- ],
3602
- accounts: [
3603
- {
3604
- name: "payer",
3605
- writable: true,
3606
- signer: true
3607
- },
3608
- {
3609
- name: "authority",
3610
- signer: true,
3611
- relations: [
3612
- "investor"
3613
- ]
3614
- },
3615
- {
3616
- name: "investor_locks",
3617
- writable: true
3618
- },
3619
- {
3620
- name: "investor",
3621
- relations: [
3622
- "investor_locks"
3623
- ]
3624
- },
3625
- {
3626
- name: "locked_token_account",
3627
- writable: true,
3628
- relations: [
3629
- "investor_locks"
3630
- ]
3631
- },
3632
- {
3633
- name: "token_program",
3634
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
3635
- },
3636
- {
3637
- name: "system_program",
3638
- address: "11111111111111111111111111111111"
3639
- }
3640
- ],
3641
- args: [
3642
- ]
3643
- },
3644
- {
3645
- name: "create_investor_locks",
3646
- discriminator: [
3647
- 223,
3648
- 81,
3649
- 139,
3650
- 162,
3651
- 204,
3652
- 48,
3653
- 24,
3654
- 213
3655
- ],
3656
- accounts: [
3657
- {
3658
- name: "payer",
3659
- writable: true,
3660
- signer: true
3661
- },
3662
- {
3663
- name: "authority",
3664
- signer: true,
3665
- relations: [
3666
- "investor"
3667
- ]
3668
- },
3669
- {
3670
- name: "investor_locks",
3671
- writable: true,
3672
- pda: {
3673
- seeds: [
3674
- {
3675
- kind: "account",
3676
- path: "investor.investor_id",
3677
- account: "Investor"
3678
- },
3679
- {
3680
- kind: "account",
3681
- path: "investor.identity_registry",
3682
- account: "Investor"
3683
- },
3684
- {
3685
- kind: "const",
3686
- value: [
3687
- 73,
3688
- 110,
3689
- 118,
3690
- 101,
3691
- 115,
3692
- 116,
3693
- 111,
3694
- 114,
3695
- 76,
3696
- 111,
3697
- 99,
3698
- 107,
3699
- 115
3700
- ]
3701
- }
3702
- ]
3703
- }
3704
- },
3705
- {
3706
- name: "investor"
3707
- },
3708
- {
3709
- name: "identity_account",
3710
- docs: [
3711
- "CHECKED: Matches known address."
3712
- ],
3713
- relations: [
3714
- "investor"
3715
- ]
3716
- },
3717
- {
3718
- name: "asset_mint",
3719
- writable: true
3720
- },
3721
- {
3722
- name: "locked_token_account",
3723
- writable: true,
3724
- pda: {
3725
- seeds: [
3726
- {
3727
- kind: "account",
3728
- path: "investor.investor_id",
3729
- account: "Investor"
3730
- },
3731
- {
3732
- kind: "account",
3733
- path: "investor.identity_registry",
3734
- account: "Investor"
3735
- },
3736
- {
3737
- kind: "const",
3738
- value: [
3739
- 76,
3740
- 111,
3741
- 99,
3742
- 107,
3743
- 101,
3744
- 100,
3745
- 84,
3746
- 111,
3747
- 107,
3748
- 101,
3749
- 110,
3750
- 65,
3751
- 99,
3752
- 99,
3753
- 111,
3754
- 117,
3755
- 110,
3756
- 116
3757
- ]
3758
- }
3759
- ]
3513
+ name: "levels",
3514
+ type: "bytes"
3515
+ },
3516
+ {
3517
+ name: "expiries",
3518
+ type: {
3519
+ vec: "i64"
3520
+ }
3521
+ },
3522
+ {
3523
+ name: "proof_hashes",
3524
+ type: {
3525
+ vec: "string"
3526
+ }
3760
3527
  }
3761
- },
3762
- {
3763
- name: "asset_controller"
3764
- },
3765
- {
3766
- name: "asset_controller_program",
3767
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
3768
- },
3769
- {
3770
- name: "token_program",
3771
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
3772
- },
3773
- {
3774
- name: "system_program",
3775
- address: "11111111111111111111111111111111"
3776
- }
3777
- ],
3778
- args: [
3779
- ]
3780
- },
3781
- {
3782
- name: "remove_token_lock",
3783
- discriminator: [
3784
- 168,
3785
- 128,
3786
- 173,
3787
- 188,
3788
- 172,
3789
- 228,
3790
- 154,
3791
- 90
3792
- ],
3793
- accounts: [
3794
- {
3795
- name: "user",
3796
- signer: true
3797
- },
3798
- {
3799
- name: "authority",
3800
- docs: [
3801
- "Authority of AssetController (required to execute seize CPI)."
3802
- ],
3803
- writable: true,
3804
- signer: true,
3805
- relations: [
3806
- "investor"
3807
- ]
3808
- },
3809
- {
3810
- name: "investor_locks",
3811
- writable: true
3812
- },
3813
- {
3814
- name: "investor",
3815
- relations: [
3816
- "investor_locks"
3817
- ]
3818
- },
3819
- {
3820
- name: "wallet_identity_account"
3821
- },
3822
- {
3823
- name: "identity_account",
3824
- relations: [
3825
- "investor"
3826
- ]
3827
- },
3828
- {
3829
- name: "asset_mint",
3830
- writable: true
3831
- },
3832
- {
3833
- name: "unlocked_token_account",
3834
- writable: true
3835
- },
3836
- {
3837
- name: "locked_token_account",
3838
- writable: true,
3839
- relations: [
3840
- "investor_locks"
3841
- ]
3842
- },
3843
- {
3844
- name: "asset_controller"
3845
- },
3846
- {
3847
- name: "identity_registry",
3848
- writable: true,
3849
- relations: [
3850
- "investor"
3851
- ]
3852
- },
3853
- {
3854
- name: "asset_controller_program",
3855
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
3856
- },
3857
- {
3858
- name: "token_program",
3859
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
3860
- }
3861
- ],
3862
- args: [
3863
- {
3864
- name: "is_user_authorized",
3865
- type: "bool"
3866
- },
3867
- {
3868
- name: "indices",
3869
- type: "bytes"
3870
- }
3871
- ]
3872
- }
3873
- ];
3874
- var accounts = [
3875
- {
3876
- name: "Investor",
3877
- discriminator: [
3878
- 174,
3879
- 129,
3880
- 17,
3881
- 83,
3882
- 36,
3883
- 116,
3884
- 26,
3885
- 196
3886
- ]
3887
- },
3888
- {
3889
- name: "InvestorLocks",
3890
- discriminator: [
3891
- 199,
3892
- 60,
3893
- 219,
3894
- 46,
3895
- 221,
3896
- 205,
3897
- 1,
3898
- 7
3899
- ]
3900
- }
3901
- ];
3902
- var errors = [
3903
- {
3904
- code: 6000,
3905
- name: "UnknownInstruction",
3906
- msg: "Unknown program instruction from CPI data"
3907
- },
3908
- {
3909
- code: 6001,
3910
- name: "UnknownAccount",
3911
- msg: "Unknown account discriminator"
3912
- },
3913
- {
3914
- code: 6002,
3915
- name: "FailedDeserialization",
3916
- msg: "Invalid account on deserialization"
3917
- },
3918
- {
3919
- code: 6003,
3920
- name: "InvalidReleaseTime",
3921
- msg: "Invalid release time"
3922
- },
3923
- {
3924
- code: 6004,
3925
- name: "InvalidReasonString",
3926
- msg: "Invalid reason string"
3927
- },
3928
- {
3929
- code: 6005,
3930
- name: "InvalidLockValue",
3931
- msg: "Invalid lock value"
3932
- },
3933
- {
3934
- code: 6006,
3935
- name: "UnauthorizedUser",
3936
- msg: "User initiating instruction is not authorized by RBAC"
3937
- },
3938
- {
3939
- code: 6007,
3940
- name: "InvalidTokenAccountState",
3941
- msg: "Invalid token account state"
3528
+ ]
3529
+ }
3942
3530
  },
3943
- {
3944
- code: 6008,
3945
- name: "LockNotFound",
3946
- msg: "Lock not found"
3947
- }
3948
- ];
3949
- var types = [
3950
3531
  {
3951
3532
  name: "Investor",
3952
3533
  type: {
@@ -4023,117 +3604,116 @@ var types = [
4023
3604
  }
4024
3605
  },
4025
3606
  {
4026
- name: "InvestorLocks",
3607
+ name: "LevelData",
4027
3608
  type: {
4028
3609
  kind: "struct",
4029
3610
  fields: [
4030
3611
  {
4031
- name: "investor",
3612
+ name: "level",
4032
3613
  docs: [
4033
- "Address of Investor account."
3614
+ "Maps to IdentityAccount level used in RWA Token."
4034
3615
  ],
4035
- type: "pubkey"
3616
+ type: "u8"
4036
3617
  },
4037
3618
  {
4038
- name: "locked_token_account",
3619
+ name: "proof_hash",
4039
3620
  docs: [
4040
- "Account storing locked tokens for wallet. Will be frozen upon initialization of",
4041
- "InvestorLocks."
3621
+ "Hash generated off-chain."
4042
3622
  ],
4043
- type: "pubkey"
4044
- },
4045
- {
4046
- name: "locks",
4047
- type: {
4048
- vec: {
4049
- defined: {
4050
- name: "Lock"
4051
- }
4052
- }
4053
- }
3623
+ type: "string"
4054
3624
  }
4055
3625
  ]
4056
3626
  }
4057
3627
  },
4058
3628
  {
4059
- name: "LevelData",
3629
+ name: "RegisterInvestorEvent",
4060
3630
  type: {
4061
3631
  kind: "struct",
4062
3632
  fields: [
3633
+ {
3634
+ name: "investor_id",
3635
+ type: "string"
3636
+ },
4063
3637
  {
4064
3638
  name: "level",
4065
- docs: [
4066
- "Maps to IdentityAccount level used in RWA Token."
4067
- ],
4068
3639
  type: "u8"
4069
3640
  },
4070
3641
  {
4071
- name: "proof_hash",
4072
- docs: [
4073
- "Hash generated off-chain."
4074
- ],
3642
+ name: "expiry",
3643
+ type: "i64"
3644
+ },
3645
+ {
3646
+ name: "collision_hash",
3647
+ type: "string"
3648
+ },
3649
+ {
3650
+ name: "sender",
3651
+ type: "pubkey"
3652
+ },
3653
+ {
3654
+ name: "country",
3655
+ type: "u8"
3656
+ }
3657
+ ]
3658
+ }
3659
+ },
3660
+ {
3661
+ name: "RemoveInvestorEvent",
3662
+ type: {
3663
+ kind: "struct",
3664
+ fields: [
3665
+ {
3666
+ name: "investor_id",
4075
3667
  type: "string"
3668
+ },
3669
+ {
3670
+ name: "sender",
3671
+ type: "pubkey"
4076
3672
  }
4077
3673
  ]
4078
3674
  }
4079
3675
  },
4080
3676
  {
4081
- name: "Lock",
3677
+ name: "RemoveLevelsEvent",
4082
3678
  type: {
4083
3679
  kind: "struct",
4084
3680
  fields: [
4085
3681
  {
4086
- name: "value",
4087
- docs: [
4088
- "Amount of tokens to lock."
4089
- ],
4090
- type: "u64"
4091
- },
4092
- {
4093
- name: "release_time",
4094
- docs: [
4095
- "Timestamp from which the lock will be inactive. If value is 0, the lock",
4096
- "will remain active until removed."
4097
- ],
4098
- type: "i64"
3682
+ name: "investor_id",
3683
+ type: "string"
4099
3684
  },
4100
3685
  {
4101
- name: "reason_code",
4102
- docs: [
4103
- "Reason code for locking."
4104
- ],
4105
- type: "u64"
3686
+ name: "sender",
3687
+ type: "pubkey"
4106
3688
  },
4107
3689
  {
4108
- name: "reason_string",
4109
- docs: [
4110
- "Detailed reason for the lock. Since string has no length limit, we calculate",
4111
- "total space needed dynamically at time of resizing."
4112
- ],
4113
- type: "string"
3690
+ name: "levels",
3691
+ type: "bytes"
4114
3692
  }
4115
3693
  ]
4116
3694
  }
4117
3695
  }
4118
3696
  ];
4119
- var token_locks = {
3697
+ var rwa_imr = {
4120
3698
  address: address,
4121
3699
  metadata: metadata,
4122
3700
  instructions: instructions,
4123
3701
  accounts: accounts,
3702
+ events: events,
4124
3703
  errors: errors,
4125
3704
  types: types
4126
3705
  };
4127
3706
 
4128
- var tokenLocksIdl = /*#__PURE__*/Object.freeze({
3707
+ var imrIDL = /*#__PURE__*/Object.freeze({
4129
3708
  __proto__: null,
4130
3709
  address: address,
4131
3710
  metadata: metadata,
4132
3711
  instructions: instructions,
4133
3712
  accounts: accounts,
3713
+ events: events,
4134
3714
  errors: errors,
4135
3715
  types: types,
4136
- 'default': token_locks
3716
+ 'default': rwa_imr
4137
3717
  });
4138
3718
 
4139
3719
  exports.AdminFlags = void 0;
@@ -4178,7 +3758,8 @@ exports.MediciFlags = void 0;
4178
3758
  MediciFlags[MediciFlags["CHANGE_COUNTRY"] = 134217728] = "CHANGE_COUNTRY";
4179
3759
  MediciFlags[MediciFlags["CHANGE_MAPPING"] = 268435456] = "CHANGE_MAPPING";
4180
3760
  MediciFlags[MediciFlags["CHANGE_ISSUANCE_POLICIES"] = 536870912] = "CHANGE_ISSUANCE_POLICIES";
4181
- MediciFlags[MediciFlags["ALL"] = 1073741823] = "ALL";
3761
+ MediciFlags[MediciFlags["REMOVE_IDENTITY_ACCOUNT"] = 1073741824] = "REMOVE_IDENTITY_ACCOUNT";
3762
+ MediciFlags[MediciFlags["ALL"] = 2147483647] = "ALL";
4182
3763
  })(exports.MediciFlags || (exports.MediciFlags = {}));
4183
3764
 
4184
3765
  /******************************************************************************
@@ -4304,6 +3885,7 @@ class AssetController {
4304
3885
  associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
4305
3886
  systemProgram: web3_js.SystemProgram.programId,
4306
3887
  walletIdentityAccount: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, args.wallet),
3888
+ eventAuthority: rwaTokenSdk.getAssetControllerEventAuthority(),
4307
3889
  })
4308
3890
  .instruction();
4309
3891
  });
@@ -4427,6 +4009,7 @@ class AssetController {
4427
4009
  tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
4428
4010
  associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
4429
4011
  systemProgram: web3_js.SystemProgram.programId,
4012
+ eventAuthority: rwaTokenSdk.getAssetControllerEventAuthority(),
4430
4013
  })
4431
4014
  .instruction();
4432
4015
  });
@@ -4510,6 +4093,7 @@ class AssetController {
4510
4093
  sourceTokenAccount: splToken.getAssociatedTokenAddressSync(new web3_js.PublicKey(args.assetMint), new web3_js.PublicKey(args.from), false, splToken.TOKEN_2022_PROGRAM_ID),
4511
4094
  destinationTokenAccount: splToken.getAssociatedTokenAddressSync(new web3_js.PublicKey(args.assetMint), new web3_js.PublicKey(args.to), true, splToken.TOKEN_2022_PROGRAM_ID),
4512
4095
  tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
4096
+ eventAuthority: rwaTokenSdk.getAssetControllerEventAuthority(),
4513
4097
  })
4514
4098
  .remainingAccounts([
4515
4099
  {
@@ -4604,6 +4188,7 @@ class PolicyEngine {
4604
4188
  policyEngineProgram: rwaTokenSdk.policyEngineProgramId,
4605
4189
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
4606
4190
  systemProgram: web3_js.SystemProgram.programId,
4191
+ eventAuthority: rwaTokenSdk.getPolicyEngineEventAuthority(),
4607
4192
  })
4608
4193
  .instruction();
4609
4194
  });
@@ -4631,6 +4216,7 @@ class PolicyEngine {
4631
4216
  policyEngineProgram: rwaTokenSdk.policyEngineProgramId,
4632
4217
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
4633
4218
  systemProgram: web3_js.SystemProgram.programId,
4219
+ eventAuthority: rwaTokenSdk.getPolicyEngineEventAuthority(),
4634
4220
  })
4635
4221
  .instruction();
4636
4222
  });
@@ -4658,6 +4244,7 @@ class PolicyEngine {
4658
4244
  policyEngineProgram: rwaTokenSdk.policyEngineProgramId,
4659
4245
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
4660
4246
  systemProgram: web3_js.SystemProgram.programId,
4247
+ eventAuthority: rwaTokenSdk.getPolicyEngineEventAuthority(),
4661
4248
  })
4662
4249
  .instruction();
4663
4250
  });
@@ -4684,6 +4271,7 @@ class PolicyEngine {
4684
4271
  authorizedUserRole: authorizedUserRole || null,
4685
4272
  policyEngineProgram: rwaTokenSdk.policyEngineProgramId,
4686
4273
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
4274
+ eventAuthority: rwaTokenSdk.getPolicyEngineEventAuthority(),
4687
4275
  })
4688
4276
  .instruction();
4689
4277
  });
@@ -4711,6 +4299,7 @@ class PolicyEngine {
4711
4299
  policyEngineProgram: rwaTokenSdk.policyEngineProgramId,
4712
4300
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
4713
4301
  systemProgram: web3_js.SystemProgram.programId,
4302
+ eventAuthority: rwaTokenSdk.getPolicyEngineEventAuthority(),
4714
4303
  })
4715
4304
  .instruction();
4716
4305
  });
@@ -4736,6 +4325,7 @@ class PolicyEngine {
4736
4325
  authorizedUserRole: authorizedUserRole || null,
4737
4326
  policyEngineProgram: rwaTokenSdk.policyEngineProgramId,
4738
4327
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
4328
+ eventAuthority: rwaTokenSdk.getPolicyEngineEventAuthority(),
4739
4329
  })
4740
4330
  .instruction();
4741
4331
  });
@@ -4761,6 +4351,7 @@ class PolicyEngine {
4761
4351
  authorizedUserRole: authorizedUserRole || null,
4762
4352
  policyEngineProgram: rwaTokenSdk.policyEngineProgramId,
4763
4353
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
4354
+ eventAuthority: rwaTokenSdk.getPolicyEngineEventAuthority(),
4764
4355
  })
4765
4356
  .instruction();
4766
4357
  });
@@ -4854,6 +4445,7 @@ class IdentityRegistry {
4854
4445
  identityAccount,
4855
4446
  walletIdentity: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, args.owner),
4856
4447
  systemProgram: web3_js.SystemProgram.programId,
4448
+ eventAuthority: rwaTokenSdk.getIdentityRegistryEventAuthority(),
4857
4449
  })
4858
4450
  .instruction());
4859
4451
  returnIxs.push(trackerAccountIx);
@@ -4863,6 +4455,41 @@ class IdentityRegistry {
4863
4455
  };
4864
4456
  });
4865
4457
  }
4458
+ /**
4459
+ * Asynchronously generates instructions to remove a non-investor user with an identity account.
4460
+ * @param args - {@link SetupUserArgs}
4461
+ * @param authority - RBAC AssetAccessController ControllerAuthority.
4462
+ * @param assetAccessController - RBAC AssetAccessController account.
4463
+ * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4464
+ * @returns A Promise that resolves to the instructions to setup a user.
4465
+ *
4466
+ * It is required for at least a single user to be setup before issuing tokens.
4467
+ */
4468
+ removeUserIxn(args, assetAccessController, authorizedUserRole) {
4469
+ return __awaiter(this, void 0, void 0, function* () {
4470
+ const ix = yield this.rwaClient.identityRegistry.revokeIdentityAccount(args);
4471
+ const identityAccountAddress = rwaTokenSdk.getIdentityAccountPda(args.assetMint, args.owner);
4472
+ const identityAccount = yield rwaTokenSdk.getIdentityAccount(identityAccountAddress, this.rwaClient.provider);
4473
+ const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
4474
+ const returnIx = yield this.rbacProgram.methods
4475
+ .removeIdentityAccount(ix.data)
4476
+ .accountsStrict({
4477
+ payer: args.payer,
4478
+ user: args.signer,
4479
+ controllerAuthority,
4480
+ assetAccessController,
4481
+ authorizedUserRole: authorizedUserRole || null,
4482
+ identityRegistryProgram: rwaTokenSdk.identityRegistryProgramId,
4483
+ identityRegistry: rwaTokenSdk.getIdentityRegistryPda(args.assetMint),
4484
+ identityAccount: identityAccountAddress,
4485
+ walletIdentity: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, args.owner),
4486
+ eventAuthority: rwaTokenSdk.getIdentityRegistryEventAuthority(),
4487
+ identityOwner: identityAccount.owner,
4488
+ })
4489
+ .instruction();
4490
+ return returnIx;
4491
+ });
4492
+ }
4866
4493
  /**
4867
4494
  * Asynchronously update a non-investor user identity account level.
4868
4495
  * @param args - {@link AddLevelToIdentityAccountArgs}
@@ -4892,6 +4519,7 @@ class IdentityRegistry {
4892
4519
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
4893
4520
  trackerAccount: rwaTokenSdk.getTrackerAccountPda(args.assetMint, args.owner),
4894
4521
  assetMint: args.assetMint,
4522
+ eventAuthority: rwaTokenSdk.getIdentityRegistryEventAuthority(),
4895
4523
  })
4896
4524
  .instruction();
4897
4525
  });
@@ -4926,6 +4554,7 @@ class IdentityRegistry {
4926
4554
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
4927
4555
  trackerAccount: rwaTokenSdk.getTrackerAccountPda(args.assetMint, args.owner),
4928
4556
  assetMint: args.assetMint,
4557
+ eventAuthority: rwaTokenSdk.getIdentityRegistryEventAuthority(),
4929
4558
  })
4930
4559
  .instruction();
4931
4560
  });
@@ -4992,6 +4621,8 @@ class IdentityRegistry {
4992
4621
  assetMint: args.assetMint,
4993
4622
  walletIdentity,
4994
4623
  systemProgram: web3_js.SystemProgram.programId,
4624
+ eventAuthority: rwaTokenSdk.getIdentityRegistryEventAuthority(),
4625
+ program: rwaTokenSdk.identityRegistryProgramId,
4995
4626
  })
4996
4627
  .instruction();
4997
4628
  return this.rbacProgram.methods
@@ -5008,6 +4639,7 @@ class IdentityRegistry {
5008
4639
  assetMint: args.assetMint,
5009
4640
  walletIdentity,
5010
4641
  systemProgram: web3_js.SystemProgram.programId,
4642
+ eventAuthority: rwaTokenSdk.getIdentityRegistryEventAuthority(),
5011
4643
  })
5012
4644
  .instruction();
5013
4645
  });
@@ -5034,6 +4666,8 @@ class IdentityRegistry {
5034
4666
  walletIdentity,
5035
4667
  identityAccount,
5036
4668
  identityRegistry,
4669
+ eventAuthority: rwaTokenSdk.getIdentityRegistryEventAuthority(),
4670
+ program: rwaTokenSdk.identityRegistryProgramId,
5037
4671
  })
5038
4672
  .instruction();
5039
4673
  return this.rbacProgram.methods
@@ -5048,6 +4682,7 @@ class IdentityRegistry {
5048
4682
  walletIdentity,
5049
4683
  identityAccount,
5050
4684
  identityRegistry,
4685
+ eventAuthority: rwaTokenSdk.getIdentityRegistryEventAuthority(),
5051
4686
  })
5052
4687
  .instruction();
5053
4688
  });
@@ -5063,6 +4698,27 @@ class IdentityMetadataRegistry {
5063
4698
  this.rbacProgram = rbacProgram;
5064
4699
  this.imrProgram = imrProgram;
5065
4700
  }
4701
+ /**
4702
+ * Parses inner instructions data field for array of events emitted by program using CPI Events.
4703
+ * @param ixs - Array of CompiledInstruction from a transaction inner instructions.
4704
+ * @returns Array of Events
4705
+ * */
4706
+ parseEvents(ixs) {
4707
+ const eventCoder = this.imrProgram.coder.events;
4708
+ const events = ixs
4709
+ .map(({ data }) => {
4710
+ try {
4711
+ const buffer = Buffer.from(anchor.utils.bytes.bs58.decode(data));
4712
+ const event = eventCoder.decode(anchor.utils.bytes.base64.encode(buffer.slice(8)));
4713
+ return event;
4714
+ }
4715
+ catch (err) {
4716
+ console.error("Error decoding events", err);
4717
+ }
4718
+ })
4719
+ .filter((v) => v != null);
4720
+ return events;
4721
+ }
5066
4722
  /**
5067
4723
  * Asynchronously generates instructions to setup an investor.
5068
4724
  * @param args - {@link SetupInvestorArgs}
@@ -5094,6 +4750,9 @@ class IdentityMetadataRegistry {
5094
4750
  walletIdentity: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, investor.toString() // Investor is owner of IdentityAccount
5095
4751
  ),
5096
4752
  systemProgram: web3_js.SystemProgram.programId,
4753
+ eventAuthority: getEventAuthority(IMR_PROGRAM),
4754
+ eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
4755
+ program: rwaTokenSdk.identityRegistryProgramId,
5097
4756
  })
5098
4757
  .instruction();
5099
4758
  returnIxs.push(yield this.rbacProgram.methods
@@ -5111,6 +4770,8 @@ class IdentityMetadataRegistry {
5111
4770
  identityAccount,
5112
4771
  walletIdentity: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, investor.toString()),
5113
4772
  systemProgram: web3_js.SystemProgram.programId,
4773
+ eventAuthorityIdentityMetadataRegistry: getEventAuthority(IMR_PROGRAM),
4774
+ eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
5114
4775
  })
5115
4776
  .instruction());
5116
4777
  const policyProgram = rwaTokenSdk.getPolicyEngineProgram(this.imrProgram.provider);
@@ -5175,6 +4836,9 @@ class IdentityMetadataRegistry {
5175
4836
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
5176
4837
  trackerAccount,
5177
4838
  assetMint: args.assetMint,
4839
+ eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
4840
+ eventAuthority: getEventAuthority(IMR_PROGRAM),
4841
+ program: IMR_PROGRAM,
5178
4842
  })
5179
4843
  .instruction();
5180
4844
  return this.rbacProgram.methods
@@ -5195,6 +4859,8 @@ class IdentityMetadataRegistry {
5195
4859
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
5196
4860
  trackerAccount,
5197
4861
  assetMint: args.assetMint,
4862
+ eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
4863
+ eventAuthorityIdentityMetadataRegistry: getEventAuthority(IMR_PROGRAM),
5198
4864
  })
5199
4865
  .instruction();
5200
4866
  });
@@ -5227,6 +4893,7 @@ class IdentityMetadataRegistry {
5227
4893
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
5228
4894
  trackerAccount,
5229
4895
  assetMint: args.assetMint,
4896
+ eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
5230
4897
  })
5231
4898
  .instruction();
5232
4899
  return this.rbacProgram.methods
@@ -5246,6 +4913,7 @@ class IdentityMetadataRegistry {
5246
4913
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
5247
4914
  trackerAccount,
5248
4915
  assetMint: args.assetMint,
4916
+ eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
5249
4917
  })
5250
4918
  .instruction();
5251
4919
  });
@@ -5279,6 +4947,7 @@ class IdentityMetadataRegistry {
5279
4947
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
5280
4948
  trackerAccount,
5281
4949
  assetMint: args.assetMint,
4950
+ eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
5282
4951
  })
5283
4952
  .instruction();
5284
4953
  return this.rbacProgram.methods
@@ -5299,6 +4968,7 @@ class IdentityMetadataRegistry {
5299
4968
  policyEngine: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
5300
4969
  trackerAccount,
5301
4970
  assetMint: args.assetMint,
4971
+ eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
5302
4972
  })
5303
4973
  .instruction();
5304
4974
  });
@@ -5332,6 +5002,8 @@ class IdentityMetadataRegistry {
5332
5002
  walletIdentity: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, investor.toString()),
5333
5003
  policyEngineProgram: rwaTokenSdk.policyEngineProgramId,
5334
5004
  trackerAccount: rwaTokenSdk.getTrackerAccountPda(args.assetMint, investor.toString()),
5005
+ eventAuthorityIdentityMetadataRegistry: getEventAuthority(IMR_PROGRAM),
5006
+ eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
5335
5007
  })
5336
5008
  .instruction();
5337
5009
  });
@@ -5358,266 +5030,13 @@ class IdentityMetadataRegistry {
5358
5030
  identityRegistry,
5359
5031
  assetMint: args.assetMint,
5360
5032
  systemProgram: web3_js.SystemProgram.programId,
5033
+ eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
5361
5034
  })
5362
5035
  .instruction();
5363
5036
  });
5364
5037
  }
5365
5038
  }
5366
5039
 
5367
- /**
5368
- * Role-based access client for accessing Token Locks
5369
- */
5370
- class TokenLocks {
5371
- constructor(rwaClient, rbacProgram, tokenLocksProgram) {
5372
- this.rwaClient = rwaClient;
5373
- this.rbacProgram = rbacProgram;
5374
- this.tokenLocksProgram = tokenLocksProgram;
5375
- }
5376
- /**
5377
- * Asynchronously create InvestorLocks account for a wallet.
5378
- * @param args - {@link CreateOrCloseInvestorLocksArgs}
5379
- * @param assetAccessController - RBAC AssetAccessController account.
5380
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
5381
- * @returns A Promise that resolves to a transaction instruction.
5382
- * */
5383
- createInvestorLocks(args, assetAccessController, authorizedUserRole) {
5384
- return __awaiter(this, void 0, void 0, function* () {
5385
- const identityRegistry = rwaTokenSdk.getIdentityRegistryPda(args.assetMint);
5386
- const investor = deriveInvestorPda(args.investorId, identityRegistry);
5387
- return this.rbacProgram.methods
5388
- .createInvestorLocks()
5389
- .accountsStrict({
5390
- payer: args.payer,
5391
- user: args.signer,
5392
- controllerAuthority: deriveControllerAuthorityPda(assetAccessController),
5393
- assetAccessController,
5394
- authorizedUserRole: authorizedUserRole || null,
5395
- tokenLocksProgram: TL_PROGRAM,
5396
- investorLocks: deriveInvestorLocks(args.investorId, identityRegistry),
5397
- investor,
5398
- identityAccount: rwaTokenSdk.getIdentityAccountPda(args.assetMint, investor.toString()),
5399
- assetMint: args.assetMint,
5400
- lockedTokenAccount: deriveLockedTokenAccount(args.investorId, identityRegistry),
5401
- assetController: rwaTokenSdk.getAssetControllerPda(args.assetMint),
5402
- assetControllerProgram: rwaTokenSdk.assetControllerProgramId,
5403
- tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
5404
- systemProgram: web3_js.SystemProgram.programId,
5405
- })
5406
- .instruction();
5407
- });
5408
- }
5409
- /**
5410
- * Asynchronously close InvestorLocks account for a wallet.
5411
- * @param args - {@link CreateOrCloseInvestorLocksArgs}
5412
- * @param assetAccessController - RBAC AssetAccessController account.
5413
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
5414
- * @returns A Promise that resolves to a transaction instruction.
5415
- * */
5416
- closeInvestorLocks(args, assetAccessController, authorizedUserRole) {
5417
- return __awaiter(this, void 0, void 0, function* () {
5418
- const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
5419
- const identityRegistry = rwaTokenSdk.getIdentityRegistryPda(args.assetMint);
5420
- return this.rbacProgram.methods
5421
- .closeInvestorLocks()
5422
- .accountsStrict({
5423
- payer: args.payer,
5424
- user: args.signer,
5425
- controllerAuthority,
5426
- assetAccessController,
5427
- authorizedUserRole: authorizedUserRole || null,
5428
- tokenLocksProgram: TL_PROGRAM,
5429
- investorLocks: deriveInvestorLocks(args.investorId, identityRegistry),
5430
- investor: deriveInvestorPda(args.investorId, identityRegistry),
5431
- systemProgram: web3_js.SystemProgram.programId,
5432
- tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
5433
- lockedTokenAccount: deriveLockedTokenAccount(args.investorId, identityRegistry),
5434
- })
5435
- .instruction();
5436
- });
5437
- }
5438
- /**
5439
- * Asynchronously add a lock to InvestorLocks.
5440
- * @param args - {@link AddTokenLockArgs}
5441
- * @param assetAccessController - RBAC AssetAccessController account.
5442
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
5443
- * @returns A Promise that resolves to a transaction instruction.
5444
- * */
5445
- addTokenLock(args, assetAccessController, authorizedUserRole) {
5446
- return __awaiter(this, void 0, void 0, function* () {
5447
- const assetController = rwaTokenSdk.getAssetControllerPda(args.assetMint);
5448
- const identityRegistry = rwaTokenSdk.getIdentityRegistryPda(args.assetMint);
5449
- const investorLocks = deriveInvestorLocks(args.investorId, identityRegistry);
5450
- const investor = deriveInvestorPda(args.investorId, identityRegistry);
5451
- const unlockedTokenAccount = splToken.getAssociatedTokenAddressSync(new web3_js.PublicKey(args.assetMint), args.wallet, false, splToken.TOKEN_2022_PROGRAM_ID);
5452
- const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
5453
- const ix = yield this.tokenLocksProgram.methods
5454
- .addTokenLock(args.value, args.releaseTime, args.reasonCode, args.reasonString)
5455
- .accountsStrict({
5456
- payer: args.payer,
5457
- authority: controllerAuthority,
5458
- investorLocks,
5459
- investor,
5460
- assetMint: args.assetMint,
5461
- identityAccount: rwaTokenSdk.getIdentityAccountPda(args.assetMint, investor.toString()),
5462
- unlockedTokenAccount,
5463
- lockedTokenAccount: deriveLockedTokenAccount(args.investorId, identityRegistry),
5464
- assetController,
5465
- assetControllerProgram: rwaTokenSdk.assetControllerProgramId,
5466
- tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
5467
- identityRegistry: rwaTokenSdk.getIdentityRegistryPda(args.assetMint),
5468
- systemProgram: web3_js.SystemProgram.programId,
5469
- walletIdentityAccount: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, args.wallet.toString()),
5470
- })
5471
- .instruction();
5472
- return this.rbacProgram.methods
5473
- .addTokenLock(ix.data)
5474
- .accountsStrict({
5475
- payer: args.payer,
5476
- user: args.signer,
5477
- controllerAuthority,
5478
- assetAccessController,
5479
- authorizedUserRole: authorizedUserRole || null,
5480
- tokenLocksProgram: TL_PROGRAM,
5481
- investorLocks,
5482
- investor,
5483
- assetMint: args.assetMint,
5484
- unlockedTokenAccount,
5485
- lockedTokenAccount: deriveLockedTokenAccount(args.investorId, identityRegistry),
5486
- assetController,
5487
- identityRegistry: rwaTokenSdk.getIdentityRegistryPda(args.assetMint),
5488
- assetControllerProgram: rwaTokenSdk.assetControllerProgramId,
5489
- tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
5490
- systemProgram: web3_js.SystemProgram.programId,
5491
- identityAccount: rwaTokenSdk.getIdentityAccountPda(args.assetMint, investor.toString()),
5492
- walletIdentityAccount: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, args.wallet.toString()),
5493
- })
5494
- .remainingAccounts([
5495
- {
5496
- pubkey: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
5497
- isWritable: true,
5498
- isSigner: false,
5499
- },
5500
- {
5501
- pubkey: rwaTokenSdk.identityRegistryProgramId,
5502
- isWritable: false,
5503
- isSigner: false,
5504
- },
5505
- {
5506
- pubkey: rwaTokenSdk.policyEngineProgramId,
5507
- isWritable: false,
5508
- isSigner: false,
5509
- },
5510
- {
5511
- pubkey: rwaTokenSdk.getIdentityRegistryPda(args.assetMint),
5512
- isWritable: false,
5513
- isSigner: false,
5514
- },
5515
- {
5516
- pubkey: rwaTokenSdk.getTrackerAccountPda(args.assetMint, investor.toString()),
5517
- isWritable: true,
5518
- isSigner: false,
5519
- },
5520
- {
5521
- pubkey: rwaTokenSdk.getExtraMetasListPda(args.assetMint),
5522
- isWritable: false,
5523
- isSigner: false,
5524
- },
5525
- {
5526
- pubkey: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, investor.toString()),
5527
- isWritable: false,
5528
- isSigner: false,
5529
- },
5530
- ])
5531
- .instruction();
5532
- });
5533
- }
5534
- /**
5535
- * Asynchronously remove a lock from InvestorLocks using RBAC authority.
5536
- * @param args - {@link RemoveTokenLockArgs}
5537
- * @param assetAccessController - RBAC AssetAccessController account.
5538
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
5539
- * @returns A Promise that resolves to a transaction instruction.
5540
- * */
5541
- removeTokenLock(args, assetAccessController, authorizedUserRole) {
5542
- return __awaiter(this, void 0, void 0, function* () {
5543
- const assetController = rwaTokenSdk.getAssetControllerPda(args.assetMint);
5544
- const identityRegistry = rwaTokenSdk.getIdentityRegistryPda(args.assetMint);
5545
- const investorLocks = deriveInvestorLocks(args.investorId, identityRegistry);
5546
- const investor = deriveInvestorPda(args.investorId, identityRegistry);
5547
- const unlockedTokenAccount = splToken.getAssociatedTokenAddressSync(new web3_js.PublicKey(args.assetMint), args.wallet, false, splToken.TOKEN_2022_PROGRAM_ID);
5548
- const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
5549
- return this.rbacProgram.methods
5550
- .removeTokenLock(Buffer.from(args.indices))
5551
- .accountsStrict({
5552
- user: args.signer,
5553
- controllerAuthority,
5554
- assetAccessController,
5555
- authorizedUserRole: authorizedUserRole || null,
5556
- tokenLocksProgram: TL_PROGRAM,
5557
- investorLocks,
5558
- investor,
5559
- identityAccount: rwaTokenSdk.getIdentityAccountPda(args.assetMint, investor.toString()),
5560
- walletIdentityAccount: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, args.wallet.toString()),
5561
- assetMint: args.assetMint,
5562
- unlockedTokenAccount,
5563
- lockedTokenAccount: deriveLockedTokenAccount(args.investorId, identityRegistry),
5564
- assetController,
5565
- identityRegistry: rwaTokenSdk.getIdentityRegistryPda(args.assetMint),
5566
- assetControllerProgram: rwaTokenSdk.assetControllerProgramId,
5567
- tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
5568
- })
5569
- .remainingAccounts([
5570
- {
5571
- pubkey: rwaTokenSdk.getPolicyEnginePda(args.assetMint),
5572
- isWritable: true,
5573
- isSigner: false,
5574
- },
5575
- {
5576
- pubkey: rwaTokenSdk.identityRegistryProgramId,
5577
- isWritable: false,
5578
- isSigner: false,
5579
- },
5580
- {
5581
- pubkey: rwaTokenSdk.policyEngineProgramId,
5582
- isWritable: false,
5583
- isSigner: false,
5584
- },
5585
- {
5586
- pubkey: rwaTokenSdk.getIdentityRegistryPda(args.assetMint),
5587
- isWritable: false,
5588
- isSigner: false,
5589
- },
5590
- {
5591
- pubkey: rwaTokenSdk.getTrackerAccountPda(args.assetMint, investor.toString()),
5592
- isWritable: true,
5593
- isSigner: false,
5594
- },
5595
- {
5596
- pubkey: rwaTokenSdk.getExtraMetasListPda(args.assetMint),
5597
- isWritable: false,
5598
- isSigner: false,
5599
- },
5600
- {
5601
- pubkey: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, investor.toString()),
5602
- isWritable: false,
5603
- isSigner: false,
5604
- },
5605
- ])
5606
- .instruction();
5607
- });
5608
- }
5609
- /**
5610
- * Asynchronously fetches a token account.
5611
- * @param account - Account to load.
5612
- * @returns A Promise that resolves to a token account.
5613
- * */
5614
- fetchTokenAccount(account_1) {
5615
- return __awaiter(this, arguments, void 0, function* (account, commitment = "processed") {
5616
- return splToken.getAccount(this.rwaClient.provider.connection, account, commitment, splToken.TOKEN_2022_PROGRAM_ID);
5617
- });
5618
- }
5619
- }
5620
-
5621
5040
  class RwaRbacClient {
5622
5041
  constructor(config, provider) {
5623
5042
  this.rwaClient = new rwaTokenSdk.RwaClient(config, provider);
@@ -5627,7 +5046,27 @@ class RwaRbacClient {
5627
5046
  this.policyEngine = new PolicyEngine(this.rwaClient, this.rbacProgram);
5628
5047
  this.identityRegistry = new IdentityRegistry(this.rwaClient, this.rbacProgram);
5629
5048
  this.identityMetadataRegistry = new IdentityMetadataRegistry(this.rwaClient, this.rbacProgram, new anchor.Program(imrIDL, this.provider));
5630
- this.tokenLocks = new TokenLocks(this.rwaClient, this.rbacProgram, new anchor.Program(tokenLocksIdl, this.provider));
5049
+ }
5050
+ /**
5051
+ * Parses inner instructions data field for array of events emitted by program using CPI Events.
5052
+ * @param ixs - Array of CompiledInstruction from a transaction inner instructions.
5053
+ * @returns Array of Events
5054
+ * */
5055
+ parseEvents(ixs) {
5056
+ const eventCoder = this.rbacProgram.coder.events;
5057
+ const events = ixs
5058
+ .map(({ data }) => {
5059
+ try {
5060
+ const buffer = Buffer.from(anchor.utils.bytes.bs58.decode(data));
5061
+ const event = eventCoder.decode(anchor.utils.bytes.base64.encode(buffer.slice(8)));
5062
+ return event;
5063
+ }
5064
+ catch (err) {
5065
+ console.error("Error decoding events", err);
5066
+ }
5067
+ })
5068
+ .filter((v) => v != null);
5069
+ return events;
5631
5070
  }
5632
5071
  /**
5633
5072
  * Asynchronously generates instruction to create AssetAccessController for an organization.
@@ -5738,6 +5177,8 @@ class RwaRbacClient {
5738
5177
  authorizedUserRole: args.authorizedUserRole || null,
5739
5178
  assetAccessController: args.assetAccessController,
5740
5179
  systemProgram: web3_js.SystemProgram.programId,
5180
+ eventAuthority: getEventAuthority(RBAC_PROGRAM),
5181
+ program: RBAC_PROGRAM,
5741
5182
  })
5742
5183
  .instruction();
5743
5184
  });
@@ -5756,6 +5197,8 @@ class RwaRbacClient {
5756
5197
  userRole: args.userRole,
5757
5198
  authorizedUserRole: args.authorizedUserRole || null,
5758
5199
  assetAccessController: args.assetAccessController,
5200
+ eventAuthority: getEventAuthority(RBAC_PROGRAM),
5201
+ program: RBAC_PROGRAM,
5759
5202
  })
5760
5203
  .instruction();
5761
5204
  });
@@ -5799,8 +5242,6 @@ exports.RwaImrIdl = rwa_imr;
5799
5242
  exports.RwaRbacClient = RwaRbacClient;
5800
5243
  exports.RwaRbacIdl = rwa_rbac;
5801
5244
  exports.TL_PROGRAM = TL_PROGRAM;
5802
- exports.TokenLocks = TokenLocks;
5803
- exports.TokenLocksIdl = token_locks;
5804
5245
  exports.computeFlags = computeFlags;
5805
5246
  exports.deriveAssetAccessControllerPda = deriveAssetAccessControllerPda;
5806
5247
  exports.deriveControllerAuthorityPda = deriveControllerAuthorityPda;
@@ -5808,3 +5249,4 @@ exports.deriveInvestorLocks = deriveInvestorLocks;
5808
5249
  exports.deriveInvestorPda = deriveInvestorPda;
5809
5250
  exports.deriveLockedTokenAccount = deriveLockedTokenAccount;
5810
5251
  exports.deriveUserRolePda = deriveUserRolePda;
5252
+ exports.getEventAuthority = getEventAuthority;