@dstoken-solana/rwa-rbac 0.3.0 → 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, 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");
@@ -86,8 +86,7 @@ var instructions$1 = [
86
86
  ]
87
87
  },
88
88
  {
89
- name: "authorized_user_role",
90
- optional: true
89
+ name: "authorized_user_role"
91
90
  },
92
91
  {
93
92
  name: "identity_metadata_registry_program",
@@ -174,8 +173,7 @@ var instructions$1 = [
174
173
  ]
175
174
  },
176
175
  {
177
- name: "authorized_user_role",
178
- optional: true
176
+ name: "authorized_user_role"
179
177
  },
180
178
  {
181
179
  name: "policy_engine_program",
@@ -237,6 +235,7 @@ var instructions$1 = [
237
235
  },
238
236
  {
239
237
  name: "asset_access_controller",
238
+ writable: true,
240
239
  relations: [
241
240
  "user_role",
242
241
  "authorized_user_role"
@@ -331,8 +330,7 @@ var instructions$1 = [
331
330
  ]
332
331
  },
333
332
  {
334
- name: "authorized_user_role",
335
- optional: true
333
+ name: "authorized_user_role"
336
334
  },
337
335
  {
338
336
  name: "policy_engine_program",
@@ -392,8 +390,7 @@ var instructions$1 = [
392
390
  ]
393
391
  },
394
392
  {
395
- name: "authorized_user_role",
396
- optional: true
393
+ name: "authorized_user_role"
397
394
  },
398
395
  {
399
396
  name: "identity_registry_program",
@@ -463,8 +460,7 @@ var instructions$1 = [
463
460
  ]
464
461
  },
465
462
  {
466
- name: "authorized_user_role",
467
- optional: true
463
+ name: "authorized_user_role"
468
464
  },
469
465
  {
470
466
  name: "policy_engine_program",
@@ -524,8 +520,7 @@ var instructions$1 = [
524
520
  ]
525
521
  },
526
522
  {
527
- name: "authorized_user_role",
528
- optional: true
523
+ name: "authorized_user_role"
529
524
  },
530
525
  {
531
526
  name: "policy_engine_program",
@@ -585,8 +580,7 @@ var instructions$1 = [
585
580
  ]
586
581
  },
587
582
  {
588
- name: "authorized_user_role",
589
- optional: true
583
+ name: "authorized_user_role"
590
584
  },
591
585
  {
592
586
  name: "identity_metadata_registry_program",
@@ -666,8 +660,7 @@ var instructions$1 = [
666
660
  ]
667
661
  },
668
662
  {
669
- name: "authorized_user_role",
670
- optional: true
663
+ name: "authorized_user_role"
671
664
  },
672
665
  {
673
666
  name: "policy_engine_program",
@@ -723,8 +716,7 @@ var instructions$1 = [
723
716
  ]
724
717
  },
725
718
  {
726
- name: "authorized_user_role",
727
- optional: true
719
+ name: "authorized_user_role"
728
720
  },
729
721
  {
730
722
  name: "policy_engine_program",
@@ -745,63 +737,6 @@ var instructions$1 = [
745
737
  }
746
738
  ]
747
739
  },
748
- {
749
- name: "close_mint_account",
750
- discriminator: [
751
- 14,
752
- 121,
753
- 72,
754
- 246,
755
- 96,
756
- 224,
757
- 42,
758
- 162
759
- ],
760
- accounts: [
761
- {
762
- name: "user",
763
- signer: true
764
- },
765
- {
766
- name: "controller_authority",
767
- writable: true,
768
- relations: [
769
- "asset_access_controller"
770
- ]
771
- },
772
- {
773
- name: "asset_access_controller",
774
- relations: [
775
- "authorized_user_role"
776
- ]
777
- },
778
- {
779
- name: "authorized_user_role",
780
- optional: true
781
- },
782
- {
783
- name: "asset_controller_program",
784
- address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
785
- },
786
- {
787
- name: "asset_mint",
788
- writable: true
789
- },
790
- {
791
- name: "asset_controller"
792
- },
793
- {
794
- name: "token_program",
795
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
796
- }
797
- ],
798
- args: [
799
- {
800
- name: "cpi_data",
801
- type: "bytes"
802
- }
803
- ]
804
- },
805
740
  {
806
741
  name: "create_controller",
807
742
  discriminator: [
@@ -830,8 +765,8 @@ var instructions$1 = [
830
765
  pda: {
831
766
  seeds: [
832
767
  {
833
- kind: "arg",
834
- path: "unique_seed"
768
+ kind: "account",
769
+ path: "asset_mint"
835
770
  },
836
771
  {
837
772
  kind: "const",
@@ -862,6 +797,53 @@ var instructions$1 = [
862
797
  ]
863
798
  }
864
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
+ },
865
847
  {
866
848
  name: "system_program",
867
849
  address: "11111111111111111111111111111111"
@@ -869,8 +851,8 @@ var instructions$1 = [
869
851
  ],
870
852
  args: [
871
853
  {
872
- name: "unique_seed",
873
- type: "pubkey"
854
+ name: "cpi_data",
855
+ type: "bytes"
874
856
  }
875
857
  ]
876
858
  },
@@ -909,8 +891,7 @@ var instructions$1 = [
909
891
  ]
910
892
  },
911
893
  {
912
- name: "authorized_user_role",
913
- optional: true
894
+ name: "authorized_user_role"
914
895
  },
915
896
  {
916
897
  name: "identity_registry_program",
@@ -927,6 +908,16 @@ var instructions$1 = [
927
908
  name: "wallet_identity",
928
909
  writable: true
929
910
  },
911
+ {
912
+ name: "policy_engine_program"
913
+ },
914
+ {
915
+ name: "tracker_account",
916
+ writable: true
917
+ },
918
+ {
919
+ name: "asset_mint"
920
+ },
930
921
  {
931
922
  name: "system_program",
932
923
  address: "11111111111111111111111111111111"
@@ -996,6 +987,10 @@ var instructions$1 = [
996
987
  {
997
988
  name: "allowed_medici_ixs",
998
989
  type: "u64"
990
+ },
991
+ {
992
+ name: "is_master_role",
993
+ type: "bool"
999
994
  }
1000
995
  ]
1001
996
  },
@@ -1074,8 +1069,7 @@ var instructions$1 = [
1074
1069
  ]
1075
1070
  },
1076
1071
  {
1077
- name: "authorized_user_role",
1078
- optional: true
1072
+ name: "authorized_user_role"
1079
1073
  },
1080
1074
  {
1081
1075
  name: "policy_engine_program",
@@ -1136,8 +1130,7 @@ var instructions$1 = [
1136
1130
  ]
1137
1131
  },
1138
1132
  {
1139
- name: "authorized_user_role",
1140
- optional: true
1133
+ name: "authorized_user_role"
1141
1134
  },
1142
1135
  {
1143
1136
  name: "identity_registry_program",
@@ -1201,8 +1194,7 @@ var instructions$1 = [
1201
1194
  ]
1202
1195
  },
1203
1196
  {
1204
- name: "authorized_user_role",
1205
- optional: true
1197
+ name: "authorized_user_role"
1206
1198
  },
1207
1199
  {
1208
1200
  name: "asset_controller_program",
@@ -1267,8 +1259,7 @@ var instructions$1 = [
1267
1259
  ]
1268
1260
  },
1269
1261
  {
1270
- name: "authorized_user_role",
1271
- optional: true
1262
+ name: "authorized_user_role"
1272
1263
  },
1273
1264
  {
1274
1265
  name: "asset_controller_program",
@@ -1416,8 +1407,7 @@ var instructions$1 = [
1416
1407
  ]
1417
1408
  },
1418
1409
  {
1419
- name: "authorized_user_role",
1420
- optional: true
1410
+ name: "authorized_user_role"
1421
1411
  },
1422
1412
  {
1423
1413
  name: "identity_metadata_registry_program",
@@ -1442,6 +1432,16 @@ var instructions$1 = [
1442
1432
  name: "wallet_identity",
1443
1433
  writable: true
1444
1434
  },
1435
+ {
1436
+ name: "policy_engine_program"
1437
+ },
1438
+ {
1439
+ name: "tracker_account",
1440
+ writable: true
1441
+ },
1442
+ {
1443
+ name: "asset_mint"
1444
+ },
1445
1445
  {
1446
1446
  name: "event_authority_identity_metadata_registry"
1447
1447
  },
@@ -1495,8 +1495,7 @@ var instructions$1 = [
1495
1495
  ]
1496
1496
  },
1497
1497
  {
1498
- name: "authorized_user_role",
1499
- optional: true
1498
+ name: "authorized_user_role"
1500
1499
  },
1501
1500
  {
1502
1501
  name: "identity_registry_program",
@@ -1518,6 +1517,16 @@ var instructions$1 = [
1518
1517
  },
1519
1518
  {
1520
1519
  name: "identity_owner"
1520
+ },
1521
+ {
1522
+ name: "policy_engine_program"
1523
+ },
1524
+ {
1525
+ name: "tracker_account",
1526
+ writable: true
1527
+ },
1528
+ {
1529
+ name: "asset_mint"
1521
1530
  }
1522
1531
  ],
1523
1532
  args: [
@@ -1562,8 +1571,7 @@ var instructions$1 = [
1562
1571
  ]
1563
1572
  },
1564
1573
  {
1565
- name: "authorized_user_role",
1566
- optional: true
1574
+ name: "authorized_user_role"
1567
1575
  },
1568
1576
  {
1569
1577
  name: "identity_metadata_registry_program",
@@ -1601,6 +1609,9 @@ var instructions$1 = [
1601
1609
  },
1602
1610
  {
1603
1611
  name: "event_authority_identity_registry"
1612
+ },
1613
+ {
1614
+ name: "asset_mint"
1604
1615
  }
1605
1616
  ],
1606
1617
  args: [
@@ -1641,8 +1652,7 @@ var instructions$1 = [
1641
1652
  ]
1642
1653
  },
1643
1654
  {
1644
- name: "authorized_user_role",
1645
- optional: true
1655
+ name: "authorized_user_role"
1646
1656
  },
1647
1657
  {
1648
1658
  name: "identity_metadata_registry_program",
@@ -1726,8 +1736,7 @@ var instructions$1 = [
1726
1736
  ]
1727
1737
  },
1728
1738
  {
1729
- name: "authorized_user_role",
1730
- optional: true
1739
+ name: "authorized_user_role"
1731
1740
  },
1732
1741
  {
1733
1742
  name: "policy_engine_program",
@@ -1870,8 +1879,7 @@ var instructions$1 = [
1870
1879
  ]
1871
1880
  },
1872
1881
  {
1873
- name: "authorized_user_role",
1874
- optional: true
1882
+ name: "authorized_user_role"
1875
1883
  },
1876
1884
  {
1877
1885
  name: "asset_controller_program",
@@ -1962,8 +1970,7 @@ var instructions$1 = [
1962
1970
  ]
1963
1971
  },
1964
1972
  {
1965
- name: "authorized_user_role",
1966
- optional: true
1973
+ name: "authorized_user_role"
1967
1974
  },
1968
1975
  {
1969
1976
  name: "asset_controller_program",
@@ -2033,8 +2040,7 @@ var instructions$1 = [
2033
2040
  ]
2034
2041
  },
2035
2042
  {
2036
- name: "authorized_user_role",
2037
- optional: true
2043
+ name: "authorized_user_role"
2038
2044
  },
2039
2045
  {
2040
2046
  name: "policy_engine_program",
@@ -2120,8 +2126,7 @@ var instructions$1 = [
2120
2126
  ]
2121
2127
  },
2122
2128
  {
2123
- name: "authorized_user_role",
2124
- optional: true
2129
+ name: "authorized_user_role"
2125
2130
  },
2126
2131
  {
2127
2132
  name: "asset_controller_program",
@@ -2190,8 +2195,7 @@ var instructions$1 = [
2190
2195
  ]
2191
2196
  },
2192
2197
  {
2193
- name: "authorized_user_role",
2194
- optional: true
2198
+ name: "authorized_user_role"
2195
2199
  },
2196
2200
  {
2197
2201
  name: "asset_controller_program",
@@ -2285,8 +2289,7 @@ var instructions$1 = [
2285
2289
  ]
2286
2290
  },
2287
2291
  {
2288
- name: "authorized_user_role",
2289
- optional: true
2292
+ name: "authorized_user_role"
2290
2293
  },
2291
2294
  {
2292
2295
  name: "asset_controller_program",
@@ -2453,6 +2456,31 @@ var errors$1 = [
2453
2456
  code: 6007,
2454
2457
  name: "IllegalOperation",
2455
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"
2456
2484
  }
2457
2485
  ];
2458
2486
  var types$1 = [
@@ -2483,9 +2511,9 @@ var types$1 = [
2483
2511
  type: "pubkey"
2484
2512
  },
2485
2513
  {
2486
- name: "unique_seed",
2514
+ name: "asset_mint",
2487
2515
  docs: [
2488
- "Unique seed used for creating this account."
2516
+ "Asset mint that is going to be managed by this controller."
2489
2517
  ],
2490
2518
  type: "pubkey"
2491
2519
  },
@@ -2496,6 +2524,13 @@ var types$1 = [
2496
2524
  ],
2497
2525
  type: "u64"
2498
2526
  },
2527
+ {
2528
+ name: "has_master_role",
2529
+ docs: [
2530
+ "Whether a master role exists."
2531
+ ],
2532
+ type: "bool"
2533
+ },
2499
2534
  {
2500
2535
  name: "lut_address",
2501
2536
  docs: [
@@ -2530,7 +2565,7 @@ var types$1 = [
2530
2565
  type: "pubkey"
2531
2566
  },
2532
2567
  {
2533
- name: "seed",
2568
+ name: "asset_mint",
2534
2569
  type: "pubkey"
2535
2570
  }
2536
2571
  ]
@@ -2560,7 +2595,7 @@ var types$1 = [
2560
2595
  type: "pubkey"
2561
2596
  },
2562
2597
  {
2563
- name: "seed",
2598
+ name: "asset_mint",
2564
2599
  type: "pubkey"
2565
2600
  }
2566
2601
  ]
@@ -2606,6 +2641,13 @@ var types$1 = [
2606
2641
  ],
2607
2642
  type: "u64"
2608
2643
  },
2644
+ {
2645
+ name: "is_master_role",
2646
+ docs: [
2647
+ "If true, this is the master role."
2648
+ ],
2649
+ type: "bool"
2650
+ },
2609
2651
  {
2610
2652
  name: "users",
2611
2653
  docs: [
@@ -2969,6 +3011,16 @@ var instructions = [
2969
3011
  name: "wallet_identity",
2970
3012
  writable: true
2971
3013
  },
3014
+ {
3015
+ name: "policy_engine_program"
3016
+ },
3017
+ {
3018
+ name: "tracker_account",
3019
+ writable: true
3020
+ },
3021
+ {
3022
+ name: "asset_mint"
3023
+ },
2972
3024
  {
2973
3025
  name: "system_program",
2974
3026
  address: "11111111111111111111111111111111"
@@ -3091,6 +3143,9 @@ var instructions = [
3091
3143
  {
3092
3144
  name: "event_authority_identity_registry"
3093
3145
  },
3146
+ {
3147
+ name: "asset_mint"
3148
+ },
3094
3149
  {
3095
3150
  name: "event_authority",
3096
3151
  pda: {
@@ -3545,33 +3600,32 @@ var MediciFlags;
3545
3600
  MediciFlags[MediciFlags["FREEZE_TOKEN_ACCOUNT"] = 4] = "FREEZE_TOKEN_ACCOUNT";
3546
3601
  MediciFlags[MediciFlags["ISSUE_TOKENS"] = 8] = "ISSUE_TOKENS";
3547
3602
  MediciFlags[MediciFlags["REVOKE_TOKENS"] = 16] = "REVOKE_TOKENS";
3548
- MediciFlags[MediciFlags["CLOSE_MINT_ACCOUNT"] = 32] = "CLOSE_MINT_ACCOUNT";
3549
- MediciFlags[MediciFlags["UPDATE_INTEREST_BEARING_MINT_RATE"] = 64] = "UPDATE_INTEREST_BEARING_MINT_RATE";
3550
- MediciFlags[MediciFlags["ATTACH_TO_POLICY_ACCOUNT"] = 128] = "ATTACH_TO_POLICY_ACCOUNT";
3551
- MediciFlags[MediciFlags["CREATE_POLICY_ACCOUNT"] = 256] = "CREATE_POLICY_ACCOUNT";
3552
- MediciFlags[MediciFlags["DETACH_FROM_POLICY_ACCOUNT"] = 512] = "DETACH_FROM_POLICY_ACCOUNT";
3553
- MediciFlags[MediciFlags["ADD_LEVELS"] = 1024] = "ADD_LEVELS";
3554
- MediciFlags[MediciFlags["ADD_LEVEL_TO_IDENTITY_ACCOUNT"] = 2048] = "ADD_LEVEL_TO_IDENTITY_ACCOUNT";
3555
- MediciFlags[MediciFlags["REGISTER_INVESTOR"] = 4096] = "REGISTER_INVESTOR";
3556
- MediciFlags[MediciFlags["REMOVE_LEVELS"] = 8192] = "REMOVE_LEVELS";
3557
- MediciFlags[MediciFlags["REMOVE_INVESTOR"] = 16384] = "REMOVE_INVESTOR";
3558
- MediciFlags[MediciFlags["EDIT_IDENTITY_METADATA"] = 32768] = "EDIT_IDENTITY_METADATA";
3559
- MediciFlags[MediciFlags["REFRESH_LEVEL_TO_IDENTITY_ACCOUNT"] = 65536] = "REFRESH_LEVEL_TO_IDENTITY_ACCOUNT";
3560
- MediciFlags[MediciFlags["ATTACH_WALLET_TO_IDENTITY"] = 131072] = "ATTACH_WALLET_TO_IDENTITY";
3561
- MediciFlags[MediciFlags["DETACH_WALLET_FROM_IDENTITY"] = 262144] = "DETACH_WALLET_FROM_IDENTITY";
3562
- MediciFlags[MediciFlags["SEIZE_TOKENS"] = 524288] = "SEIZE_TOKENS";
3563
- MediciFlags[MediciFlags["CREATE_IDENTITY_ACCOUNT"] = 1048576] = "CREATE_IDENTITY_ACCOUNT";
3564
- MediciFlags[MediciFlags["CREATE_INVESTOR_LOCKS"] = 2097152] = "CREATE_INVESTOR_LOCKS";
3565
- MediciFlags[MediciFlags["CLOSE_INVESTOR_LOCKS"] = 4194304] = "CLOSE_INVESTOR_LOCKS";
3566
- MediciFlags[MediciFlags["ADD_TOKEN_LOCK"] = 8388608] = "ADD_TOKEN_LOCK";
3567
- MediciFlags[MediciFlags["REMOVE_TOKEN_LOCK"] = 16777216] = "REMOVE_TOKEN_LOCK";
3568
- MediciFlags[MediciFlags["CHANGE_COUNTERS"] = 33554432] = "CHANGE_COUNTERS";
3569
- MediciFlags[MediciFlags["CHANGE_COUNTER_LIMITS"] = 67108864] = "CHANGE_COUNTER_LIMITS";
3570
- MediciFlags[MediciFlags["CHANGE_COUNTRY"] = 134217728] = "CHANGE_COUNTRY";
3571
- MediciFlags[MediciFlags["CHANGE_MAPPING"] = 268435456] = "CHANGE_MAPPING";
3572
- MediciFlags[MediciFlags["CHANGE_ISSUANCE_POLICIES"] = 536870912] = "CHANGE_ISSUANCE_POLICIES";
3573
- MediciFlags[MediciFlags["REMOVE_IDENTITY_ACCOUNT"] = 1073741824] = "REMOVE_IDENTITY_ACCOUNT";
3574
- 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";
3575
3629
  })(MediciFlags || (MediciFlags = {}));
3576
3630
 
3577
3631
  /******************************************************************************
@@ -3626,7 +3680,7 @@ class AssetController {
3626
3680
  * Update the asset controller's metadata.
3627
3681
  * @param args - {@link UpdateAssetMetadataArgs}
3628
3682
  * @param assetAccessController - RBAC AssetAccessController account.
3629
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3683
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3630
3684
  * @returns A Promise that resolves to the instructions to update the asset controller's metadata.
3631
3685
  * */
3632
3686
  updateAssetMetadata(args, assetAccessController, authorizedUserRole) {
@@ -3655,7 +3709,7 @@ class AssetController {
3655
3709
  * Asynchronously generates instructions to issue tokens and lock tokens according to issuance policy.
3656
3710
  * @param args - {@link IssueTokensWithLockArgs}
3657
3711
  * @param assetAccessController - RBAC AssetAccessController account.
3658
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3712
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3659
3713
  */
3660
3714
  issueTokenIxns(args, assetAccessController, authorizedUserRole) {
3661
3715
  return __awaiter(this, void 0, void 0, function* () {
@@ -3716,7 +3770,7 @@ class AssetController {
3716
3770
  * Asynchronously generates instruction to freeze a token account.
3717
3771
  * @param args - {@link FreezeTokenArgs}
3718
3772
  * @param assetAccessController - RBAC AssetAccessController account.
3719
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3773
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3720
3774
  * @returns A Promise that resolves to the instruction to freeze.
3721
3775
  */
3722
3776
  freezeTokenIxn(args, assetAccessController, authorizedUserRole) {
@@ -3744,7 +3798,7 @@ class AssetController {
3744
3798
  * Asynchronously generates instruction to thaw a token account.
3745
3799
  * @param args - {@link FreezeTokenArgs}
3746
3800
  * @param assetAccessController - RBAC AssetAccessController account.
3747
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3801
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3748
3802
  * @returns A Promise that resolves to the instruction to thaw.
3749
3803
  */
3750
3804
  thawTokenIxn(args, assetAccessController, authorizedUserRole) {
@@ -3774,11 +3828,11 @@ class AssetController {
3774
3828
  * @param args - {@link RevokeTokensArgs}
3775
3829
  * @param signer - User signer public key.
3776
3830
  * @param assetAccessController - RBAC AssetAccessController account.
3831
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3777
3832
  * @param investorId - Optional investorId. Required if user is not an investor.
3778
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3779
3833
  * @returns A Promise that resolves to the instructions to revoke.
3780
3834
  */
3781
- revokeTokenIxn(args, signer, assetAccessController, investorId, authorizedUserRole) {
3835
+ revokeTokenIxn(args, signer, assetAccessController, authorizedUserRole, investorId) {
3782
3836
  return __awaiter(this, void 0, void 0, function* () {
3783
3837
  if (!args.wallet) {
3784
3838
  throw new Error("Use wallet arg for wallet to revoke tokens from.");
@@ -3787,7 +3841,9 @@ class AssetController {
3787
3841
  args.owner = args.wallet;
3788
3842
  const revokeIx = yield getRevokeTokensIx(args, this.rwaClient.provider);
3789
3843
  const identityRegistry = getIdentityRegistryPda(args.assetMint);
3790
- const investorPda = investorId ? deriveInvestorPda(investorId, identityRegistry) : null;
3844
+ const investorPda = investorId
3845
+ ? deriveInvestorPda(investorId, identityRegistry)
3846
+ : null;
3791
3847
  const ixData = revokeIx.data;
3792
3848
  const assetController = getAssetControllerPda(args.assetMint);
3793
3849
  const revokeTokenAccount = getAssociatedTokenAddressSync(new PublicKey(args.assetMint), new PublicKey(args.wallet), false, TOKEN_2022_PROGRAM_ID);
@@ -3816,37 +3872,11 @@ class AssetController {
3816
3872
  .instruction();
3817
3873
  });
3818
3874
  }
3819
- /**
3820
- * Asynchronously generates instruction to close mint.
3821
- * @param args - {@link CloseMintArgs}
3822
- * @param assetAccessController - RBAC AssetAccessController account.
3823
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3824
- * @returns A Promise that resolves to the instruction to close mint.
3825
- */
3826
- closeMintIxn(args, assetAccessController, authorizedUserRole) {
3827
- return __awaiter(this, void 0, void 0, function* () {
3828
- const closeIx = yield getCloseMintIx(args, this.rwaClient.provider);
3829
- const ixData = closeIx.data;
3830
- return this.rbacProgram.methods
3831
- .closeMintAccount(ixData)
3832
- .accountsStrict({
3833
- user: args.signer,
3834
- controllerAuthority: args.authority,
3835
- assetAccessController,
3836
- authorizedUserRole: authorizedUserRole || null,
3837
- assetControllerProgram: assetControllerProgramId,
3838
- assetMint: args.assetMint,
3839
- assetController: getAssetControllerPda(args.assetMint),
3840
- tokenProgram: TOKEN_2022_PROGRAM_ID,
3841
- })
3842
- .instruction();
3843
- });
3844
- }
3845
3875
  /**
3846
3876
  * Asynchronously generates instruction to update mint interest rate.
3847
3877
  * @param args - {@link UpdateInterestBearingMintRateArgs}
3848
3878
  * @param assetAccessController - RBAC AssetAccessController account.
3849
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3879
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3850
3880
  * @returns A Promise that resolves to the instruction to update mint interest rate.
3851
3881
  */
3852
3882
  updateInterestBearingMintRateIxn(args, assetAccessController, authorizedUserRole) {
@@ -3874,7 +3904,7 @@ class AssetController {
3874
3904
  * @param args - {@link SeizeTokensArgs}
3875
3905
  * @param signer - User signer public key.
3876
3906
  * @param assetAccessController - RBAC AssetAccessController account.
3877
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
3907
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3878
3908
  * @returns A Promise that resolves to the instruction to seize.
3879
3909
  */
3880
3910
  seizeTokensIxn(args, investorId, signer, assetAccessController, authorizedUserRole) {
@@ -3972,7 +4002,7 @@ class PolicyEngine {
3972
4002
  * @param args - {@link AttachPolicyArgs}
3973
4003
  * @param signer - User signer public key.
3974
4004
  * @param assetAccessController - RBAC AssetAccessController account.
3975
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4005
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
3976
4006
  * @returns A Promise that resolves to the instructions to attach a policy.
3977
4007
  * */
3978
4008
  attachPolicy(args, signer, assetAccessController, authorizedUserRole) {
@@ -4000,7 +4030,7 @@ class PolicyEngine {
4000
4030
  * @param args - {@link DetachPolicyArgs}
4001
4031
  * @param signer - User signer public key.
4002
4032
  * @param assetAccessController - RBAC AssetAccessController account.
4003
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4033
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4004
4034
  * @returns A Promise that resolves to the instructions to detach a policy.
4005
4035
  * */
4006
4036
  detachPolicy(args, signer, assetAccessController, authorizedUserRole) {
@@ -4028,7 +4058,7 @@ class PolicyEngine {
4028
4058
  * @param args - {@link ChangeCountersArgs}
4029
4059
  * @param signer - User signer public key.
4030
4060
  * @param assetAccessController - RBAC AssetAccessController account.
4031
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4061
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4032
4062
  * @returns A Promise that resolves to the instructions to change the counters.
4033
4063
  * */
4034
4064
  changeCounters(args, signer, assetAccessController, authorizedUserRole) {
@@ -4056,7 +4086,7 @@ class PolicyEngine {
4056
4086
  * @param args - {@link SetCountersArgs}
4057
4087
  * @param signer - User signer public key.
4058
4088
  * @param assetAccessController - RBAC AssetAccessController account.
4059
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4089
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4060
4090
  * @returns A Promise that resolves to the instructions to set the counter values.
4061
4091
  * */
4062
4092
  setCounters(args, signer, assetAccessController, authorizedUserRole) {
@@ -4083,7 +4113,7 @@ class PolicyEngine {
4083
4113
  * @param args - {@link ChangeCounterLimitsArgs}
4084
4114
  * @param signer - User signer public key.
4085
4115
  * @param assetAccessController - RBAC AssetAccessController account.
4086
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4116
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4087
4117
  * @returns A Promise that resolves to the instructions to change the counters limits.
4088
4118
  * */
4089
4119
  changeCounterLimits(args, signer, assetAccessController, authorizedUserRole) {
@@ -4111,7 +4141,7 @@ class PolicyEngine {
4111
4141
  * @param args - {@link ChangeMappingArgs}
4112
4142
  * @param signer - User signer public key.
4113
4143
  * @param assetAccessController - RBAC AssetAccessController account.
4114
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4144
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4115
4145
  * */
4116
4146
  changeMapping(args, signer, assetAccessController, authorizedUserRole) {
4117
4147
  return __awaiter(this, void 0, void 0, function* () {
@@ -4137,7 +4167,7 @@ class PolicyEngine {
4137
4167
  * @param args - {@link ChangeIssuancePoliciesArgs}
4138
4168
  * @param signer - User signer public key.
4139
4169
  * @param assetAccessController - RBAC AssetAccessController account.
4140
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4170
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4141
4171
  * */
4142
4172
  changeIssuancePolicies(args, signer, assetAccessController, authorizedUserRole) {
4143
4173
  return __awaiter(this, void 0, void 0, function* () {
@@ -4221,7 +4251,7 @@ class IdentityRegistry {
4221
4251
  * @param args - {@link SetupUserArgs}
4222
4252
  * @param authority - RBAC AssetAccessController ControllerAuthority.
4223
4253
  * @param assetAccessController - RBAC AssetAccessController account.
4224
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4254
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4225
4255
  * @returns A Promise that resolves to the instructions to setup a user.
4226
4256
  *
4227
4257
  * It is required for at least a single user to be setup before issuing tokens.
@@ -4231,7 +4261,6 @@ class IdentityRegistry {
4231
4261
  const { ixs } = yield this.rwaClient.identityRegistry.setupUserIxns(args);
4232
4262
  const returnIxs = [];
4233
4263
  const identityAccountIx = ixs[0];
4234
- const trackerAccountIx = ixs[1];
4235
4264
  const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
4236
4265
  const identityAccount = getIdentityAccountPda(args.assetMint, args.owner);
4237
4266
  returnIxs.push(yield this.rbacProgram.methods
@@ -4248,9 +4277,11 @@ class IdentityRegistry {
4248
4277
  walletIdentity: getWalletIdentityAccountPda(args.assetMint, args.owner),
4249
4278
  systemProgram: SystemProgram.programId,
4250
4279
  eventAuthority: getIdentityRegistryEventAuthority(),
4280
+ policyEngineProgram: policyEngineProgramId,
4281
+ trackerAccount: getTrackerAccountPda(args.assetMint, args.owner),
4282
+ assetMint: args.assetMint,
4251
4283
  })
4252
4284
  .instruction());
4253
- returnIxs.push(trackerAccountIx);
4254
4285
  return {
4255
4286
  ixs: returnIxs,
4256
4287
  signers: [],
@@ -4262,7 +4293,7 @@ class IdentityRegistry {
4262
4293
  * @param args - {@link SetupUserArgs}
4263
4294
  * @param authority - RBAC AssetAccessController ControllerAuthority.
4264
4295
  * @param assetAccessController - RBAC AssetAccessController account.
4265
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4296
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4266
4297
  * @returns A Promise that resolves to the instructions to setup a user.
4267
4298
  *
4268
4299
  * It is required for at least a single user to be setup before issuing tokens.
@@ -4287,6 +4318,9 @@ class IdentityRegistry {
4287
4318
  walletIdentity: getWalletIdentityAccountPda(args.assetMint, args.owner),
4288
4319
  eventAuthority: getIdentityRegistryEventAuthority(),
4289
4320
  identityOwner: identityAccount.owner,
4321
+ policyEngineProgram: policyEngineProgramId,
4322
+ trackerAccount: getTrackerAccountPda(args.assetMint, args.owner),
4323
+ assetMint: args.assetMint,
4290
4324
  })
4291
4325
  .instruction();
4292
4326
  return returnIx;
@@ -4296,7 +4330,7 @@ class IdentityRegistry {
4296
4330
  * Asynchronously generates instruction to attach wallet to identity.
4297
4331
  * @param args - {@link AttachDetachWalletArgs}
4298
4332
  * @param assetAccessController - RBAC AssetAccessController account.
4299
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4333
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4300
4334
  * @returns A Promise that resolves to attach wallet.
4301
4335
  * */
4302
4336
  attachWalletToIdentityIxn(args, assetAccessController, authorizedUserRole) {
@@ -4344,7 +4378,7 @@ class IdentityRegistry {
4344
4378
  * Asynchronously generates instruction to detach wallet from identity.
4345
4379
  * @param args - {@link AttachDetachWalletArgs}
4346
4380
  * @param assetAccessController - RBAC AssetAccessController account.
4347
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4381
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4348
4382
  * @returns A Promise that resolves to detach wallet.
4349
4383
  * */
4350
4384
  detachWalletFromIdentityIxn(args, assetAccessController, authorizedUserRole) {
@@ -4425,7 +4459,7 @@ class IdentityMetadataRegistry {
4425
4459
  * @param args - {@link SetupInvestorArgs}
4426
4460
  * @param authority - RBAC AssetAccessController ControllerAuthority.
4427
4461
  * @param assetAccessController - RBAC AssetAccessController account.
4428
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4462
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4429
4463
  * @returns A Promise that resolves to the instructions to setup an investor.
4430
4464
  *
4431
4465
  * It is required for at least a single user to be setup before issuing tokens.
@@ -4454,6 +4488,9 @@ class IdentityMetadataRegistry {
4454
4488
  eventAuthority: getEventAuthority(IMR_PROGRAM),
4455
4489
  eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
4456
4490
  program: identityRegistryProgramId,
4491
+ policyEngineProgram: policyEngineProgramId,
4492
+ trackerAccount: getTrackerAccountPda(args.assetMint, investor.toString()),
4493
+ assetMint: assetMintKey,
4457
4494
  })
4458
4495
  .instruction();
4459
4496
  returnIxs.push(yield this.rbacProgram.methods
@@ -4473,21 +4510,9 @@ class IdentityMetadataRegistry {
4473
4510
  systemProgram: SystemProgram.programId,
4474
4511
  eventAuthorityIdentityMetadataRegistry: getEventAuthority(IMR_PROGRAM),
4475
4512
  eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
4476
- })
4477
- .instruction());
4478
- const policyProgram = getPolicyEngineProgram(this.imrProgram.provider);
4479
- const trackerAccount = PublicKey.findProgramAddressSync([assetMintKey.toBuffer(), identityAccount.toBuffer()], policyProgram.programId)[0];
4480
- returnIxs.push(yield policyProgram.methods
4481
- .createTrackerAccount()
4482
- .accountsStrict({
4483
- payer: args.payer,
4484
- trackerAccount,
4485
- systemProgram: SystemProgram.programId,
4486
- program: policyProgram.programId,
4513
+ policyEngineProgram: policyEngineProgramId,
4514
+ trackerAccount: getTrackerAccountPda(args.assetMint, investor.toString()),
4487
4515
  assetMint: assetMintKey,
4488
- eventAuthority: getPolicyEngineEventAuthority(),
4489
- identityRegistry,
4490
- identityAccount,
4491
4516
  })
4492
4517
  .instruction());
4493
4518
  if (args.levels.length > 1) {
@@ -4512,7 +4537,7 @@ class IdentityMetadataRegistry {
4512
4537
  * Asynchronously add levels to investor.
4513
4538
  * @param args - {@link AddLevelsArgs}
4514
4539
  * @param assetAccessController - RBAC AssetAccessController account.
4515
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4540
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4516
4541
  * @returns A Promise that resolves to the instructions to add levels.
4517
4542
  * */
4518
4543
  addLevels(args, assetAccessController, authorizedUserRole) {
@@ -4570,7 +4595,7 @@ class IdentityMetadataRegistry {
4570
4595
  * Asynchronously change country for the Investor.
4571
4596
  * @param args - {@link ChangeCountryArgs}
4572
4597
  * @param assetAccessController - RBAC AssetAccessController account.
4573
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4598
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4574
4599
  * @returns A Promise that resolves to the instructions to change the country.
4575
4600
  * */
4576
4601
  changeCountry(args, assetAccessController, authorizedUserRole) {
@@ -4623,7 +4648,7 @@ class IdentityMetadataRegistry {
4623
4648
  * Asynchronously remove levels from an investor.
4624
4649
  * @param args - {@link RemoveLevelsArgs}
4625
4650
  * @param assetAccessController - RBAC AssetAccessController account.
4626
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4651
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4627
4652
  * @returns A Promise that resolves to the instructions to remove levels.
4628
4653
  * */
4629
4654
  removeLevels(args, assetAccessController, authorizedUserRole) {
@@ -4678,7 +4703,7 @@ class IdentityMetadataRegistry {
4678
4703
  * Asynchronously remove an investor.
4679
4704
  * @param args - {@link RemoveLevelsArgs}
4680
4705
  * @param assetAccessController - RBAC AssetAccessController account.
4681
- * @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
4706
+ * @param authorizedUserRole - UserRole authorized to invoke instruction.
4682
4707
  * @returns A Promise that resolves to the instructions to remove an investor.
4683
4708
  * */
4684
4709
  removeInvestor(args, assetAccessController, authorizedUserRole) {
@@ -4705,6 +4730,7 @@ class IdentityMetadataRegistry {
4705
4730
  trackerAccount: getTrackerAccountPda(args.assetMint, investor.toString()),
4706
4731
  eventAuthorityIdentityMetadataRegistry: getEventAuthority(IMR_PROGRAM),
4707
4732
  eventAuthorityIdentityRegistry: getIdentityRegistryEventAuthority(),
4733
+ assetMint: args.assetMint,
4708
4734
  })
4709
4735
  .instruction();
4710
4736
  });
@@ -4776,13 +4802,36 @@ class RwaRbacClient {
4776
4802
  */
4777
4803
  createAssetAccessControllerIxn(args) {
4778
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
+ });
4779
4817
  return this.rbacProgram.methods
4780
- .createController(args.uniqueSeed)
4818
+ .createController(cpiInstruction.data)
4781
4819
  .accountsStrict({
4782
4820
  payer: args.payer,
4783
4821
  admin: args.admin,
4784
- 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,
4785
4833
  systemProgram: SystemProgram.programId,
4834
+ assetControllerEventAuthority: getAssetControllerEventAuthority(),
4786
4835
  })
4787
4836
  .instruction();
4788
4837
  });
@@ -4813,7 +4862,7 @@ class RwaRbacClient {
4813
4862
  // Fetch controller to get next UserRole id.
4814
4863
  const controller = yield this.rbacProgram.account.assetAccessController.fetch(args.assetAccessController);
4815
4864
  return this.rbacProgram.methods
4816
- .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)
4817
4866
  .accountsStrict({
4818
4867
  payer: args.payer,
4819
4868
  user: args.user,