@dstoken-solana/rwa-rbac 0.2.1 → 0.4.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.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PublicKey, SystemProgram } from '@solana/web3.js';
2
2
  import { utils, Program, BN } from '@coral-xyz/anchor';
3
3
  import { TOKEN_2022_PROGRAM_ID, getAssociatedTokenAddressSync, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
4
- import { getCreateAssetControllerIx, getAssetControllerPda, assetControllerProgramId, getAssetControllerEventAuthority, getIdentityRegistryPda, getIssueTokensIx, getTrackerAccountPda, getPolicyEnginePda, policyEngineProgramId, getIdentityAccountPda, getWalletIdentityAccountPda, getFreezeTokenIx, getThawTokenIx, getRevokeTokensIx, getCloseMintIx, getUpdateInterestBearingMintRateIx, getSeizeTokensIx, identityRegistryProgramId, getExtraMetasListPda, getPolicyEngineEventAuthority, getIdentityRegistryEventAuthority, getIdentityAccount, getRemoveLevelFromIdentityAccount, getIdentityRegistryProgram, getPolicyEngineProgram, RwaClient } from '@dstoken-solana/rwa-token-sdk';
4
+ import { getCreateAssetControllerIx, getAssetControllerPda, assetControllerProgramId, getAssetControllerEventAuthority, getIdentityRegistryPda, getIssueTokensIx, getTrackerAccountPda, getPolicyEnginePda, policyEngineProgramId, getIdentityAccountPda, getWalletIdentityAccountPda, getFreezeTokenIx, getThawTokenIx, getRevokeTokensIx, getUpdateInterestBearingMintRateIx, getSeizeTokensIx, identityRegistryProgramId, getExtraMetasListPda, getPolicyEngineEventAuthority, getIdentityRegistryEventAuthority, getIdentityAccount, getIdentityRegistryProgram, RwaClient } from '@dstoken-solana/rwa-token-sdk';
5
5
 
6
6
  const IMR_PROGRAM = new PublicKey("D2V7wTBbNCKgYwirgRUnSmc2QyKnHSVmRotWJ4rz8Jp9");
7
7
  const RBAC_PROGRAM = new PublicKey("3g6fUgMsJQhjPUYxNjEU5PyzGf8DerbDx8p5Qh4yMnRR");
@@ -51,98 +51,6 @@ var metadata$1 = {
51
51
  description: "Created with Anchor"
52
52
  };
53
53
  var instructions$1 = [
54
- {
55
- name: "add_level_to_identity_account",
56
- discriminator: [
57
- 102,
58
- 204,
59
- 64,
60
- 169,
61
- 252,
62
- 177,
63
- 192,
64
- 232
65
- ],
66
- accounts: [
67
- {
68
- name: "payer",
69
- writable: true,
70
- signer: true
71
- },
72
- {
73
- name: "user",
74
- signer: true
75
- },
76
- {
77
- name: "controller_authority",
78
- relations: [
79
- "asset_access_controller"
80
- ]
81
- },
82
- {
83
- name: "asset_access_controller",
84
- relations: [
85
- "authorized_user_role"
86
- ]
87
- },
88
- {
89
- name: "authorized_user_role",
90
- optional: true
91
- },
92
- {
93
- name: "identity_registry_program",
94
- address: "GZsnjqT3c5zbHqsctrJ4EG4rbEfo7ZXyyUG7aDJNmxfA"
95
- },
96
- {
97
- name: "identity_registry"
98
- },
99
- {
100
- name: "identity_account",
101
- writable: true
102
- },
103
- {
104
- name: "identity_account_owner",
105
- docs: [
106
- "to ensure that it is not an Investor account. If it is an Investor account,",
107
- "CPI to IdentityMetadataRegistry should be called."
108
- ]
109
- },
110
- {
111
- name: "system_program",
112
- address: "11111111111111111111111111111111"
113
- },
114
- {
115
- name: "policy_engine_program"
116
- },
117
- {
118
- name: "policy_engine",
119
- writable: true
120
- },
121
- {
122
- name: "tracker_account"
123
- },
124
- {
125
- name: "asset_mint"
126
- },
127
- {
128
- name: "event_authority"
129
- }
130
- ],
131
- args: [
132
- {
133
- name: "level",
134
- type: "u8"
135
- },
136
- {
137
- name: "expiry",
138
- type: "i64"
139
- },
140
- {
141
- name: "enforce_limits",
142
- type: "bool"
143
- }
144
- ]
145
- },
146
54
  {
147
55
  name: "add_levels",
148
56
  discriminator: [
@@ -178,8 +86,7 @@ var instructions$1 = [
178
86
  ]
179
87
  },
180
88
  {
181
- name: "authorized_user_role",
182
- optional: true
89
+ name: "authorized_user_role"
183
90
  },
184
91
  {
185
92
  name: "identity_metadata_registry_program",
@@ -266,8 +173,7 @@ var instructions$1 = [
266
173
  ]
267
174
  },
268
175
  {
269
- name: "authorized_user_role",
270
- optional: true
176
+ name: "authorized_user_role"
271
177
  },
272
178
  {
273
179
  name: "policy_engine_program",
@@ -329,6 +235,7 @@ var instructions$1 = [
329
235
  },
330
236
  {
331
237
  name: "asset_access_controller",
238
+ writable: true,
332
239
  relations: [
333
240
  "user_role",
334
241
  "authorized_user_role"
@@ -423,8 +330,7 @@ var instructions$1 = [
423
330
  ]
424
331
  },
425
332
  {
426
- name: "authorized_user_role",
427
- optional: true
333
+ name: "authorized_user_role"
428
334
  },
429
335
  {
430
336
  name: "policy_engine_program",
@@ -484,8 +390,7 @@ var instructions$1 = [
484
390
  ]
485
391
  },
486
392
  {
487
- name: "authorized_user_role",
488
- optional: true
393
+ name: "authorized_user_role"
489
394
  },
490
395
  {
491
396
  name: "identity_registry_program",
@@ -555,8 +460,7 @@ var instructions$1 = [
555
460
  ]
556
461
  },
557
462
  {
558
- name: "authorized_user_role",
559
- optional: true
463
+ name: "authorized_user_role"
560
464
  },
561
465
  {
562
466
  name: "policy_engine_program",
@@ -616,8 +520,7 @@ var instructions$1 = [
616
520
  ]
617
521
  },
618
522
  {
619
- name: "authorized_user_role",
620
- optional: true
523
+ name: "authorized_user_role"
621
524
  },
622
525
  {
623
526
  name: "policy_engine_program",
@@ -677,8 +580,7 @@ var instructions$1 = [
677
580
  ]
678
581
  },
679
582
  {
680
- name: "authorized_user_role",
681
- optional: true
583
+ name: "authorized_user_role"
682
584
  },
683
585
  {
684
586
  name: "identity_metadata_registry_program",
@@ -758,8 +660,7 @@ var instructions$1 = [
758
660
  ]
759
661
  },
760
662
  {
761
- name: "authorized_user_role",
762
- optional: true
663
+ name: "authorized_user_role"
763
664
  },
764
665
  {
765
666
  name: "policy_engine_program",
@@ -815,8 +716,7 @@ var instructions$1 = [
815
716
  ]
816
717
  },
817
718
  {
818
- name: "authorized_user_role",
819
- optional: true
719
+ name: "authorized_user_role"
820
720
  },
821
721
  {
822
722
  name: "policy_engine_program",
@@ -837,63 +737,6 @@ var instructions$1 = [
837
737
  }
838
738
  ]
839
739
  },
840
- {
841
- name: "close_mint_account",
842
- discriminator: [
843
- 14,
844
- 121,
845
- 72,
846
- 246,
847
- 96,
848
- 224,
849
- 42,
850
- 162
851
- ],
852
- accounts: [
853
- {
854
- name: "user",
855
- signer: true
856
- },
857
- {
858
- name: "controller_authority",
859
- writable: true,
860
- relations: [
861
- "asset_access_controller"
862
- ]
863
- },
864
- {
865
- name: "asset_access_controller",
866
- relations: [
867
- "authorized_user_role"
868
- ]
869
- },
870
- {
871
- name: "authorized_user_role",
872
- optional: true
873
- },
874
- {
875
- name: "asset_controller_program",
876
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
877
- },
878
- {
879
- name: "asset_mint",
880
- writable: true
881
- },
882
- {
883
- name: "asset_controller"
884
- },
885
- {
886
- name: "token_program",
887
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
888
- }
889
- ],
890
- args: [
891
- {
892
- name: "cpi_data",
893
- type: "bytes"
894
- }
895
- ]
896
- },
897
740
  {
898
741
  name: "create_controller",
899
742
  discriminator: [
@@ -922,8 +765,8 @@ var instructions$1 = [
922
765
  pda: {
923
766
  seeds: [
924
767
  {
925
- kind: "arg",
926
- path: "unique_seed"
768
+ kind: "account",
769
+ path: "asset_mint"
927
770
  },
928
771
  {
929
772
  kind: "const",
@@ -954,6 +797,53 @@ var instructions$1 = [
954
797
  ]
955
798
  }
956
799
  },
800
+ {
801
+ name: "asset_access_controller_authority",
802
+ pda: {
803
+ seeds: [
804
+ {
805
+ kind: "account",
806
+ path: "asset_access_controller"
807
+ }
808
+ ]
809
+ }
810
+ },
811
+ {
812
+ name: "asset_controller",
813
+ writable: true
814
+ },
815
+ {
816
+ name: "asset_mint",
817
+ writable: true,
818
+ signer: true
819
+ },
820
+ {
821
+ name: "extra_metas_account",
822
+ writable: true
823
+ },
824
+ {
825
+ name: "policy_engine_account",
826
+ writable: true
827
+ },
828
+ {
829
+ name: "identity_registry_account",
830
+ writable: true
831
+ },
832
+ {
833
+ name: "policy_engine_program"
834
+ },
835
+ {
836
+ name: "identity_registry_program"
837
+ },
838
+ {
839
+ name: "asset_controller_program"
840
+ },
841
+ {
842
+ name: "asset_controller_event_authority"
843
+ },
844
+ {
845
+ name: "token_program"
846
+ },
957
847
  {
958
848
  name: "system_program",
959
849
  address: "11111111111111111111111111111111"
@@ -961,8 +851,8 @@ var instructions$1 = [
961
851
  ],
962
852
  args: [
963
853
  {
964
- name: "unique_seed",
965
- type: "pubkey"
854
+ name: "cpi_data",
855
+ type: "bytes"
966
856
  }
967
857
  ]
968
858
  },
@@ -1001,8 +891,7 @@ var instructions$1 = [
1001
891
  ]
1002
892
  },
1003
893
  {
1004
- name: "authorized_user_role",
1005
- optional: true
894
+ name: "authorized_user_role"
1006
895
  },
1007
896
  {
1008
897
  name: "identity_registry_program",
@@ -1019,6 +908,16 @@ var instructions$1 = [
1019
908
  name: "wallet_identity",
1020
909
  writable: true
1021
910
  },
911
+ {
912
+ name: "policy_engine_program"
913
+ },
914
+ {
915
+ name: "tracker_account",
916
+ writable: true
917
+ },
918
+ {
919
+ name: "asset_mint"
920
+ },
1022
921
  {
1023
922
  name: "system_program",
1024
923
  address: "11111111111111111111111111111111"
@@ -1088,6 +987,10 @@ var instructions$1 = [
1088
987
  {
1089
988
  name: "allowed_medici_ixs",
1090
989
  type: "u64"
990
+ },
991
+ {
992
+ name: "is_master_role",
993
+ type: "bool"
1091
994
  }
1092
995
  ]
1093
996
  },
@@ -1166,8 +1069,7 @@ var instructions$1 = [
1166
1069
  ]
1167
1070
  },
1168
1071
  {
1169
- name: "authorized_user_role",
1170
- optional: true
1072
+ name: "authorized_user_role"
1171
1073
  },
1172
1074
  {
1173
1075
  name: "policy_engine_program",
@@ -1228,8 +1130,7 @@ var instructions$1 = [
1228
1130
  ]
1229
1131
  },
1230
1132
  {
1231
- name: "authorized_user_role",
1232
- optional: true
1133
+ name: "authorized_user_role"
1233
1134
  },
1234
1135
  {
1235
1136
  name: "identity_registry_program",
@@ -1246,6 +1147,12 @@ var instructions$1 = [
1246
1147
  {
1247
1148
  name: "identity_registry"
1248
1149
  },
1150
+ {
1151
+ name: "token_account"
1152
+ },
1153
+ {
1154
+ name: "asset_mint"
1155
+ },
1249
1156
  {
1250
1157
  name: "event_authority"
1251
1158
  }
@@ -1287,8 +1194,7 @@ var instructions$1 = [
1287
1194
  ]
1288
1195
  },
1289
1196
  {
1290
- name: "authorized_user_role",
1291
- optional: true
1197
+ name: "authorized_user_role"
1292
1198
  },
1293
1199
  {
1294
1200
  name: "asset_controller_program",
@@ -1353,8 +1259,7 @@ var instructions$1 = [
1353
1259
  ]
1354
1260
  },
1355
1261
  {
1356
- name: "authorized_user_role",
1357
- optional: true
1262
+ name: "authorized_user_role"
1358
1263
  },
1359
1264
  {
1360
1265
  name: "asset_controller_program",
@@ -1467,63 +1372,6 @@ var instructions$1 = [
1467
1372
  }
1468
1373
  ]
1469
1374
  },
1470
- {
1471
- name: "refresh_level_to_identity_account",
1472
- discriminator: [
1473
- 23,
1474
- 68,
1475
- 237,
1476
- 111,
1477
- 144,
1478
- 169,
1479
- 239,
1480
- 91
1481
- ],
1482
- accounts: [
1483
- {
1484
- name: "payer",
1485
- writable: true,
1486
- signer: true
1487
- },
1488
- {
1489
- name: "user",
1490
- signer: true
1491
- },
1492
- {
1493
- name: "controller_authority",
1494
- relations: [
1495
- "asset_access_controller"
1496
- ]
1497
- },
1498
- {
1499
- name: "asset_access_controller",
1500
- relations: [
1501
- "authorized_user_role"
1502
- ]
1503
- },
1504
- {
1505
- name: "authorized_user_role",
1506
- optional: true
1507
- },
1508
- {
1509
- name: "identity_registry_program",
1510
- address: "GZsnjqT3c5zbHqsctrJ4EG4rbEfo7ZXyyUG7aDJNmxfA"
1511
- },
1512
- {
1513
- name: "identity_registry"
1514
- },
1515
- {
1516
- name: "identity_account",
1517
- writable: true
1518
- }
1519
- ],
1520
- args: [
1521
- {
1522
- name: "cpi_data",
1523
- type: "bytes"
1524
- }
1525
- ]
1526
- },
1527
1375
  {
1528
1376
  name: "register_investor",
1529
1377
  discriminator: [
@@ -1559,8 +1407,7 @@ var instructions$1 = [
1559
1407
  ]
1560
1408
  },
1561
1409
  {
1562
- name: "authorized_user_role",
1563
- optional: true
1410
+ name: "authorized_user_role"
1564
1411
  },
1565
1412
  {
1566
1413
  name: "identity_metadata_registry_program",
@@ -1585,6 +1432,16 @@ var instructions$1 = [
1585
1432
  name: "wallet_identity",
1586
1433
  writable: true
1587
1434
  },
1435
+ {
1436
+ name: "policy_engine_program"
1437
+ },
1438
+ {
1439
+ name: "tracker_account",
1440
+ writable: true
1441
+ },
1442
+ {
1443
+ name: "asset_mint"
1444
+ },
1588
1445
  {
1589
1446
  name: "event_authority_identity_metadata_registry"
1590
1447
  },
@@ -1609,78 +1466,11 @@ var instructions$1 = [
1609
1466
  78,
1610
1467
  35,
1611
1468
  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
- },
1673
- {
1674
- name: "remove_investor",
1675
- discriminator: [
1676
- 93,
1677
- 0,
1678
- 162,
1679
- 199,
1680
- 76,
1681
- 5,
1682
- 180,
1683
- 2
1469
+ 50,
1470
+ 72,
1471
+ 181,
1472
+ 12,
1473
+ 42
1684
1474
  ],
1685
1475
  accounts: [
1686
1476
  {
@@ -1705,16 +1495,7 @@ var instructions$1 = [
1705
1495
  ]
1706
1496
  },
1707
1497
  {
1708
- name: "authorized_user_role",
1709
- optional: true
1710
- },
1711
- {
1712
- name: "identity_metadata_registry_program",
1713
- address: "D2V7wTBbNCKgYwirgRUnSmc2QyKnHSVmRotWJ4rz8Jp9"
1714
- },
1715
- {
1716
- name: "investor",
1717
- writable: true
1498
+ name: "authorized_user_role"
1718
1499
  },
1719
1500
  {
1720
1501
  name: "identity_registry_program",
@@ -1732,34 +1513,40 @@ var instructions$1 = [
1732
1513
  writable: true
1733
1514
  },
1734
1515
  {
1735
- name: "policy_engine_program",
1736
- address: "FsE8mCJyvgMzqJbfHbJQm3iuf3cRZC6n2vZi1Q8rQCy2"
1516
+ name: "event_authority"
1737
1517
  },
1738
1518
  {
1739
- name: "tracker_account",
1740
- writable: true
1519
+ name: "identity_owner"
1741
1520
  },
1742
1521
  {
1743
- name: "event_authority_identity_metadata_registry"
1522
+ name: "policy_engine_program"
1744
1523
  },
1745
1524
  {
1746
- name: "event_authority_identity_registry"
1525
+ name: "tracker_account",
1526
+ writable: true
1527
+ },
1528
+ {
1529
+ name: "asset_mint"
1747
1530
  }
1748
1531
  ],
1749
1532
  args: [
1533
+ {
1534
+ name: "cpi_data",
1535
+ type: "bytes"
1536
+ }
1750
1537
  ]
1751
1538
  },
1752
1539
  {
1753
- name: "remove_level_from_identity_account",
1540
+ name: "remove_investor",
1754
1541
  discriminator: [
1755
- 194,
1756
- 231,
1757
- 187,
1758
- 54,
1759
- 197,
1760
- 136,
1761
- 170,
1762
- 55
1542
+ 93,
1543
+ 0,
1544
+ 162,
1545
+ 199,
1546
+ 76,
1547
+ 5,
1548
+ 180,
1549
+ 2
1763
1550
  ],
1764
1551
  accounts: [
1765
1552
  {
@@ -1784,8 +1571,15 @@ var instructions$1 = [
1784
1571
  ]
1785
1572
  },
1786
1573
  {
1787
- name: "authorized_user_role",
1788
- optional: true
1574
+ name: "authorized_user_role"
1575
+ },
1576
+ {
1577
+ name: "identity_metadata_registry_program",
1578
+ address: "D2V7wTBbNCKgYwirgRUnSmc2QyKnHSVmRotWJ4rz8Jp9"
1579
+ },
1580
+ {
1581
+ name: "investor",
1582
+ writable: true
1789
1583
  },
1790
1584
  {
1791
1585
  name: "identity_registry_program",
@@ -1799,38 +1593,28 @@ var instructions$1 = [
1799
1593
  writable: true
1800
1594
  },
1801
1595
  {
1802
- name: "identity_account_owner",
1803
- docs: [
1804
- "to ensure that it is not an Investor account. If it is an Investor account,",
1805
- "CPI to IdentityMetadataRegistry should be called."
1806
- ]
1807
- },
1808
- {
1809
- name: "system_program",
1810
- address: "11111111111111111111111111111111"
1596
+ name: "wallet_identity",
1597
+ writable: true
1811
1598
  },
1812
1599
  {
1813
- name: "policy_engine_program"
1600
+ name: "policy_engine_program",
1601
+ address: "FsE8mCJyvgMzqJbfHbJQm3iuf3cRZC6n2vZi1Q8rQCy2"
1814
1602
  },
1815
1603
  {
1816
- name: "policy_engine",
1604
+ name: "tracker_account",
1817
1605
  writable: true
1818
1606
  },
1819
1607
  {
1820
- name: "tracker_account"
1608
+ name: "event_authority_identity_metadata_registry"
1821
1609
  },
1822
1610
  {
1823
- name: "asset_mint"
1611
+ name: "event_authority_identity_registry"
1824
1612
  },
1825
1613
  {
1826
- name: "event_authority"
1614
+ name: "asset_mint"
1827
1615
  }
1828
1616
  ],
1829
1617
  args: [
1830
- {
1831
- name: "cpi_data",
1832
- type: "bytes"
1833
- }
1834
1618
  ]
1835
1619
  },
1836
1620
  {
@@ -1868,8 +1652,7 @@ var instructions$1 = [
1868
1652
  ]
1869
1653
  },
1870
1654
  {
1871
- name: "authorized_user_role",
1872
- optional: true
1655
+ name: "authorized_user_role"
1873
1656
  },
1874
1657
  {
1875
1658
  name: "identity_metadata_registry_program",
@@ -1953,8 +1736,7 @@ var instructions$1 = [
1953
1736
  ]
1954
1737
  },
1955
1738
  {
1956
- name: "authorized_user_role",
1957
- optional: true
1739
+ name: "authorized_user_role"
1958
1740
  },
1959
1741
  {
1960
1742
  name: "policy_engine_program",
@@ -2097,8 +1879,7 @@ var instructions$1 = [
2097
1879
  ]
2098
1880
  },
2099
1881
  {
2100
- name: "authorized_user_role",
2101
- optional: true
1882
+ name: "authorized_user_role"
2102
1883
  },
2103
1884
  {
2104
1885
  name: "asset_controller_program",
@@ -2189,8 +1970,7 @@ var instructions$1 = [
2189
1970
  ]
2190
1971
  },
2191
1972
  {
2192
- name: "authorized_user_role",
2193
- optional: true
1973
+ name: "authorized_user_role"
2194
1974
  },
2195
1975
  {
2196
1976
  name: "asset_controller_program",
@@ -2260,8 +2040,7 @@ var instructions$1 = [
2260
2040
  ]
2261
2041
  },
2262
2042
  {
2263
- name: "authorized_user_role",
2264
- optional: true
2043
+ name: "authorized_user_role"
2265
2044
  },
2266
2045
  {
2267
2046
  name: "policy_engine_program",
@@ -2347,8 +2126,7 @@ var instructions$1 = [
2347
2126
  ]
2348
2127
  },
2349
2128
  {
2350
- name: "authorized_user_role",
2351
- optional: true
2129
+ name: "authorized_user_role"
2352
2130
  },
2353
2131
  {
2354
2132
  name: "asset_controller_program",
@@ -2417,8 +2195,7 @@ var instructions$1 = [
2417
2195
  ]
2418
2196
  },
2419
2197
  {
2420
- name: "authorized_user_role",
2421
- optional: true
2198
+ name: "authorized_user_role"
2422
2199
  },
2423
2200
  {
2424
2201
  name: "asset_controller_program",
@@ -2512,8 +2289,7 @@ var instructions$1 = [
2512
2289
  ]
2513
2290
  },
2514
2291
  {
2515
- name: "authorized_user_role",
2516
- optional: true
2292
+ name: "authorized_user_role"
2517
2293
  },
2518
2294
  {
2519
2295
  name: "asset_controller_program",
@@ -2680,6 +2456,31 @@ var errors$1 = [
2680
2456
  code: 6007,
2681
2457
  name: "IllegalOperation",
2682
2458
  msg: "Illegal operation"
2459
+ },
2460
+ {
2461
+ code: 6008,
2462
+ name: "InvalidFlags",
2463
+ msg: "Invalid flag bits"
2464
+ },
2465
+ {
2466
+ code: 6009,
2467
+ name: "CannotEmptyMasterRole",
2468
+ msg: "Cannot empty master role of users"
2469
+ },
2470
+ {
2471
+ code: 6010,
2472
+ name: "CannotVoidAuthority",
2473
+ msg: "Cannot void authority"
2474
+ },
2475
+ {
2476
+ code: 6011,
2477
+ name: "InvalidMasterRole",
2478
+ msg: "Invalid master role"
2479
+ },
2480
+ {
2481
+ code: 6012,
2482
+ name: "CannotDeleteMasterRole",
2483
+ msg: "Cannot delete master role"
2683
2484
  }
2684
2485
  ];
2685
2486
  var types$1 = [
@@ -2710,9 +2511,9 @@ var types$1 = [
2710
2511
  type: "pubkey"
2711
2512
  },
2712
2513
  {
2713
- name: "unique_seed",
2514
+ name: "asset_mint",
2714
2515
  docs: [
2715
- "Unique seed used for creating this account."
2516
+ "Asset mint that is going to be managed by this controller."
2716
2517
  ],
2717
2518
  type: "pubkey"
2718
2519
  },
@@ -2723,6 +2524,13 @@ var types$1 = [
2723
2524
  ],
2724
2525
  type: "u64"
2725
2526
  },
2527
+ {
2528
+ name: "has_master_role",
2529
+ docs: [
2530
+ "Whether a master role exists."
2531
+ ],
2532
+ type: "bool"
2533
+ },
2726
2534
  {
2727
2535
  name: "lut_address",
2728
2536
  docs: [
@@ -2757,7 +2565,7 @@ var types$1 = [
2757
2565
  type: "pubkey"
2758
2566
  },
2759
2567
  {
2760
- name: "seed",
2568
+ name: "asset_mint",
2761
2569
  type: "pubkey"
2762
2570
  }
2763
2571
  ]
@@ -2787,7 +2595,7 @@ var types$1 = [
2787
2595
  type: "pubkey"
2788
2596
  },
2789
2597
  {
2790
- name: "seed",
2598
+ name: "asset_mint",
2791
2599
  type: "pubkey"
2792
2600
  }
2793
2601
  ]
@@ -2833,6 +2641,13 @@ var types$1 = [
2833
2641
  ],
2834
2642
  type: "u64"
2835
2643
  },
2644
+ {
2645
+ name: "is_master_role",
2646
+ docs: [
2647
+ "If true, this is the master role."
2648
+ ],
2649
+ type: "bool"
2650
+ },
2836
2651
  {
2837
2652
  name: "users",
2838
2653
  docs: [
@@ -3196,6 +3011,16 @@ var instructions = [
3196
3011
  name: "wallet_identity",
3197
3012
  writable: true
3198
3013
  },
3014
+ {
3015
+ name: "policy_engine_program"
3016
+ },
3017
+ {
3018
+ name: "tracker_account",
3019
+ writable: true
3020
+ },
3021
+ {
3022
+ name: "asset_mint"
3023
+ },
3199
3024
  {
3200
3025
  name: "system_program",
3201
3026
  address: "11111111111111111111111111111111"
@@ -3318,6 +3143,9 @@ var instructions = [
3318
3143
  {
3319
3144
  name: "event_authority_identity_registry"
3320
3145
  },
3146
+ {
3147
+ name: "asset_mint"
3148
+ },
3321
3149
  {
3322
3150
  name: "event_authority",
3323
3151
  pda: {
@@ -3772,33 +3600,32 @@ var MediciFlags;
3772
3600
  MediciFlags[MediciFlags["FREEZE_TOKEN_ACCOUNT"] = 4] = "FREEZE_TOKEN_ACCOUNT";
3773
3601
  MediciFlags[MediciFlags["ISSUE_TOKENS"] = 8] = "ISSUE_TOKENS";
3774
3602
  MediciFlags[MediciFlags["REVOKE_TOKENS"] = 16] = "REVOKE_TOKENS";
3775
- MediciFlags[MediciFlags["CLOSE_MINT_ACCOUNT"] = 32] = "CLOSE_MINT_ACCOUNT";
3776
- MediciFlags[MediciFlags["UPDATE_INTEREST_BEARING_MINT_RATE"] = 64] = "UPDATE_INTEREST_BEARING_MINT_RATE";
3777
- MediciFlags[MediciFlags["ATTACH_TO_POLICY_ACCOUNT"] = 128] = "ATTACH_TO_POLICY_ACCOUNT";
3778
- MediciFlags[MediciFlags["CREATE_POLICY_ACCOUNT"] = 256] = "CREATE_POLICY_ACCOUNT";
3779
- MediciFlags[MediciFlags["DETACH_FROM_POLICY_ACCOUNT"] = 512] = "DETACH_FROM_POLICY_ACCOUNT";
3780
- MediciFlags[MediciFlags["ADD_LEVELS"] = 1024] = "ADD_LEVELS";
3781
- MediciFlags[MediciFlags["ADD_LEVEL_TO_IDENTITY_ACCOUNT"] = 2048] = "ADD_LEVEL_TO_IDENTITY_ACCOUNT";
3782
- MediciFlags[MediciFlags["REGISTER_INVESTOR"] = 4096] = "REGISTER_INVESTOR";
3783
- MediciFlags[MediciFlags["REMOVE_LEVELS"] = 8192] = "REMOVE_LEVELS";
3784
- MediciFlags[MediciFlags["REMOVE_INVESTOR"] = 16384] = "REMOVE_INVESTOR";
3785
- MediciFlags[MediciFlags["EDIT_IDENTITY_METADATA"] = 32768] = "EDIT_IDENTITY_METADATA";
3786
- MediciFlags[MediciFlags["REFRESH_LEVEL_TO_IDENTITY_ACCOUNT"] = 65536] = "REFRESH_LEVEL_TO_IDENTITY_ACCOUNT";
3787
- MediciFlags[MediciFlags["ATTACH_WALLET_TO_IDENTITY"] = 131072] = "ATTACH_WALLET_TO_IDENTITY";
3788
- MediciFlags[MediciFlags["DETACH_WALLET_FROM_IDENTITY"] = 262144] = "DETACH_WALLET_FROM_IDENTITY";
3789
- MediciFlags[MediciFlags["SEIZE_TOKENS"] = 524288] = "SEIZE_TOKENS";
3790
- MediciFlags[MediciFlags["CREATE_IDENTITY_ACCOUNT"] = 1048576] = "CREATE_IDENTITY_ACCOUNT";
3791
- MediciFlags[MediciFlags["CREATE_INVESTOR_LOCKS"] = 2097152] = "CREATE_INVESTOR_LOCKS";
3792
- MediciFlags[MediciFlags["CLOSE_INVESTOR_LOCKS"] = 4194304] = "CLOSE_INVESTOR_LOCKS";
3793
- MediciFlags[MediciFlags["ADD_TOKEN_LOCK"] = 8388608] = "ADD_TOKEN_LOCK";
3794
- MediciFlags[MediciFlags["REMOVE_TOKEN_LOCK"] = 16777216] = "REMOVE_TOKEN_LOCK";
3795
- MediciFlags[MediciFlags["CHANGE_COUNTERS"] = 33554432] = "CHANGE_COUNTERS";
3796
- MediciFlags[MediciFlags["CHANGE_COUNTER_LIMITS"] = 67108864] = "CHANGE_COUNTER_LIMITS";
3797
- MediciFlags[MediciFlags["CHANGE_COUNTRY"] = 134217728] = "CHANGE_COUNTRY";
3798
- MediciFlags[MediciFlags["CHANGE_MAPPING"] = 268435456] = "CHANGE_MAPPING";
3799
- MediciFlags[MediciFlags["CHANGE_ISSUANCE_POLICIES"] = 536870912] = "CHANGE_ISSUANCE_POLICIES";
3800
- MediciFlags[MediciFlags["REMOVE_IDENTITY_ACCOUNT"] = 1073741824] = "REMOVE_IDENTITY_ACCOUNT";
3801
- MediciFlags[MediciFlags["ALL"] = 2147483647] = "ALL";
3603
+ MediciFlags[MediciFlags["UPDATE_INTEREST_BEARING_MINT_RATE"] = 32] = "UPDATE_INTEREST_BEARING_MINT_RATE";
3604
+ MediciFlags[MediciFlags["ATTACH_TO_POLICY_ACCOUNT"] = 64] = "ATTACH_TO_POLICY_ACCOUNT";
3605
+ MediciFlags[MediciFlags["CREATE_POLICY_ACCOUNT"] = 128] = "CREATE_POLICY_ACCOUNT";
3606
+ MediciFlags[MediciFlags["DETACH_FROM_POLICY_ACCOUNT"] = 256] = "DETACH_FROM_POLICY_ACCOUNT";
3607
+ MediciFlags[MediciFlags["ADD_LEVELS"] = 512] = "ADD_LEVELS";
3608
+ MediciFlags[MediciFlags["ADD_LEVEL_TO_IDENTITY_ACCOUNT"] = 1024] = "ADD_LEVEL_TO_IDENTITY_ACCOUNT";
3609
+ MediciFlags[MediciFlags["REGISTER_INVESTOR"] = 2048] = "REGISTER_INVESTOR";
3610
+ MediciFlags[MediciFlags["REMOVE_LEVELS"] = 4096] = "REMOVE_LEVELS";
3611
+ MediciFlags[MediciFlags["REMOVE_INVESTOR"] = 8192] = "REMOVE_INVESTOR";
3612
+ MediciFlags[MediciFlags["EDIT_IDENTITY_METADATA"] = 16384] = "EDIT_IDENTITY_METADATA";
3613
+ MediciFlags[MediciFlags["REFRESH_LEVEL_TO_IDENTITY_ACCOUNT"] = 32768] = "REFRESH_LEVEL_TO_IDENTITY_ACCOUNT";
3614
+ MediciFlags[MediciFlags["ATTACH_WALLET_TO_IDENTITY"] = 65536] = "ATTACH_WALLET_TO_IDENTITY";
3615
+ MediciFlags[MediciFlags["DETACH_WALLET_FROM_IDENTITY"] = 131072] = "DETACH_WALLET_FROM_IDENTITY";
3616
+ MediciFlags[MediciFlags["SEIZE_TOKENS"] = 262144] = "SEIZE_TOKENS";
3617
+ MediciFlags[MediciFlags["CREATE_IDENTITY_ACCOUNT"] = 524288] = "CREATE_IDENTITY_ACCOUNT";
3618
+ MediciFlags[MediciFlags["CREATE_INVESTOR_LOCKS"] = 1048576] = "CREATE_INVESTOR_LOCKS";
3619
+ MediciFlags[MediciFlags["CLOSE_INVESTOR_LOCKS"] = 2097152] = "CLOSE_INVESTOR_LOCKS";
3620
+ MediciFlags[MediciFlags["ADD_TOKEN_LOCK"] = 4194304] = "ADD_TOKEN_LOCK";
3621
+ MediciFlags[MediciFlags["REMOVE_TOKEN_LOCK"] = 8388608] = "REMOVE_TOKEN_LOCK";
3622
+ MediciFlags[MediciFlags["CHANGE_COUNTERS"] = 16777216] = "CHANGE_COUNTERS";
3623
+ MediciFlags[MediciFlags["CHANGE_COUNTER_LIMITS"] = 33554432] = "CHANGE_COUNTER_LIMITS";
3624
+ MediciFlags[MediciFlags["CHANGE_COUNTRY"] = 67108864] = "CHANGE_COUNTRY";
3625
+ MediciFlags[MediciFlags["CHANGE_MAPPING"] = 134217728] = "CHANGE_MAPPING";
3626
+ MediciFlags[MediciFlags["CHANGE_ISSUANCE_POLICIES"] = 268435456] = "CHANGE_ISSUANCE_POLICIES";
3627
+ MediciFlags[MediciFlags["REMOVE_IDENTITY_ACCOUNT"] = 536870912] = "REMOVE_IDENTITY_ACCOUNT";
3628
+ MediciFlags[MediciFlags["ALL"] = 1073741823] = "ALL";
3802
3629
  })(MediciFlags || (MediciFlags = {}));
3803
3630
 
3804
3631
  /******************************************************************************
@@ -3853,7 +3680,7 @@ class AssetController {
3853
3680
  * Update the asset controller's metadata.
3854
3681
  * @param args - {@link UpdateAssetMetadataArgs}
3855
3682
  * @param assetAccessController - RBAC AssetAccessController account.
3856
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3683
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3857
3684
  * @returns A Promise that resolves to the instructions to update the asset controller's metadata.
3858
3685
  * */
3859
3686
  updateAssetMetadata(args, assetAccessController, authorizedUserRole) {
@@ -3882,7 +3709,7 @@ class AssetController {
3882
3709
  * Asynchronously generates instructions to issue tokens and lock tokens according to issuance policy.
3883
3710
  * @param args - {@link IssueTokensWithLockArgs}
3884
3711
  * @param assetAccessController - RBAC AssetAccessController account.
3885
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3712
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3886
3713
  */
3887
3714
  issueTokenIxns(args, assetAccessController, authorizedUserRole) {
3888
3715
  return __awaiter(this, void 0, void 0, function* () {
@@ -3929,16 +3756,6 @@ class AssetController {
3929
3756
  .instruction();
3930
3757
  });
3931
3758
  }
3932
- /**
3933
- * Asynchronously generates instructions to revoke assets.
3934
- * @param args - {@link VoidTokensArgs}
3935
- * @returns A Promise that resolves to the instructions to revoke assets.
3936
- */
3937
- voidTokenIxns(args) {
3938
- return __awaiter(this, void 0, void 0, function* () {
3939
- return this.rwaClient.assetController.voidTokenIxns(args);
3940
- });
3941
- }
3942
3759
  /**
3943
3760
  * Executes a token transfer.
3944
3761
  * @param args - {@link TransferTokensArgs}
@@ -3953,7 +3770,7 @@ class AssetController {
3953
3770
  * Asynchronously generates instruction to freeze a token account.
3954
3771
  * @param args - {@link FreezeTokenArgs}
3955
3772
  * @param assetAccessController - RBAC AssetAccessController account.
3956
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3773
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3957
3774
  * @returns A Promise that resolves to the instruction to freeze.
3958
3775
  */
3959
3776
  freezeTokenIxn(args, assetAccessController, authorizedUserRole) {
@@ -3981,7 +3798,7 @@ class AssetController {
3981
3798
  * Asynchronously generates instruction to thaw a token account.
3982
3799
  * @param args - {@link FreezeTokenArgs}
3983
3800
  * @param assetAccessController - RBAC AssetAccessController account.
3984
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3801
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3985
3802
  * @returns A Promise that resolves to the instruction to thaw.
3986
3803
  */
3987
3804
  thawTokenIxn(args, assetAccessController, authorizedUserRole) {
@@ -4009,13 +3826,13 @@ class AssetController {
4009
3826
  /**
4010
3827
  * Asynchronously generates instructions to revoke tokens from a user.
4011
3828
  * @param args - {@link RevokeTokensArgs}
4012
- * @param payer - Payer public key.
4013
3829
  * @param signer - User signer public key.
4014
3830
  * @param assetAccessController - RBAC AssetAccessController account.
4015
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3831
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3832
+ * @param investorId - Optional investorId. Required if user is not an investor.
4016
3833
  * @returns A Promise that resolves to the instructions to revoke.
4017
3834
  */
4018
- revokeTokenIxn(args, investorId, signer, assetAccessController, authorizedUserRole) {
3835
+ revokeTokenIxn(args, signer, assetAccessController, authorizedUserRole, investorId) {
4019
3836
  return __awaiter(this, void 0, void 0, function* () {
4020
3837
  if (!args.wallet) {
4021
3838
  throw new Error("Use wallet arg for wallet to revoke tokens from.");
@@ -4024,7 +3841,9 @@ class AssetController {
4024
3841
  args.owner = args.wallet;
4025
3842
  const revokeIx = yield getRevokeTokensIx(args, this.rwaClient.provider);
4026
3843
  const identityRegistry = getIdentityRegistryPda(args.assetMint);
4027
- const investorPda = deriveInvestorPda(investorId, identityRegistry);
3844
+ const investorPda = investorId
3845
+ ? deriveInvestorPda(investorId, identityRegistry)
3846
+ : null;
4028
3847
  const ixData = revokeIx.data;
4029
3848
  const assetController = getAssetControllerPda(args.assetMint);
4030
3849
  const revokeTokenAccount = getAssociatedTokenAddressSync(new PublicKey(args.assetMint), new PublicKey(args.wallet), false, TOKEN_2022_PROGRAM_ID);
@@ -4040,8 +3859,8 @@ class AssetController {
4040
3859
  assetController,
4041
3860
  revokeTokenAccount,
4042
3861
  identityRegistry,
4043
- identityAccount: getIdentityAccountPda(args.assetMint, investorPda.toString()),
4044
- trackerAccount: getTrackerAccountPda(args.assetMint, investorPda.toString()),
3862
+ identityAccount: getIdentityAccountPda(args.assetMint, investorId ? investorPda.toString() : args.owner),
3863
+ trackerAccount: getTrackerAccountPda(args.assetMint, investorId ? investorPda.toString() : args.owner),
4045
3864
  policyEngineProgram: policyEngineProgramId,
4046
3865
  policyEngine: getPolicyEnginePda(args.assetMint),
4047
3866
  walletIdentityAccount: getWalletIdentityAccountPda(args.assetMint, args.wallet),
@@ -4053,37 +3872,11 @@ class AssetController {
4053
3872
  .instruction();
4054
3873
  });
4055
3874
  }
4056
- /**
4057
- * Asynchronously generates instruction to close mint.
4058
- * @param args - {@link CloseMintArgs}
4059
- * @param assetAccessController - RBAC AssetAccessController account.
4060
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4061
- * @returns A Promise that resolves to the instruction to close mint.
4062
- */
4063
- closeMintIxn(args, assetAccessController, authorizedUserRole) {
4064
- return __awaiter(this, void 0, void 0, function* () {
4065
- const closeIx = yield getCloseMintIx(args, this.rwaClient.provider);
4066
- const ixData = closeIx.data;
4067
- return this.rbacProgram.methods
4068
- .closeMintAccount(ixData)
4069
- .accountsStrict({
4070
- user: args.signer,
4071
- controllerAuthority: args.authority,
4072
- assetAccessController,
4073
- authorizedUserRole: authorizedUserRole || null,
4074
- assetControllerProgram: assetControllerProgramId,
4075
- assetMint: args.assetMint,
4076
- assetController: getAssetControllerPda(args.assetMint),
4077
- tokenProgram: TOKEN_2022_PROGRAM_ID,
4078
- })
4079
- .instruction();
4080
- });
4081
- }
4082
3875
  /**
4083
3876
  * Asynchronously generates instruction to update mint interest rate.
4084
3877
  * @param args - {@link UpdateInterestBearingMintRateArgs}
4085
3878
  * @param assetAccessController - RBAC AssetAccessController account.
4086
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3879
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4087
3880
  * @returns A Promise that resolves to the instruction to update mint interest rate.
4088
3881
  */
4089
3882
  updateInterestBearingMintRateIxn(args, assetAccessController, authorizedUserRole) {
@@ -4111,7 +3904,7 @@ class AssetController {
4111
3904
  * @param args - {@link SeizeTokensArgs}
4112
3905
  * @param signer - User signer public key.
4113
3906
  * @param assetAccessController - RBAC AssetAccessController account.
4114
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3907
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4115
3908
  * @returns A Promise that resolves to the instruction to seize.
4116
3909
  */
4117
3910
  seizeTokensIxn(args, investorId, signer, assetAccessController, authorizedUserRole) {
@@ -4209,7 +4002,7 @@ class PolicyEngine {
4209
4002
  * @param args - {@link AttachPolicyArgs}
4210
4003
  * @param signer - User signer public key.
4211
4004
  * @param assetAccessController - RBAC AssetAccessController account.
4212
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4005
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4213
4006
  * @returns A Promise that resolves to the instructions to attach a policy.
4214
4007
  * */
4215
4008
  attachPolicy(args, signer, assetAccessController, authorizedUserRole) {
@@ -4237,7 +4030,7 @@ class PolicyEngine {
4237
4030
  * @param args - {@link DetachPolicyArgs}
4238
4031
  * @param signer - User signer public key.
4239
4032
  * @param assetAccessController - RBAC AssetAccessController account.
4240
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4033
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4241
4034
  * @returns A Promise that resolves to the instructions to detach a policy.
4242
4035
  * */
4243
4036
  detachPolicy(args, signer, assetAccessController, authorizedUserRole) {
@@ -4265,7 +4058,7 @@ class PolicyEngine {
4265
4058
  * @param args - {@link ChangeCountersArgs}
4266
4059
  * @param signer - User signer public key.
4267
4060
  * @param assetAccessController - RBAC AssetAccessController account.
4268
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4061
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4269
4062
  * @returns A Promise that resolves to the instructions to change the counters.
4270
4063
  * */
4271
4064
  changeCounters(args, signer, assetAccessController, authorizedUserRole) {
@@ -4293,7 +4086,7 @@ class PolicyEngine {
4293
4086
  * @param args - {@link SetCountersArgs}
4294
4087
  * @param signer - User signer public key.
4295
4088
  * @param assetAccessController - RBAC AssetAccessController account.
4296
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4089
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4297
4090
  * @returns A Promise that resolves to the instructions to set the counter values.
4298
4091
  * */
4299
4092
  setCounters(args, signer, assetAccessController, authorizedUserRole) {
@@ -4320,7 +4113,7 @@ class PolicyEngine {
4320
4113
  * @param args - {@link ChangeCounterLimitsArgs}
4321
4114
  * @param signer - User signer public key.
4322
4115
  * @param assetAccessController - RBAC AssetAccessController account.
4323
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4116
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4324
4117
  * @returns A Promise that resolves to the instructions to change the counters limits.
4325
4118
  * */
4326
4119
  changeCounterLimits(args, signer, assetAccessController, authorizedUserRole) {
@@ -4348,7 +4141,7 @@ class PolicyEngine {
4348
4141
  * @param args - {@link ChangeMappingArgs}
4349
4142
  * @param signer - User signer public key.
4350
4143
  * @param assetAccessController - RBAC AssetAccessController account.
4351
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4144
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4352
4145
  * */
4353
4146
  changeMapping(args, signer, assetAccessController, authorizedUserRole) {
4354
4147
  return __awaiter(this, void 0, void 0, function* () {
@@ -4374,7 +4167,7 @@ class PolicyEngine {
4374
4167
  * @param args - {@link ChangeIssuancePoliciesArgs}
4375
4168
  * @param signer - User signer public key.
4376
4169
  * @param assetAccessController - RBAC AssetAccessController account.
4377
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4170
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4378
4171
  * */
4379
4172
  changeIssuancePolicies(args, signer, assetAccessController, authorizedUserRole) {
4380
4173
  return __awaiter(this, void 0, void 0, function* () {
@@ -4458,7 +4251,7 @@ class IdentityRegistry {
4458
4251
  * @param args - {@link SetupUserArgs}
4459
4252
  * @param authority - RBAC AssetAccessController ControllerAuthority.
4460
4253
  * @param assetAccessController - RBAC AssetAccessController account.
4461
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4254
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4462
4255
  * @returns A Promise that resolves to the instructions to setup a user.
4463
4256
  *
4464
4257
  * It is required for at least a single user to be setup before issuing tokens.
@@ -4468,7 +4261,6 @@ class IdentityRegistry {
4468
4261
  const { ixs } = yield this.rwaClient.identityRegistry.setupUserIxns(args);
4469
4262
  const returnIxs = [];
4470
4263
  const identityAccountIx = ixs[0];
4471
- const trackerAccountIx = ixs[1];
4472
4264
  const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
4473
4265
  const identityAccount = getIdentityAccountPda(args.assetMint, args.owner);
4474
4266
  returnIxs.push(yield this.rbacProgram.methods
@@ -4485,9 +4277,11 @@ class IdentityRegistry {
4485
4277
  walletIdentity: getWalletIdentityAccountPda(args.assetMint, args.owner),
4486
4278
  systemProgram: SystemProgram.programId,
4487
4279
  eventAuthority: getIdentityRegistryEventAuthority(),
4280
+ policyEngineProgram: policyEngineProgramId,
4281
+ trackerAccount: getTrackerAccountPda(args.assetMint, args.owner),
4282
+ assetMint: args.assetMint,
4488
4283
  })
4489
4284
  .instruction());
4490
- returnIxs.push(trackerAccountIx);
4491
4285
  return {
4492
4286
  ixs: returnIxs,
4493
4287
  signers: [],
@@ -4499,7 +4293,7 @@ class IdentityRegistry {
4499
4293
  * @param args - {@link SetupUserArgs}
4500
4294
  * @param authority - RBAC AssetAccessController ControllerAuthority.
4501
4295
  * @param assetAccessController - RBAC AssetAccessController account.
4502
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4296
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4503
4297
  * @returns A Promise that resolves to the instructions to setup a user.
4504
4298
  *
4505
4299
  * It is required for at least a single user to be setup before issuing tokens.
@@ -4524,122 +4318,19 @@ class IdentityRegistry {
4524
4318
  walletIdentity: getWalletIdentityAccountPda(args.assetMint, args.owner),
4525
4319
  eventAuthority: getIdentityRegistryEventAuthority(),
4526
4320
  identityOwner: identityAccount.owner,
4527
- })
4528
- .instruction();
4529
- return returnIx;
4530
- });
4531
- }
4532
- /**
4533
- * Asynchronously update a non-investor user identity account level.
4534
- * @param args - {@link AddLevelToIdentityAccountArgs}
4535
- * @param assetAccessController - RBAC AssetAccessController account.
4536
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4537
- * @returns A Promise that resolves to the instructions to update user account identity.
4538
- * */
4539
- addIdentityLevelToUserAccount(args, assetAccessController, authorizedUserRole) {
4540
- return __awaiter(this, void 0, void 0, function* () {
4541
- var _a;
4542
- const identityAccount = getIdentityAccountPda(args.assetMint, args.owner);
4543
- const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
4544
- return this.rbacProgram.methods
4545
- .addLevelToIdentityAccount(args.levels[0], args.expiries[0], (_a = args.ignorePolicy) !== null && _a !== void 0 ? _a : false)
4546
- .accountsStrict({
4547
- payer: args.payer,
4548
- user: args.signer,
4549
- controllerAuthority,
4550
- assetAccessController,
4551
- authorizedUserRole: authorizedUserRole || null,
4552
- identityRegistryProgram: identityRegistryProgramId,
4553
- identityRegistry: getIdentityRegistryPda(args.assetMint),
4554
- identityAccount,
4555
- identityAccountOwner: args.owner,
4556
- systemProgram: SystemProgram.programId,
4557
- policyEngineProgram: policyEngineProgramId,
4558
- policyEngine: getPolicyEnginePda(args.assetMint),
4559
- trackerAccount: getTrackerAccountPda(args.assetMint, args.owner),
4560
- assetMint: args.assetMint,
4561
- eventAuthority: getIdentityRegistryEventAuthority(),
4562
- })
4563
- .instruction();
4564
- });
4565
- }
4566
- /**
4567
- * Asynchronously reduces a non-Investor user identity account level.
4568
- * @param args - {@link RemoveLevelFromIdentityAccount}
4569
- * @param assetAccessController - RBAC AssetAccessController account.
4570
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4571
- * @returns A Promise that resolves to the instructions to reduce the level of a user identity account.
4572
- */
4573
- removeIdentityLevelFromUserAccount(args, assetAccessController, authorizedUserRole) {
4574
- return __awaiter(this, void 0, void 0, function* () {
4575
- const removeLevelIx = yield getRemoveLevelFromIdentityAccount(args, this.rwaClient.provider);
4576
- const ixData = removeLevelIx.data;
4577
- const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
4578
- const identityAccount = getIdentityAccountPda(args.assetMint, args.owner);
4579
- return this.rbacProgram.methods
4580
- .removeLevelFromIdentityAccount(ixData)
4581
- .accountsStrict({
4582
- payer: args.payer,
4583
- user: args.signer,
4584
- controllerAuthority,
4585
- assetAccessController,
4586
- authorizedUserRole: authorizedUserRole || null,
4587
- identityRegistryProgram: identityRegistryProgramId,
4588
- identityRegistry: getIdentityRegistryPda(args.assetMint),
4589
- identityAccount,
4590
- identityAccountOwner: args.owner,
4591
- systemProgram: SystemProgram.programId,
4592
4321
  policyEngineProgram: policyEngineProgramId,
4593
- policyEngine: getPolicyEnginePda(args.assetMint),
4594
4322
  trackerAccount: getTrackerAccountPda(args.assetMint, args.owner),
4595
4323
  assetMint: args.assetMint,
4596
- eventAuthority: getIdentityRegistryEventAuthority(),
4597
- })
4598
- .instruction();
4599
- });
4600
- }
4601
- /**
4602
- * Asynchronously generates instruction to refresh expiry on an Identity Account level.
4603
- * @param args - {@link RefreshLevelArgs}
4604
- * @param assetAccessController - RBAC AssetAccessController account.
4605
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4606
- * @returns A Promise that resolves to refresh expiry on an Identity Account level.
4607
- * */
4608
- refreshLevelToIdentityAccountIxn(args, assetAccessController, authorizedUserRole) {
4609
- return __awaiter(this, void 0, void 0, function* () {
4610
- const identityProgram = getIdentityRegistryProgram(this.rwaClient.provider);
4611
- const identityRegistry = getIdentityRegistryPda(args.assetMint);
4612
- const identityAccount = getIdentityAccountPda(args.assetMint, args.owner);
4613
- const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
4614
- const refreshIx = yield identityProgram.methods
4615
- .refreshLevelToIdentityAccount(args.level, args.expiry)
4616
- .accountsStrict({
4617
- payer: args.payer,
4618
- signer: controllerAuthority,
4619
- identityRegistry,
4620
- identityAccount,
4621
- })
4622
- .instruction();
4623
- return this.rbacProgram.methods
4624
- .refreshLevelToIdentityAccount(refreshIx.data)
4625
- .accountsStrict({
4626
- payer: args.payer,
4627
- user: args.signer,
4628
- controllerAuthority,
4629
- assetAccessController,
4630
- authorizedUserRole: authorizedUserRole || null,
4631
- identityRegistryProgram: identityRegistryProgramId,
4632
- identityRegistry,
4633
- identityAccount,
4634
4324
  })
4635
4325
  .instruction();
4326
+ return returnIx;
4636
4327
  });
4637
4328
  }
4638
4329
  /**
4639
4330
  * Asynchronously generates instruction to attach wallet to identity.
4640
4331
  * @param args - {@link AttachDetachWalletArgs}
4641
4332
  * @param assetAccessController - RBAC AssetAccessController account.
4642
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4333
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4643
4334
  * @returns A Promise that resolves to attach wallet.
4644
4335
  * */
4645
4336
  attachWalletToIdentityIxn(args, assetAccessController, authorizedUserRole) {
@@ -4687,7 +4378,7 @@ class IdentityRegistry {
4687
4378
  * Asynchronously generates instruction to detach wallet from identity.
4688
4379
  * @param args - {@link AttachDetachWalletArgs}
4689
4380
  * @param assetAccessController - RBAC AssetAccessController account.
4690
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4381
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4691
4382
  * @returns A Promise that resolves to detach wallet.
4692
4383
  * */
4693
4384
  detachWalletFromIdentityIxn(args, assetAccessController, authorizedUserRole) {
@@ -4697,6 +4388,7 @@ class IdentityRegistry {
4697
4388
  const identityRegistry = getIdentityRegistryPda(args.assetMint);
4698
4389
  const identityAccount = getIdentityAccountPda(args.assetMint, args.owner);
4699
4390
  const walletIdentity = getWalletIdentityAccountPda(args.assetMint, args.wallet.toString());
4391
+ const tokenAccount = getAssociatedTokenAddressSync(new PublicKey(args.assetMint), new PublicKey(args.wallet), false, TOKEN_2022_PROGRAM_ID);
4700
4392
  const ix = yield identityProgram.methods
4701
4393
  .detachWalletFromIdentity()
4702
4394
  .accountsStrict({
@@ -4707,6 +4399,8 @@ class IdentityRegistry {
4707
4399
  identityRegistry,
4708
4400
  eventAuthority: getIdentityRegistryEventAuthority(),
4709
4401
  program: identityRegistryProgramId,
4402
+ tokenAccount: tokenAccount,
4403
+ assetMint: args.assetMint,
4710
4404
  })
4711
4405
  .instruction();
4712
4406
  return this.rbacProgram.methods
@@ -4722,6 +4416,8 @@ class IdentityRegistry {
4722
4416
  identityAccount,
4723
4417
  identityRegistry,
4724
4418
  eventAuthority: getIdentityRegistryEventAuthority(),
4419
+ tokenAccount: tokenAccount,
4420
+ assetMint: args.assetMint,
4725
4421
  })
4726
4422
  .instruction();
4727
4423
  });
@@ -4763,7 +4459,7 @@ class IdentityMetadataRegistry {
4763
4459
  * @param args - {@link SetupInvestorArgs}
4764
4460
  * @param authority - RBAC AssetAccessController ControllerAuthority.
4765
4461
  * @param assetAccessController - RBAC AssetAccessController account.
4766
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4462
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4767
4463
  * @returns A Promise that resolves to the instructions to setup an investor.
4768
4464
  *
4769
4465
  * It is required for at least a single user to be setup before issuing tokens.
@@ -4792,6 +4488,9 @@ class IdentityMetadataRegistry {
4792
4488
  eventAuthority: getEventAuthority(IMR_PROGRAM),
4793
4489
  eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
4794
4490
  program: identityRegistryProgramId,
4491
+ policyEngineProgram: policyEngineProgramId,
4492
+ trackerAccount: getTrackerAccountPda(args.assetMint, investor.toString()),
4493
+ assetMint: assetMintKey,
4795
4494
  })
4796
4495
  .instruction();
4797
4496
  returnIxs.push(yield this.rbacProgram.methods
@@ -4811,21 +4510,9 @@ class IdentityMetadataRegistry {
4811
4510
  systemProgram: SystemProgram.programId,
4812
4511
  eventAuthorityIdentityMetadataRegistry: getEventAuthority(IMR_PROGRAM),
4813
4512
  eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
4814
- })
4815
- .instruction());
4816
- const policyProgram = getPolicyEngineProgram(this.imrProgram.provider);
4817
- const trackerAccount = PublicKey.findProgramAddressSync([assetMintKey.toBuffer(), identityAccount.toBuffer()], policyProgram.programId)[0];
4818
- returnIxs.push(yield policyProgram.methods
4819
- .createTrackerAccount()
4820
- .accountsStrict({
4821
- payer: args.payer,
4822
- trackerAccount,
4823
- systemProgram: SystemProgram.programId,
4824
- program: policyProgram.programId,
4513
+ policyEngineProgram: policyEngineProgramId,
4514
+ trackerAccount: getTrackerAccountPda(args.assetMint, investor.toString()),
4825
4515
  assetMint: assetMintKey,
4826
- eventAuthority: getPolicyEngineEventAuthority(),
4827
- identityRegistry,
4828
- identityAccount,
4829
4516
  })
4830
4517
  .instruction());
4831
4518
  if (args.levels.length > 1) {
@@ -4850,7 +4537,7 @@ class IdentityMetadataRegistry {
4850
4537
  * Asynchronously add levels to investor.
4851
4538
  * @param args - {@link AddLevelsArgs}
4852
4539
  * @param assetAccessController - RBAC AssetAccessController account.
4853
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4540
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4854
4541
  * @returns A Promise that resolves to the instructions to add levels.
4855
4542
  * */
4856
4543
  addLevels(args, assetAccessController, authorizedUserRole) {
@@ -4908,7 +4595,7 @@ class IdentityMetadataRegistry {
4908
4595
  * Asynchronously change country for the Investor.
4909
4596
  * @param args - {@link ChangeCountryArgs}
4910
4597
  * @param assetAccessController - RBAC AssetAccessController account.
4911
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4598
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4912
4599
  * @returns A Promise that resolves to the instructions to change the country.
4913
4600
  * */
4914
4601
  changeCountry(args, assetAccessController, authorizedUserRole) {
@@ -4961,7 +4648,7 @@ class IdentityMetadataRegistry {
4961
4648
  * Asynchronously remove levels from an investor.
4962
4649
  * @param args - {@link RemoveLevelsArgs}
4963
4650
  * @param assetAccessController - RBAC AssetAccessController account.
4964
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4651
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4965
4652
  * @returns A Promise that resolves to the instructions to remove levels.
4966
4653
  * */
4967
4654
  removeLevels(args, assetAccessController, authorizedUserRole) {
@@ -5016,7 +4703,7 @@ class IdentityMetadataRegistry {
5016
4703
  * Asynchronously remove an investor.
5017
4704
  * @param args - {@link RemoveLevelsArgs}
5018
4705
  * @param assetAccessController - RBAC AssetAccessController account.
5019
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4706
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
5020
4707
  * @returns A Promise that resolves to the instructions to remove an investor.
5021
4708
  * */
5022
4709
  removeInvestor(args, assetAccessController, authorizedUserRole) {
@@ -5043,6 +4730,7 @@ class IdentityMetadataRegistry {
5043
4730
  trackerAccount: getTrackerAccountPda(args.assetMint, investor.toString()),
5044
4731
  eventAuthorityIdentityMetadataRegistry: getEventAuthority(IMR_PROGRAM),
5045
4732
  eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
4733
+ assetMint: args.assetMint,
5046
4734
  })
5047
4735
  .instruction();
5048
4736
  });
@@ -5114,13 +4802,36 @@ class RwaRbacClient {
5114
4802
  */
5115
4803
  createAssetAccessControllerIxn(args) {
5116
4804
  return __awaiter(this, void 0, void 0, function* () {
4805
+ const assetAccessController = deriveAssetAccessControllerPda(args.assetMint);
4806
+ const assetAccessControllerAuthority = deriveControllerAuthorityPda(assetAccessController);
4807
+ const cpiInstruction = yield this.assetController.setupNewRegistry({
4808
+ decimals: args.decimals,
4809
+ authority: assetAccessControllerAuthority.toString(),
4810
+ name: args.name,
4811
+ uri: args.uri,
4812
+ symbol: args.symbol,
4813
+ interestRate: args.interestRate,
4814
+ assetMint: args.assetMint.toString(),
4815
+ payer: args.payer.toString(),
4816
+ });
5117
4817
  return this.rbacProgram.methods
5118
- .createController(args.uniqueSeed)
4818
+ .createController(cpiInstruction.data)
5119
4819
  .accountsStrict({
5120
4820
  payer: args.payer,
5121
4821
  admin: args.admin,
5122
- assetAccessController: deriveAssetAccessControllerPda(args.uniqueSeed),
4822
+ assetAccessController,
4823
+ assetAccessControllerAuthority,
4824
+ assetMint: args.assetMint,
4825
+ assetController: cpiInstruction.keys[2].pubkey,
4826
+ extraMetasAccount: cpiInstruction.keys[4].pubkey,
4827
+ policyEngineAccount: cpiInstruction.keys[5].pubkey,
4828
+ identityRegistryAccount: cpiInstruction.keys[6].pubkey,
4829
+ policyEngineProgram: cpiInstruction.keys[7].pubkey,
4830
+ identityRegistryProgram: cpiInstruction.keys[8].pubkey,
4831
+ assetControllerProgram: cpiInstruction.programId,
4832
+ tokenProgram: TOKEN_2022_PROGRAM_ID,
5123
4833
  systemProgram: SystemProgram.programId,
4834
+ assetControllerEventAuthority: getAssetControllerEventAuthority(),
5124
4835
  })
5125
4836
  .instruction();
5126
4837
  });
@@ -5151,7 +4862,7 @@ class RwaRbacClient {
5151
4862
  // Fetch controller to get next UserRole id.
5152
4863
  const controller = yield this.rbacProgram.account.assetAccessController.fetch(args.assetAccessController);
5153
4864
  return this.rbacProgram.methods
5154
- .createUserRole(args.name, new BN(args.allowedAdminIxs), new BN(args.allowedMediciIxs))
4865
+ .createUserRole(args.name, new BN(args.allowedAdminIxs), new BN(args.allowedMediciIxs), args.isMasterRole || false)
5155
4866
  .accountsStrict({
5156
4867
  payer: args.payer,
5157
4868
  user: args.user,