@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/client/AssetController.d.ts +15 -23
- package/dist/client/AssetController.d.ts.map +1 -1
- package/dist/client/IdentityMetadataRegistry.d.ts +5 -5
- package/dist/client/IdentityMetadataRegistry.d.ts.map +1 -1
- package/dist/client/IdentityRegistry.d.ts +4 -4
- package/dist/client/IdentityRegistry.d.ts.map +1 -1
- package/dist/client/PolicyEngine.d.ts +7 -7
- package/dist/client/RwaRbacClient.d.ts.map +1 -1
- package/dist/index.es.js +262 -213
- package/dist/index.js +261 -212
- package/dist/pdas.d.ts.map +1 -1
- package/dist/types/flags.d.ts +26 -27
- package/dist/types/flags.d.ts.map +1 -1
- package/dist/types/generated/rwa_imr.d.ts +13 -0
- package/dist/types/generated/rwa_imr.d.ts.map +1 -1
- package/dist/types/generated/rwa_rbac.d.ts +132 -90
- package/dist/types/generated/rwa_rbac.d.ts.map +1 -1
- package/dist/types/instructions.d.ts +7 -1
- package/dist/types/instructions.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -90,8 +90,7 @@ var instructions$1 = [
|
|
|
90
90
|
]
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
|
-
name: "authorized_user_role"
|
|
94
|
-
optional: true
|
|
93
|
+
name: "authorized_user_role"
|
|
95
94
|
},
|
|
96
95
|
{
|
|
97
96
|
name: "identity_metadata_registry_program",
|
|
@@ -178,8 +177,7 @@ var instructions$1 = [
|
|
|
178
177
|
]
|
|
179
178
|
},
|
|
180
179
|
{
|
|
181
|
-
name: "authorized_user_role"
|
|
182
|
-
optional: true
|
|
180
|
+
name: "authorized_user_role"
|
|
183
181
|
},
|
|
184
182
|
{
|
|
185
183
|
name: "policy_engine_program",
|
|
@@ -241,6 +239,7 @@ var instructions$1 = [
|
|
|
241
239
|
},
|
|
242
240
|
{
|
|
243
241
|
name: "asset_access_controller",
|
|
242
|
+
writable: true,
|
|
244
243
|
relations: [
|
|
245
244
|
"user_role",
|
|
246
245
|
"authorized_user_role"
|
|
@@ -335,8 +334,7 @@ var instructions$1 = [
|
|
|
335
334
|
]
|
|
336
335
|
},
|
|
337
336
|
{
|
|
338
|
-
name: "authorized_user_role"
|
|
339
|
-
optional: true
|
|
337
|
+
name: "authorized_user_role"
|
|
340
338
|
},
|
|
341
339
|
{
|
|
342
340
|
name: "policy_engine_program",
|
|
@@ -396,8 +394,7 @@ var instructions$1 = [
|
|
|
396
394
|
]
|
|
397
395
|
},
|
|
398
396
|
{
|
|
399
|
-
name: "authorized_user_role"
|
|
400
|
-
optional: true
|
|
397
|
+
name: "authorized_user_role"
|
|
401
398
|
},
|
|
402
399
|
{
|
|
403
400
|
name: "identity_registry_program",
|
|
@@ -467,8 +464,7 @@ var instructions$1 = [
|
|
|
467
464
|
]
|
|
468
465
|
},
|
|
469
466
|
{
|
|
470
|
-
name: "authorized_user_role"
|
|
471
|
-
optional: true
|
|
467
|
+
name: "authorized_user_role"
|
|
472
468
|
},
|
|
473
469
|
{
|
|
474
470
|
name: "policy_engine_program",
|
|
@@ -528,8 +524,7 @@ var instructions$1 = [
|
|
|
528
524
|
]
|
|
529
525
|
},
|
|
530
526
|
{
|
|
531
|
-
name: "authorized_user_role"
|
|
532
|
-
optional: true
|
|
527
|
+
name: "authorized_user_role"
|
|
533
528
|
},
|
|
534
529
|
{
|
|
535
530
|
name: "policy_engine_program",
|
|
@@ -589,8 +584,7 @@ var instructions$1 = [
|
|
|
589
584
|
]
|
|
590
585
|
},
|
|
591
586
|
{
|
|
592
|
-
name: "authorized_user_role"
|
|
593
|
-
optional: true
|
|
587
|
+
name: "authorized_user_role"
|
|
594
588
|
},
|
|
595
589
|
{
|
|
596
590
|
name: "identity_metadata_registry_program",
|
|
@@ -670,8 +664,7 @@ var instructions$1 = [
|
|
|
670
664
|
]
|
|
671
665
|
},
|
|
672
666
|
{
|
|
673
|
-
name: "authorized_user_role"
|
|
674
|
-
optional: true
|
|
667
|
+
name: "authorized_user_role"
|
|
675
668
|
},
|
|
676
669
|
{
|
|
677
670
|
name: "policy_engine_program",
|
|
@@ -727,8 +720,7 @@ var instructions$1 = [
|
|
|
727
720
|
]
|
|
728
721
|
},
|
|
729
722
|
{
|
|
730
|
-
name: "authorized_user_role"
|
|
731
|
-
optional: true
|
|
723
|
+
name: "authorized_user_role"
|
|
732
724
|
},
|
|
733
725
|
{
|
|
734
726
|
name: "policy_engine_program",
|
|
@@ -749,63 +741,6 @@ var instructions$1 = [
|
|
|
749
741
|
}
|
|
750
742
|
]
|
|
751
743
|
},
|
|
752
|
-
{
|
|
753
|
-
name: "close_mint_account",
|
|
754
|
-
discriminator: [
|
|
755
|
-
14,
|
|
756
|
-
121,
|
|
757
|
-
72,
|
|
758
|
-
246,
|
|
759
|
-
96,
|
|
760
|
-
224,
|
|
761
|
-
42,
|
|
762
|
-
162
|
|
763
|
-
],
|
|
764
|
-
accounts: [
|
|
765
|
-
{
|
|
766
|
-
name: "user",
|
|
767
|
-
signer: true
|
|
768
|
-
},
|
|
769
|
-
{
|
|
770
|
-
name: "controller_authority",
|
|
771
|
-
writable: true,
|
|
772
|
-
relations: [
|
|
773
|
-
"asset_access_controller"
|
|
774
|
-
]
|
|
775
|
-
},
|
|
776
|
-
{
|
|
777
|
-
name: "asset_access_controller",
|
|
778
|
-
relations: [
|
|
779
|
-
"authorized_user_role"
|
|
780
|
-
]
|
|
781
|
-
},
|
|
782
|
-
{
|
|
783
|
-
name: "authorized_user_role",
|
|
784
|
-
optional: true
|
|
785
|
-
},
|
|
786
|
-
{
|
|
787
|
-
name: "asset_controller_program",
|
|
788
|
-
address: "7tXjmbkZVY3Gmg9kDBebcNXT1yC5pyoxxXVLwdbv9tvP"
|
|
789
|
-
},
|
|
790
|
-
{
|
|
791
|
-
name: "asset_mint",
|
|
792
|
-
writable: true
|
|
793
|
-
},
|
|
794
|
-
{
|
|
795
|
-
name: "asset_controller"
|
|
796
|
-
},
|
|
797
|
-
{
|
|
798
|
-
name: "token_program",
|
|
799
|
-
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
800
|
-
}
|
|
801
|
-
],
|
|
802
|
-
args: [
|
|
803
|
-
{
|
|
804
|
-
name: "cpi_data",
|
|
805
|
-
type: "bytes"
|
|
806
|
-
}
|
|
807
|
-
]
|
|
808
|
-
},
|
|
809
744
|
{
|
|
810
745
|
name: "create_controller",
|
|
811
746
|
discriminator: [
|
|
@@ -834,8 +769,8 @@ var instructions$1 = [
|
|
|
834
769
|
pda: {
|
|
835
770
|
seeds: [
|
|
836
771
|
{
|
|
837
|
-
kind: "
|
|
838
|
-
path: "
|
|
772
|
+
kind: "account",
|
|
773
|
+
path: "asset_mint"
|
|
839
774
|
},
|
|
840
775
|
{
|
|
841
776
|
kind: "const",
|
|
@@ -866,6 +801,53 @@ var instructions$1 = [
|
|
|
866
801
|
]
|
|
867
802
|
}
|
|
868
803
|
},
|
|
804
|
+
{
|
|
805
|
+
name: "asset_access_controller_authority",
|
|
806
|
+
pda: {
|
|
807
|
+
seeds: [
|
|
808
|
+
{
|
|
809
|
+
kind: "account",
|
|
810
|
+
path: "asset_access_controller"
|
|
811
|
+
}
|
|
812
|
+
]
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
name: "asset_controller",
|
|
817
|
+
writable: true
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
name: "asset_mint",
|
|
821
|
+
writable: true,
|
|
822
|
+
signer: true
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
name: "extra_metas_account",
|
|
826
|
+
writable: true
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
name: "policy_engine_account",
|
|
830
|
+
writable: true
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
name: "identity_registry_account",
|
|
834
|
+
writable: true
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
name: "policy_engine_program"
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
name: "identity_registry_program"
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
name: "asset_controller_program"
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
name: "asset_controller_event_authority"
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
name: "token_program"
|
|
850
|
+
},
|
|
869
851
|
{
|
|
870
852
|
name: "system_program",
|
|
871
853
|
address: "11111111111111111111111111111111"
|
|
@@ -873,8 +855,8 @@ var instructions$1 = [
|
|
|
873
855
|
],
|
|
874
856
|
args: [
|
|
875
857
|
{
|
|
876
|
-
name: "
|
|
877
|
-
type: "
|
|
858
|
+
name: "cpi_data",
|
|
859
|
+
type: "bytes"
|
|
878
860
|
}
|
|
879
861
|
]
|
|
880
862
|
},
|
|
@@ -913,8 +895,7 @@ var instructions$1 = [
|
|
|
913
895
|
]
|
|
914
896
|
},
|
|
915
897
|
{
|
|
916
|
-
name: "authorized_user_role"
|
|
917
|
-
optional: true
|
|
898
|
+
name: "authorized_user_role"
|
|
918
899
|
},
|
|
919
900
|
{
|
|
920
901
|
name: "identity_registry_program",
|
|
@@ -931,6 +912,16 @@ var instructions$1 = [
|
|
|
931
912
|
name: "wallet_identity",
|
|
932
913
|
writable: true
|
|
933
914
|
},
|
|
915
|
+
{
|
|
916
|
+
name: "policy_engine_program"
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
name: "tracker_account",
|
|
920
|
+
writable: true
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
name: "asset_mint"
|
|
924
|
+
},
|
|
934
925
|
{
|
|
935
926
|
name: "system_program",
|
|
936
927
|
address: "11111111111111111111111111111111"
|
|
@@ -1000,6 +991,10 @@ var instructions$1 = [
|
|
|
1000
991
|
{
|
|
1001
992
|
name: "allowed_medici_ixs",
|
|
1002
993
|
type: "u64"
|
|
994
|
+
},
|
|
995
|
+
{
|
|
996
|
+
name: "is_master_role",
|
|
997
|
+
type: "bool"
|
|
1003
998
|
}
|
|
1004
999
|
]
|
|
1005
1000
|
},
|
|
@@ -1078,8 +1073,7 @@ var instructions$1 = [
|
|
|
1078
1073
|
]
|
|
1079
1074
|
},
|
|
1080
1075
|
{
|
|
1081
|
-
name: "authorized_user_role"
|
|
1082
|
-
optional: true
|
|
1076
|
+
name: "authorized_user_role"
|
|
1083
1077
|
},
|
|
1084
1078
|
{
|
|
1085
1079
|
name: "policy_engine_program",
|
|
@@ -1140,8 +1134,7 @@ var instructions$1 = [
|
|
|
1140
1134
|
]
|
|
1141
1135
|
},
|
|
1142
1136
|
{
|
|
1143
|
-
name: "authorized_user_role"
|
|
1144
|
-
optional: true
|
|
1137
|
+
name: "authorized_user_role"
|
|
1145
1138
|
},
|
|
1146
1139
|
{
|
|
1147
1140
|
name: "identity_registry_program",
|
|
@@ -1205,8 +1198,7 @@ var instructions$1 = [
|
|
|
1205
1198
|
]
|
|
1206
1199
|
},
|
|
1207
1200
|
{
|
|
1208
|
-
name: "authorized_user_role"
|
|
1209
|
-
optional: true
|
|
1201
|
+
name: "authorized_user_role"
|
|
1210
1202
|
},
|
|
1211
1203
|
{
|
|
1212
1204
|
name: "asset_controller_program",
|
|
@@ -1271,8 +1263,7 @@ var instructions$1 = [
|
|
|
1271
1263
|
]
|
|
1272
1264
|
},
|
|
1273
1265
|
{
|
|
1274
|
-
name: "authorized_user_role"
|
|
1275
|
-
optional: true
|
|
1266
|
+
name: "authorized_user_role"
|
|
1276
1267
|
},
|
|
1277
1268
|
{
|
|
1278
1269
|
name: "asset_controller_program",
|
|
@@ -1420,8 +1411,7 @@ var instructions$1 = [
|
|
|
1420
1411
|
]
|
|
1421
1412
|
},
|
|
1422
1413
|
{
|
|
1423
|
-
name: "authorized_user_role"
|
|
1424
|
-
optional: true
|
|
1414
|
+
name: "authorized_user_role"
|
|
1425
1415
|
},
|
|
1426
1416
|
{
|
|
1427
1417
|
name: "identity_metadata_registry_program",
|
|
@@ -1446,6 +1436,16 @@ var instructions$1 = [
|
|
|
1446
1436
|
name: "wallet_identity",
|
|
1447
1437
|
writable: true
|
|
1448
1438
|
},
|
|
1439
|
+
{
|
|
1440
|
+
name: "policy_engine_program"
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
name: "tracker_account",
|
|
1444
|
+
writable: true
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
name: "asset_mint"
|
|
1448
|
+
},
|
|
1449
1449
|
{
|
|
1450
1450
|
name: "event_authority_identity_metadata_registry"
|
|
1451
1451
|
},
|
|
@@ -1499,8 +1499,7 @@ var instructions$1 = [
|
|
|
1499
1499
|
]
|
|
1500
1500
|
},
|
|
1501
1501
|
{
|
|
1502
|
-
name: "authorized_user_role"
|
|
1503
|
-
optional: true
|
|
1502
|
+
name: "authorized_user_role"
|
|
1504
1503
|
},
|
|
1505
1504
|
{
|
|
1506
1505
|
name: "identity_registry_program",
|
|
@@ -1522,6 +1521,16 @@ var instructions$1 = [
|
|
|
1522
1521
|
},
|
|
1523
1522
|
{
|
|
1524
1523
|
name: "identity_owner"
|
|
1524
|
+
},
|
|
1525
|
+
{
|
|
1526
|
+
name: "policy_engine_program"
|
|
1527
|
+
},
|
|
1528
|
+
{
|
|
1529
|
+
name: "tracker_account",
|
|
1530
|
+
writable: true
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
name: "asset_mint"
|
|
1525
1534
|
}
|
|
1526
1535
|
],
|
|
1527
1536
|
args: [
|
|
@@ -1566,8 +1575,7 @@ var instructions$1 = [
|
|
|
1566
1575
|
]
|
|
1567
1576
|
},
|
|
1568
1577
|
{
|
|
1569
|
-
name: "authorized_user_role"
|
|
1570
|
-
optional: true
|
|
1578
|
+
name: "authorized_user_role"
|
|
1571
1579
|
},
|
|
1572
1580
|
{
|
|
1573
1581
|
name: "identity_metadata_registry_program",
|
|
@@ -1605,6 +1613,9 @@ var instructions$1 = [
|
|
|
1605
1613
|
},
|
|
1606
1614
|
{
|
|
1607
1615
|
name: "event_authority_identity_registry"
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
name: "asset_mint"
|
|
1608
1619
|
}
|
|
1609
1620
|
],
|
|
1610
1621
|
args: [
|
|
@@ -1645,8 +1656,7 @@ var instructions$1 = [
|
|
|
1645
1656
|
]
|
|
1646
1657
|
},
|
|
1647
1658
|
{
|
|
1648
|
-
name: "authorized_user_role"
|
|
1649
|
-
optional: true
|
|
1659
|
+
name: "authorized_user_role"
|
|
1650
1660
|
},
|
|
1651
1661
|
{
|
|
1652
1662
|
name: "identity_metadata_registry_program",
|
|
@@ -1730,8 +1740,7 @@ var instructions$1 = [
|
|
|
1730
1740
|
]
|
|
1731
1741
|
},
|
|
1732
1742
|
{
|
|
1733
|
-
name: "authorized_user_role"
|
|
1734
|
-
optional: true
|
|
1743
|
+
name: "authorized_user_role"
|
|
1735
1744
|
},
|
|
1736
1745
|
{
|
|
1737
1746
|
name: "policy_engine_program",
|
|
@@ -1874,8 +1883,7 @@ var instructions$1 = [
|
|
|
1874
1883
|
]
|
|
1875
1884
|
},
|
|
1876
1885
|
{
|
|
1877
|
-
name: "authorized_user_role"
|
|
1878
|
-
optional: true
|
|
1886
|
+
name: "authorized_user_role"
|
|
1879
1887
|
},
|
|
1880
1888
|
{
|
|
1881
1889
|
name: "asset_controller_program",
|
|
@@ -1966,8 +1974,7 @@ var instructions$1 = [
|
|
|
1966
1974
|
]
|
|
1967
1975
|
},
|
|
1968
1976
|
{
|
|
1969
|
-
name: "authorized_user_role"
|
|
1970
|
-
optional: true
|
|
1977
|
+
name: "authorized_user_role"
|
|
1971
1978
|
},
|
|
1972
1979
|
{
|
|
1973
1980
|
name: "asset_controller_program",
|
|
@@ -2037,8 +2044,7 @@ var instructions$1 = [
|
|
|
2037
2044
|
]
|
|
2038
2045
|
},
|
|
2039
2046
|
{
|
|
2040
|
-
name: "authorized_user_role"
|
|
2041
|
-
optional: true
|
|
2047
|
+
name: "authorized_user_role"
|
|
2042
2048
|
},
|
|
2043
2049
|
{
|
|
2044
2050
|
name: "policy_engine_program",
|
|
@@ -2124,8 +2130,7 @@ var instructions$1 = [
|
|
|
2124
2130
|
]
|
|
2125
2131
|
},
|
|
2126
2132
|
{
|
|
2127
|
-
name: "authorized_user_role"
|
|
2128
|
-
optional: true
|
|
2133
|
+
name: "authorized_user_role"
|
|
2129
2134
|
},
|
|
2130
2135
|
{
|
|
2131
2136
|
name: "asset_controller_program",
|
|
@@ -2194,8 +2199,7 @@ var instructions$1 = [
|
|
|
2194
2199
|
]
|
|
2195
2200
|
},
|
|
2196
2201
|
{
|
|
2197
|
-
name: "authorized_user_role"
|
|
2198
|
-
optional: true
|
|
2202
|
+
name: "authorized_user_role"
|
|
2199
2203
|
},
|
|
2200
2204
|
{
|
|
2201
2205
|
name: "asset_controller_program",
|
|
@@ -2289,8 +2293,7 @@ var instructions$1 = [
|
|
|
2289
2293
|
]
|
|
2290
2294
|
},
|
|
2291
2295
|
{
|
|
2292
|
-
name: "authorized_user_role"
|
|
2293
|
-
optional: true
|
|
2296
|
+
name: "authorized_user_role"
|
|
2294
2297
|
},
|
|
2295
2298
|
{
|
|
2296
2299
|
name: "asset_controller_program",
|
|
@@ -2457,6 +2460,31 @@ var errors$1 = [
|
|
|
2457
2460
|
code: 6007,
|
|
2458
2461
|
name: "IllegalOperation",
|
|
2459
2462
|
msg: "Illegal operation"
|
|
2463
|
+
},
|
|
2464
|
+
{
|
|
2465
|
+
code: 6008,
|
|
2466
|
+
name: "InvalidFlags",
|
|
2467
|
+
msg: "Invalid flag bits"
|
|
2468
|
+
},
|
|
2469
|
+
{
|
|
2470
|
+
code: 6009,
|
|
2471
|
+
name: "CannotEmptyMasterRole",
|
|
2472
|
+
msg: "Cannot empty master role of users"
|
|
2473
|
+
},
|
|
2474
|
+
{
|
|
2475
|
+
code: 6010,
|
|
2476
|
+
name: "CannotVoidAuthority",
|
|
2477
|
+
msg: "Cannot void authority"
|
|
2478
|
+
},
|
|
2479
|
+
{
|
|
2480
|
+
code: 6011,
|
|
2481
|
+
name: "InvalidMasterRole",
|
|
2482
|
+
msg: "Invalid master role"
|
|
2483
|
+
},
|
|
2484
|
+
{
|
|
2485
|
+
code: 6012,
|
|
2486
|
+
name: "CannotDeleteMasterRole",
|
|
2487
|
+
msg: "Cannot delete master role"
|
|
2460
2488
|
}
|
|
2461
2489
|
];
|
|
2462
2490
|
var types$1 = [
|
|
@@ -2487,9 +2515,9 @@ var types$1 = [
|
|
|
2487
2515
|
type: "pubkey"
|
|
2488
2516
|
},
|
|
2489
2517
|
{
|
|
2490
|
-
name: "
|
|
2518
|
+
name: "asset_mint",
|
|
2491
2519
|
docs: [
|
|
2492
|
-
"
|
|
2520
|
+
"Asset mint that is going to be managed by this controller."
|
|
2493
2521
|
],
|
|
2494
2522
|
type: "pubkey"
|
|
2495
2523
|
},
|
|
@@ -2500,6 +2528,13 @@ var types$1 = [
|
|
|
2500
2528
|
],
|
|
2501
2529
|
type: "u64"
|
|
2502
2530
|
},
|
|
2531
|
+
{
|
|
2532
|
+
name: "has_master_role",
|
|
2533
|
+
docs: [
|
|
2534
|
+
"Whether a master role exists."
|
|
2535
|
+
],
|
|
2536
|
+
type: "bool"
|
|
2537
|
+
},
|
|
2503
2538
|
{
|
|
2504
2539
|
name: "lut_address",
|
|
2505
2540
|
docs: [
|
|
@@ -2534,7 +2569,7 @@ var types$1 = [
|
|
|
2534
2569
|
type: "pubkey"
|
|
2535
2570
|
},
|
|
2536
2571
|
{
|
|
2537
|
-
name: "
|
|
2572
|
+
name: "asset_mint",
|
|
2538
2573
|
type: "pubkey"
|
|
2539
2574
|
}
|
|
2540
2575
|
]
|
|
@@ -2564,7 +2599,7 @@ var types$1 = [
|
|
|
2564
2599
|
type: "pubkey"
|
|
2565
2600
|
},
|
|
2566
2601
|
{
|
|
2567
|
-
name: "
|
|
2602
|
+
name: "asset_mint",
|
|
2568
2603
|
type: "pubkey"
|
|
2569
2604
|
}
|
|
2570
2605
|
]
|
|
@@ -2610,6 +2645,13 @@ var types$1 = [
|
|
|
2610
2645
|
],
|
|
2611
2646
|
type: "u64"
|
|
2612
2647
|
},
|
|
2648
|
+
{
|
|
2649
|
+
name: "is_master_role",
|
|
2650
|
+
docs: [
|
|
2651
|
+
"If true, this is the master role."
|
|
2652
|
+
],
|
|
2653
|
+
type: "bool"
|
|
2654
|
+
},
|
|
2613
2655
|
{
|
|
2614
2656
|
name: "users",
|
|
2615
2657
|
docs: [
|
|
@@ -2973,6 +3015,16 @@ var instructions = [
|
|
|
2973
3015
|
name: "wallet_identity",
|
|
2974
3016
|
writable: true
|
|
2975
3017
|
},
|
|
3018
|
+
{
|
|
3019
|
+
name: "policy_engine_program"
|
|
3020
|
+
},
|
|
3021
|
+
{
|
|
3022
|
+
name: "tracker_account",
|
|
3023
|
+
writable: true
|
|
3024
|
+
},
|
|
3025
|
+
{
|
|
3026
|
+
name: "asset_mint"
|
|
3027
|
+
},
|
|
2976
3028
|
{
|
|
2977
3029
|
name: "system_program",
|
|
2978
3030
|
address: "11111111111111111111111111111111"
|
|
@@ -3095,6 +3147,9 @@ var instructions = [
|
|
|
3095
3147
|
{
|
|
3096
3148
|
name: "event_authority_identity_registry"
|
|
3097
3149
|
},
|
|
3150
|
+
{
|
|
3151
|
+
name: "asset_mint"
|
|
3152
|
+
},
|
|
3098
3153
|
{
|
|
3099
3154
|
name: "event_authority",
|
|
3100
3155
|
pda: {
|
|
@@ -3549,33 +3604,32 @@ exports.MediciFlags = void 0;
|
|
|
3549
3604
|
MediciFlags[MediciFlags["FREEZE_TOKEN_ACCOUNT"] = 4] = "FREEZE_TOKEN_ACCOUNT";
|
|
3550
3605
|
MediciFlags[MediciFlags["ISSUE_TOKENS"] = 8] = "ISSUE_TOKENS";
|
|
3551
3606
|
MediciFlags[MediciFlags["REVOKE_TOKENS"] = 16] = "REVOKE_TOKENS";
|
|
3552
|
-
MediciFlags[MediciFlags["
|
|
3553
|
-
MediciFlags[MediciFlags["
|
|
3554
|
-
MediciFlags[MediciFlags["
|
|
3555
|
-
MediciFlags[MediciFlags["
|
|
3556
|
-
MediciFlags[MediciFlags["
|
|
3557
|
-
MediciFlags[MediciFlags["
|
|
3558
|
-
MediciFlags[MediciFlags["
|
|
3559
|
-
MediciFlags[MediciFlags["
|
|
3560
|
-
MediciFlags[MediciFlags["
|
|
3561
|
-
MediciFlags[MediciFlags["
|
|
3562
|
-
MediciFlags[MediciFlags["
|
|
3563
|
-
MediciFlags[MediciFlags["
|
|
3564
|
-
MediciFlags[MediciFlags["
|
|
3565
|
-
MediciFlags[MediciFlags["
|
|
3566
|
-
MediciFlags[MediciFlags["
|
|
3567
|
-
MediciFlags[MediciFlags["
|
|
3568
|
-
MediciFlags[MediciFlags["
|
|
3569
|
-
MediciFlags[MediciFlags["
|
|
3570
|
-
MediciFlags[MediciFlags["
|
|
3571
|
-
MediciFlags[MediciFlags["
|
|
3572
|
-
MediciFlags[MediciFlags["
|
|
3573
|
-
MediciFlags[MediciFlags["
|
|
3574
|
-
MediciFlags[MediciFlags["
|
|
3575
|
-
MediciFlags[MediciFlags["
|
|
3576
|
-
MediciFlags[MediciFlags["
|
|
3577
|
-
MediciFlags[MediciFlags["
|
|
3578
|
-
MediciFlags[MediciFlags["ALL"] = 2147483647] = "ALL";
|
|
3607
|
+
MediciFlags[MediciFlags["UPDATE_INTEREST_BEARING_MINT_RATE"] = 32] = "UPDATE_INTEREST_BEARING_MINT_RATE";
|
|
3608
|
+
MediciFlags[MediciFlags["ATTACH_TO_POLICY_ACCOUNT"] = 64] = "ATTACH_TO_POLICY_ACCOUNT";
|
|
3609
|
+
MediciFlags[MediciFlags["CREATE_POLICY_ACCOUNT"] = 128] = "CREATE_POLICY_ACCOUNT";
|
|
3610
|
+
MediciFlags[MediciFlags["DETACH_FROM_POLICY_ACCOUNT"] = 256] = "DETACH_FROM_POLICY_ACCOUNT";
|
|
3611
|
+
MediciFlags[MediciFlags["ADD_LEVELS"] = 512] = "ADD_LEVELS";
|
|
3612
|
+
MediciFlags[MediciFlags["ADD_LEVEL_TO_IDENTITY_ACCOUNT"] = 1024] = "ADD_LEVEL_TO_IDENTITY_ACCOUNT";
|
|
3613
|
+
MediciFlags[MediciFlags["REGISTER_INVESTOR"] = 2048] = "REGISTER_INVESTOR";
|
|
3614
|
+
MediciFlags[MediciFlags["REMOVE_LEVELS"] = 4096] = "REMOVE_LEVELS";
|
|
3615
|
+
MediciFlags[MediciFlags["REMOVE_INVESTOR"] = 8192] = "REMOVE_INVESTOR";
|
|
3616
|
+
MediciFlags[MediciFlags["EDIT_IDENTITY_METADATA"] = 16384] = "EDIT_IDENTITY_METADATA";
|
|
3617
|
+
MediciFlags[MediciFlags["REFRESH_LEVEL_TO_IDENTITY_ACCOUNT"] = 32768] = "REFRESH_LEVEL_TO_IDENTITY_ACCOUNT";
|
|
3618
|
+
MediciFlags[MediciFlags["ATTACH_WALLET_TO_IDENTITY"] = 65536] = "ATTACH_WALLET_TO_IDENTITY";
|
|
3619
|
+
MediciFlags[MediciFlags["DETACH_WALLET_FROM_IDENTITY"] = 131072] = "DETACH_WALLET_FROM_IDENTITY";
|
|
3620
|
+
MediciFlags[MediciFlags["SEIZE_TOKENS"] = 262144] = "SEIZE_TOKENS";
|
|
3621
|
+
MediciFlags[MediciFlags["CREATE_IDENTITY_ACCOUNT"] = 524288] = "CREATE_IDENTITY_ACCOUNT";
|
|
3622
|
+
MediciFlags[MediciFlags["CREATE_INVESTOR_LOCKS"] = 1048576] = "CREATE_INVESTOR_LOCKS";
|
|
3623
|
+
MediciFlags[MediciFlags["CLOSE_INVESTOR_LOCKS"] = 2097152] = "CLOSE_INVESTOR_LOCKS";
|
|
3624
|
+
MediciFlags[MediciFlags["ADD_TOKEN_LOCK"] = 4194304] = "ADD_TOKEN_LOCK";
|
|
3625
|
+
MediciFlags[MediciFlags["REMOVE_TOKEN_LOCK"] = 8388608] = "REMOVE_TOKEN_LOCK";
|
|
3626
|
+
MediciFlags[MediciFlags["CHANGE_COUNTERS"] = 16777216] = "CHANGE_COUNTERS";
|
|
3627
|
+
MediciFlags[MediciFlags["CHANGE_COUNTER_LIMITS"] = 33554432] = "CHANGE_COUNTER_LIMITS";
|
|
3628
|
+
MediciFlags[MediciFlags["CHANGE_COUNTRY"] = 67108864] = "CHANGE_COUNTRY";
|
|
3629
|
+
MediciFlags[MediciFlags["CHANGE_MAPPING"] = 134217728] = "CHANGE_MAPPING";
|
|
3630
|
+
MediciFlags[MediciFlags["CHANGE_ISSUANCE_POLICIES"] = 268435456] = "CHANGE_ISSUANCE_POLICIES";
|
|
3631
|
+
MediciFlags[MediciFlags["REMOVE_IDENTITY_ACCOUNT"] = 536870912] = "REMOVE_IDENTITY_ACCOUNT";
|
|
3632
|
+
MediciFlags[MediciFlags["ALL"] = 1073741823] = "ALL";
|
|
3579
3633
|
})(exports.MediciFlags || (exports.MediciFlags = {}));
|
|
3580
3634
|
|
|
3581
3635
|
/******************************************************************************
|
|
@@ -3630,7 +3684,7 @@ class AssetController {
|
|
|
3630
3684
|
* Update the asset controller's metadata.
|
|
3631
3685
|
* @param args - {@link UpdateAssetMetadataArgs}
|
|
3632
3686
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
3633
|
-
* @param authorizedUserRole -
|
|
3687
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
3634
3688
|
* @returns A Promise that resolves to the instructions to update the asset controller's metadata.
|
|
3635
3689
|
* */
|
|
3636
3690
|
updateAssetMetadata(args, assetAccessController, authorizedUserRole) {
|
|
@@ -3659,7 +3713,7 @@ class AssetController {
|
|
|
3659
3713
|
* Asynchronously generates instructions to issue tokens and lock tokens according to issuance policy.
|
|
3660
3714
|
* @param args - {@link IssueTokensWithLockArgs}
|
|
3661
3715
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
3662
|
-
* @param authorizedUserRole -
|
|
3716
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
3663
3717
|
*/
|
|
3664
3718
|
issueTokenIxns(args, assetAccessController, authorizedUserRole) {
|
|
3665
3719
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -3720,7 +3774,7 @@ class AssetController {
|
|
|
3720
3774
|
* Asynchronously generates instruction to freeze a token account.
|
|
3721
3775
|
* @param args - {@link FreezeTokenArgs}
|
|
3722
3776
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
3723
|
-
* @param authorizedUserRole -
|
|
3777
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
3724
3778
|
* @returns A Promise that resolves to the instruction to freeze.
|
|
3725
3779
|
*/
|
|
3726
3780
|
freezeTokenIxn(args, assetAccessController, authorizedUserRole) {
|
|
@@ -3748,7 +3802,7 @@ class AssetController {
|
|
|
3748
3802
|
* Asynchronously generates instruction to thaw a token account.
|
|
3749
3803
|
* @param args - {@link FreezeTokenArgs}
|
|
3750
3804
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
3751
|
-
* @param authorizedUserRole -
|
|
3805
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
3752
3806
|
* @returns A Promise that resolves to the instruction to thaw.
|
|
3753
3807
|
*/
|
|
3754
3808
|
thawTokenIxn(args, assetAccessController, authorizedUserRole) {
|
|
@@ -3778,11 +3832,11 @@ class AssetController {
|
|
|
3778
3832
|
* @param args - {@link RevokeTokensArgs}
|
|
3779
3833
|
* @param signer - User signer public key.
|
|
3780
3834
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
3835
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
3781
3836
|
* @param investorId - Optional investorId. Required if user is not an investor.
|
|
3782
|
-
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
3783
3837
|
* @returns A Promise that resolves to the instructions to revoke.
|
|
3784
3838
|
*/
|
|
3785
|
-
revokeTokenIxn(args, signer, assetAccessController,
|
|
3839
|
+
revokeTokenIxn(args, signer, assetAccessController, authorizedUserRole, investorId) {
|
|
3786
3840
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3787
3841
|
if (!args.wallet) {
|
|
3788
3842
|
throw new Error("Use wallet arg for wallet to revoke tokens from.");
|
|
@@ -3791,7 +3845,9 @@ class AssetController {
|
|
|
3791
3845
|
args.owner = args.wallet;
|
|
3792
3846
|
const revokeIx = yield rwaTokenSdk.getRevokeTokensIx(args, this.rwaClient.provider);
|
|
3793
3847
|
const identityRegistry = rwaTokenSdk.getIdentityRegistryPda(args.assetMint);
|
|
3794
|
-
const investorPda = investorId
|
|
3848
|
+
const investorPda = investorId
|
|
3849
|
+
? deriveInvestorPda(investorId, identityRegistry)
|
|
3850
|
+
: null;
|
|
3795
3851
|
const ixData = revokeIx.data;
|
|
3796
3852
|
const assetController = rwaTokenSdk.getAssetControllerPda(args.assetMint);
|
|
3797
3853
|
const revokeTokenAccount = splToken.getAssociatedTokenAddressSync(new web3_js.PublicKey(args.assetMint), new web3_js.PublicKey(args.wallet), false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
@@ -3820,37 +3876,11 @@ class AssetController {
|
|
|
3820
3876
|
.instruction();
|
|
3821
3877
|
});
|
|
3822
3878
|
}
|
|
3823
|
-
/**
|
|
3824
|
-
* Asynchronously generates instruction to close mint.
|
|
3825
|
-
* @param args - {@link CloseMintArgs}
|
|
3826
|
-
* @param assetAccessController - RBAC AssetAccessController account.
|
|
3827
|
-
* @param authorizedUserRole - Optional UserRole account. Required if user is not an admin.
|
|
3828
|
-
* @returns A Promise that resolves to the instruction to close mint.
|
|
3829
|
-
*/
|
|
3830
|
-
closeMintIxn(args, assetAccessController, authorizedUserRole) {
|
|
3831
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3832
|
-
const closeIx = yield rwaTokenSdk.getCloseMintIx(args, this.rwaClient.provider);
|
|
3833
|
-
const ixData = closeIx.data;
|
|
3834
|
-
return this.rbacProgram.methods
|
|
3835
|
-
.closeMintAccount(ixData)
|
|
3836
|
-
.accountsStrict({
|
|
3837
|
-
user: args.signer,
|
|
3838
|
-
controllerAuthority: args.authority,
|
|
3839
|
-
assetAccessController,
|
|
3840
|
-
authorizedUserRole: authorizedUserRole || null,
|
|
3841
|
-
assetControllerProgram: rwaTokenSdk.assetControllerProgramId,
|
|
3842
|
-
assetMint: args.assetMint,
|
|
3843
|
-
assetController: rwaTokenSdk.getAssetControllerPda(args.assetMint),
|
|
3844
|
-
tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
|
|
3845
|
-
})
|
|
3846
|
-
.instruction();
|
|
3847
|
-
});
|
|
3848
|
-
}
|
|
3849
3879
|
/**
|
|
3850
3880
|
* Asynchronously generates instruction to update mint interest rate.
|
|
3851
3881
|
* @param args - {@link UpdateInterestBearingMintRateArgs}
|
|
3852
3882
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
3853
|
-
* @param authorizedUserRole -
|
|
3883
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
3854
3884
|
* @returns A Promise that resolves to the instruction to update mint interest rate.
|
|
3855
3885
|
*/
|
|
3856
3886
|
updateInterestBearingMintRateIxn(args, assetAccessController, authorizedUserRole) {
|
|
@@ -3878,7 +3908,7 @@ class AssetController {
|
|
|
3878
3908
|
* @param args - {@link SeizeTokensArgs}
|
|
3879
3909
|
* @param signer - User signer public key.
|
|
3880
3910
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
3881
|
-
* @param authorizedUserRole -
|
|
3911
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
3882
3912
|
* @returns A Promise that resolves to the instruction to seize.
|
|
3883
3913
|
*/
|
|
3884
3914
|
seizeTokensIxn(args, investorId, signer, assetAccessController, authorizedUserRole) {
|
|
@@ -3976,7 +4006,7 @@ class PolicyEngine {
|
|
|
3976
4006
|
* @param args - {@link AttachPolicyArgs}
|
|
3977
4007
|
* @param signer - User signer public key.
|
|
3978
4008
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
3979
|
-
* @param authorizedUserRole -
|
|
4009
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
3980
4010
|
* @returns A Promise that resolves to the instructions to attach a policy.
|
|
3981
4011
|
* */
|
|
3982
4012
|
attachPolicy(args, signer, assetAccessController, authorizedUserRole) {
|
|
@@ -4004,7 +4034,7 @@ class PolicyEngine {
|
|
|
4004
4034
|
* @param args - {@link DetachPolicyArgs}
|
|
4005
4035
|
* @param signer - User signer public key.
|
|
4006
4036
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4007
|
-
* @param authorizedUserRole -
|
|
4037
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4008
4038
|
* @returns A Promise that resolves to the instructions to detach a policy.
|
|
4009
4039
|
* */
|
|
4010
4040
|
detachPolicy(args, signer, assetAccessController, authorizedUserRole) {
|
|
@@ -4032,7 +4062,7 @@ class PolicyEngine {
|
|
|
4032
4062
|
* @param args - {@link ChangeCountersArgs}
|
|
4033
4063
|
* @param signer - User signer public key.
|
|
4034
4064
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4035
|
-
* @param authorizedUserRole -
|
|
4065
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4036
4066
|
* @returns A Promise that resolves to the instructions to change the counters.
|
|
4037
4067
|
* */
|
|
4038
4068
|
changeCounters(args, signer, assetAccessController, authorizedUserRole) {
|
|
@@ -4060,7 +4090,7 @@ class PolicyEngine {
|
|
|
4060
4090
|
* @param args - {@link SetCountersArgs}
|
|
4061
4091
|
* @param signer - User signer public key.
|
|
4062
4092
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4063
|
-
* @param authorizedUserRole -
|
|
4093
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4064
4094
|
* @returns A Promise that resolves to the instructions to set the counter values.
|
|
4065
4095
|
* */
|
|
4066
4096
|
setCounters(args, signer, assetAccessController, authorizedUserRole) {
|
|
@@ -4087,7 +4117,7 @@ class PolicyEngine {
|
|
|
4087
4117
|
* @param args - {@link ChangeCounterLimitsArgs}
|
|
4088
4118
|
* @param signer - User signer public key.
|
|
4089
4119
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4090
|
-
* @param authorizedUserRole -
|
|
4120
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4091
4121
|
* @returns A Promise that resolves to the instructions to change the counters limits.
|
|
4092
4122
|
* */
|
|
4093
4123
|
changeCounterLimits(args, signer, assetAccessController, authorizedUserRole) {
|
|
@@ -4115,7 +4145,7 @@ class PolicyEngine {
|
|
|
4115
4145
|
* @param args - {@link ChangeMappingArgs}
|
|
4116
4146
|
* @param signer - User signer public key.
|
|
4117
4147
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4118
|
-
* @param authorizedUserRole -
|
|
4148
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4119
4149
|
* */
|
|
4120
4150
|
changeMapping(args, signer, assetAccessController, authorizedUserRole) {
|
|
4121
4151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -4141,7 +4171,7 @@ class PolicyEngine {
|
|
|
4141
4171
|
* @param args - {@link ChangeIssuancePoliciesArgs}
|
|
4142
4172
|
* @param signer - User signer public key.
|
|
4143
4173
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4144
|
-
* @param authorizedUserRole -
|
|
4174
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4145
4175
|
* */
|
|
4146
4176
|
changeIssuancePolicies(args, signer, assetAccessController, authorizedUserRole) {
|
|
4147
4177
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -4225,7 +4255,7 @@ class IdentityRegistry {
|
|
|
4225
4255
|
* @param args - {@link SetupUserArgs}
|
|
4226
4256
|
* @param authority - RBAC AssetAccessController ControllerAuthority.
|
|
4227
4257
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4228
|
-
* @param authorizedUserRole -
|
|
4258
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4229
4259
|
* @returns A Promise that resolves to the instructions to setup a user.
|
|
4230
4260
|
*
|
|
4231
4261
|
* It is required for at least a single user to be setup before issuing tokens.
|
|
@@ -4235,7 +4265,6 @@ class IdentityRegistry {
|
|
|
4235
4265
|
const { ixs } = yield this.rwaClient.identityRegistry.setupUserIxns(args);
|
|
4236
4266
|
const returnIxs = [];
|
|
4237
4267
|
const identityAccountIx = ixs[0];
|
|
4238
|
-
const trackerAccountIx = ixs[1];
|
|
4239
4268
|
const controllerAuthority = deriveControllerAuthorityPda(assetAccessController);
|
|
4240
4269
|
const identityAccount = rwaTokenSdk.getIdentityAccountPda(args.assetMint, args.owner);
|
|
4241
4270
|
returnIxs.push(yield this.rbacProgram.methods
|
|
@@ -4252,9 +4281,11 @@ class IdentityRegistry {
|
|
|
4252
4281
|
walletIdentity: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, args.owner),
|
|
4253
4282
|
systemProgram: web3_js.SystemProgram.programId,
|
|
4254
4283
|
eventAuthority: rwaTokenSdk.getIdentityRegistryEventAuthority(),
|
|
4284
|
+
policyEngineProgram: rwaTokenSdk.policyEngineProgramId,
|
|
4285
|
+
trackerAccount: rwaTokenSdk.getTrackerAccountPda(args.assetMint, args.owner),
|
|
4286
|
+
assetMint: args.assetMint,
|
|
4255
4287
|
})
|
|
4256
4288
|
.instruction());
|
|
4257
|
-
returnIxs.push(trackerAccountIx);
|
|
4258
4289
|
return {
|
|
4259
4290
|
ixs: returnIxs,
|
|
4260
4291
|
signers: [],
|
|
@@ -4266,7 +4297,7 @@ class IdentityRegistry {
|
|
|
4266
4297
|
* @param args - {@link SetupUserArgs}
|
|
4267
4298
|
* @param authority - RBAC AssetAccessController ControllerAuthority.
|
|
4268
4299
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4269
|
-
* @param authorizedUserRole -
|
|
4300
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4270
4301
|
* @returns A Promise that resolves to the instructions to setup a user.
|
|
4271
4302
|
*
|
|
4272
4303
|
* It is required for at least a single user to be setup before issuing tokens.
|
|
@@ -4291,6 +4322,9 @@ class IdentityRegistry {
|
|
|
4291
4322
|
walletIdentity: rwaTokenSdk.getWalletIdentityAccountPda(args.assetMint, args.owner),
|
|
4292
4323
|
eventAuthority: rwaTokenSdk.getIdentityRegistryEventAuthority(),
|
|
4293
4324
|
identityOwner: identityAccount.owner,
|
|
4325
|
+
policyEngineProgram: rwaTokenSdk.policyEngineProgramId,
|
|
4326
|
+
trackerAccount: rwaTokenSdk.getTrackerAccountPda(args.assetMint, args.owner),
|
|
4327
|
+
assetMint: args.assetMint,
|
|
4294
4328
|
})
|
|
4295
4329
|
.instruction();
|
|
4296
4330
|
return returnIx;
|
|
@@ -4300,7 +4334,7 @@ class IdentityRegistry {
|
|
|
4300
4334
|
* Asynchronously generates instruction to attach wallet to identity.
|
|
4301
4335
|
* @param args - {@link AttachDetachWalletArgs}
|
|
4302
4336
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4303
|
-
* @param authorizedUserRole -
|
|
4337
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4304
4338
|
* @returns A Promise that resolves to attach wallet.
|
|
4305
4339
|
* */
|
|
4306
4340
|
attachWalletToIdentityIxn(args, assetAccessController, authorizedUserRole) {
|
|
@@ -4348,7 +4382,7 @@ class IdentityRegistry {
|
|
|
4348
4382
|
* Asynchronously generates instruction to detach wallet from identity.
|
|
4349
4383
|
* @param args - {@link AttachDetachWalletArgs}
|
|
4350
4384
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4351
|
-
* @param authorizedUserRole -
|
|
4385
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4352
4386
|
* @returns A Promise that resolves to detach wallet.
|
|
4353
4387
|
* */
|
|
4354
4388
|
detachWalletFromIdentityIxn(args, assetAccessController, authorizedUserRole) {
|
|
@@ -4429,7 +4463,7 @@ class IdentityMetadataRegistry {
|
|
|
4429
4463
|
* @param args - {@link SetupInvestorArgs}
|
|
4430
4464
|
* @param authority - RBAC AssetAccessController ControllerAuthority.
|
|
4431
4465
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4432
|
-
* @param authorizedUserRole -
|
|
4466
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4433
4467
|
* @returns A Promise that resolves to the instructions to setup an investor.
|
|
4434
4468
|
*
|
|
4435
4469
|
* It is required for at least a single user to be setup before issuing tokens.
|
|
@@ -4458,6 +4492,9 @@ class IdentityMetadataRegistry {
|
|
|
4458
4492
|
eventAuthority: getEventAuthority(IMR_PROGRAM),
|
|
4459
4493
|
eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
|
|
4460
4494
|
program: rwaTokenSdk.identityRegistryProgramId,
|
|
4495
|
+
policyEngineProgram: rwaTokenSdk.policyEngineProgramId,
|
|
4496
|
+
trackerAccount: rwaTokenSdk.getTrackerAccountPda(args.assetMint, investor.toString()),
|
|
4497
|
+
assetMint: assetMintKey,
|
|
4461
4498
|
})
|
|
4462
4499
|
.instruction();
|
|
4463
4500
|
returnIxs.push(yield this.rbacProgram.methods
|
|
@@ -4477,21 +4514,9 @@ class IdentityMetadataRegistry {
|
|
|
4477
4514
|
systemProgram: web3_js.SystemProgram.programId,
|
|
4478
4515
|
eventAuthorityIdentityMetadataRegistry: getEventAuthority(IMR_PROGRAM),
|
|
4479
4516
|
eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
|
|
4480
|
-
|
|
4481
|
-
.
|
|
4482
|
-
const policyProgram = rwaTokenSdk.getPolicyEngineProgram(this.imrProgram.provider);
|
|
4483
|
-
const trackerAccount = web3_js.PublicKey.findProgramAddressSync([assetMintKey.toBuffer(), identityAccount.toBuffer()], policyProgram.programId)[0];
|
|
4484
|
-
returnIxs.push(yield policyProgram.methods
|
|
4485
|
-
.createTrackerAccount()
|
|
4486
|
-
.accountsStrict({
|
|
4487
|
-
payer: args.payer,
|
|
4488
|
-
trackerAccount,
|
|
4489
|
-
systemProgram: web3_js.SystemProgram.programId,
|
|
4490
|
-
program: policyProgram.programId,
|
|
4517
|
+
policyEngineProgram: rwaTokenSdk.policyEngineProgramId,
|
|
4518
|
+
trackerAccount: rwaTokenSdk.getTrackerAccountPda(args.assetMint, investor.toString()),
|
|
4491
4519
|
assetMint: assetMintKey,
|
|
4492
|
-
eventAuthority: rwaTokenSdk.getPolicyEngineEventAuthority(),
|
|
4493
|
-
identityRegistry,
|
|
4494
|
-
identityAccount,
|
|
4495
4520
|
})
|
|
4496
4521
|
.instruction());
|
|
4497
4522
|
if (args.levels.length > 1) {
|
|
@@ -4516,7 +4541,7 @@ class IdentityMetadataRegistry {
|
|
|
4516
4541
|
* Asynchronously add levels to investor.
|
|
4517
4542
|
* @param args - {@link AddLevelsArgs}
|
|
4518
4543
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4519
|
-
* @param authorizedUserRole -
|
|
4544
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4520
4545
|
* @returns A Promise that resolves to the instructions to add levels.
|
|
4521
4546
|
* */
|
|
4522
4547
|
addLevels(args, assetAccessController, authorizedUserRole) {
|
|
@@ -4574,7 +4599,7 @@ class IdentityMetadataRegistry {
|
|
|
4574
4599
|
* Asynchronously change country for the Investor.
|
|
4575
4600
|
* @param args - {@link ChangeCountryArgs}
|
|
4576
4601
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4577
|
-
* @param authorizedUserRole -
|
|
4602
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4578
4603
|
* @returns A Promise that resolves to the instructions to change the country.
|
|
4579
4604
|
* */
|
|
4580
4605
|
changeCountry(args, assetAccessController, authorizedUserRole) {
|
|
@@ -4627,7 +4652,7 @@ class IdentityMetadataRegistry {
|
|
|
4627
4652
|
* Asynchronously remove levels from an investor.
|
|
4628
4653
|
* @param args - {@link RemoveLevelsArgs}
|
|
4629
4654
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4630
|
-
* @param authorizedUserRole -
|
|
4655
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4631
4656
|
* @returns A Promise that resolves to the instructions to remove levels.
|
|
4632
4657
|
* */
|
|
4633
4658
|
removeLevels(args, assetAccessController, authorizedUserRole) {
|
|
@@ -4682,7 +4707,7 @@ class IdentityMetadataRegistry {
|
|
|
4682
4707
|
* Asynchronously remove an investor.
|
|
4683
4708
|
* @param args - {@link RemoveLevelsArgs}
|
|
4684
4709
|
* @param assetAccessController - RBAC AssetAccessController account.
|
|
4685
|
-
* @param authorizedUserRole -
|
|
4710
|
+
* @param authorizedUserRole - UserRole authorized to invoke instruction.
|
|
4686
4711
|
* @returns A Promise that resolves to the instructions to remove an investor.
|
|
4687
4712
|
* */
|
|
4688
4713
|
removeInvestor(args, assetAccessController, authorizedUserRole) {
|
|
@@ -4709,6 +4734,7 @@ class IdentityMetadataRegistry {
|
|
|
4709
4734
|
trackerAccount: rwaTokenSdk.getTrackerAccountPda(args.assetMint, investor.toString()),
|
|
4710
4735
|
eventAuthorityIdentityMetadataRegistry: getEventAuthority(IMR_PROGRAM),
|
|
4711
4736
|
eventAuthorityIdentityRegistry: rwaTokenSdk.getIdentityRegistryEventAuthority(),
|
|
4737
|
+
assetMint: args.assetMint,
|
|
4712
4738
|
})
|
|
4713
4739
|
.instruction();
|
|
4714
4740
|
});
|
|
@@ -4780,13 +4806,36 @@ class RwaRbacClient {
|
|
|
4780
4806
|
*/
|
|
4781
4807
|
createAssetAccessControllerIxn(args) {
|
|
4782
4808
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4809
|
+
const assetAccessController = deriveAssetAccessControllerPda(args.assetMint);
|
|
4810
|
+
const assetAccessControllerAuthority = deriveControllerAuthorityPda(assetAccessController);
|
|
4811
|
+
const cpiInstruction = yield this.assetController.setupNewRegistry({
|
|
4812
|
+
decimals: args.decimals,
|
|
4813
|
+
authority: assetAccessControllerAuthority.toString(),
|
|
4814
|
+
name: args.name,
|
|
4815
|
+
uri: args.uri,
|
|
4816
|
+
symbol: args.symbol,
|
|
4817
|
+
interestRate: args.interestRate,
|
|
4818
|
+
assetMint: args.assetMint.toString(),
|
|
4819
|
+
payer: args.payer.toString(),
|
|
4820
|
+
});
|
|
4783
4821
|
return this.rbacProgram.methods
|
|
4784
|
-
.createController(
|
|
4822
|
+
.createController(cpiInstruction.data)
|
|
4785
4823
|
.accountsStrict({
|
|
4786
4824
|
payer: args.payer,
|
|
4787
4825
|
admin: args.admin,
|
|
4788
|
-
assetAccessController
|
|
4826
|
+
assetAccessController,
|
|
4827
|
+
assetAccessControllerAuthority,
|
|
4828
|
+
assetMint: args.assetMint,
|
|
4829
|
+
assetController: cpiInstruction.keys[2].pubkey,
|
|
4830
|
+
extraMetasAccount: cpiInstruction.keys[4].pubkey,
|
|
4831
|
+
policyEngineAccount: cpiInstruction.keys[5].pubkey,
|
|
4832
|
+
identityRegistryAccount: cpiInstruction.keys[6].pubkey,
|
|
4833
|
+
policyEngineProgram: cpiInstruction.keys[7].pubkey,
|
|
4834
|
+
identityRegistryProgram: cpiInstruction.keys[8].pubkey,
|
|
4835
|
+
assetControllerProgram: cpiInstruction.programId,
|
|
4836
|
+
tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
|
|
4789
4837
|
systemProgram: web3_js.SystemProgram.programId,
|
|
4838
|
+
assetControllerEventAuthority: rwaTokenSdk.getAssetControllerEventAuthority(),
|
|
4790
4839
|
})
|
|
4791
4840
|
.instruction();
|
|
4792
4841
|
});
|
|
@@ -4817,7 +4866,7 @@ class RwaRbacClient {
|
|
|
4817
4866
|
// Fetch controller to get next UserRole id.
|
|
4818
4867
|
const controller = yield this.rbacProgram.account.assetAccessController.fetch(args.assetAccessController);
|
|
4819
4868
|
return this.rbacProgram.methods
|
|
4820
|
-
.createUserRole(args.name, new anchor.BN(args.allowedAdminIxs), new anchor.BN(args.allowedMediciIxs))
|
|
4869
|
+
.createUserRole(args.name, new anchor.BN(args.allowedAdminIxs), new anchor.BN(args.allowedMediciIxs), args.isMasterRole || false)
|
|
4821
4870
|
.accountsStrict({
|
|
4822
4871
|
payer: args.payer,
|
|
4823
4872
|
user: args.user,
|