@triadxyz/poseidons-protocol 0.1.3 → 0.1.6

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.
@@ -34,11 +34,13 @@ export default class Chest {
34
34
  * Place a bid on a chest
35
35
  * @param id - The id of the chest
36
36
  * @param coins - The coins to bid
37
+ * @param refer - The refer of the user
37
38
  * @returns The transaction signature or versioned transaction
38
39
  */
39
- placeChestBid({ id, coins }: {
40
+ placeChestBid({ id, coins, refer }: {
40
41
  id: number;
41
42
  coins: number;
43
+ refer: PublicKey;
42
44
  }): Promise<string | import("@solana/web3.js").VersionedTransaction>;
43
45
  /**
44
46
  * Add chest winners
@@ -71,9 +71,10 @@ class Chest {
71
71
  * Place a bid on a chest
72
72
  * @param id - The id of the chest
73
73
  * @param coins - The coins to bid
74
+ * @param refer - The refer of the user
74
75
  * @returns The transaction signature or versioned transaction
75
76
  */
76
- placeChestBid({ id, coins }) {
77
+ placeChestBid({ id, coins, refer }) {
77
78
  return __awaiter(this, void 0, void 0, function* () {
78
79
  const instructions = [
79
80
  yield this.program.methods
@@ -83,6 +84,7 @@ class Chest {
83
84
  })
84
85
  .accounts({
85
86
  signer: this.program.provider.publicKey,
87
+ refer: (0, pda_1.getUserPDA)(refer),
86
88
  user: (0, pda_1.getUserPDA)(this.program.provider.publicKey)
87
89
  })
88
90
  .instruction()
package/dist/index.d.ts CHANGED
@@ -79,10 +79,4 @@ export default class PoseidonsProtocolClient {
79
79
  * @returns The transaction signature or versioned transaction
80
80
  */
81
81
  createUser(refer: PublicKey): Promise<string | import("@solana/web3.js").VersionedTransaction>;
82
- /**
83
- * Withdraw funds
84
- * @param amount - The amount of funds to withdraw
85
- * @returns The transaction signature or versioned transaction
86
- */
87
- withdrawFunds(amount: number): Promise<string | import("@solana/web3.js").VersionedTransaction>;
88
82
  }
package/dist/index.js CHANGED
@@ -212,24 +212,5 @@ class PoseidonsProtocolClient {
212
212
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
213
213
  });
214
214
  }
215
- /**
216
- * Withdraw funds
217
- * @param amount - The amount of funds to withdraw
218
- * @returns The transaction signature or versioned transaction
219
- */
220
- withdrawFunds(amount) {
221
- return __awaiter(this, void 0, void 0, function* () {
222
- const ixs = [
223
- yield this.program.methods
224
- .withdrawFunds(new anchor_1.BN(amount * Math.pow(10, 6)))
225
- .accounts({
226
- signer: this.program.provider.publicKey,
227
- payer: this.rpcOptions.payer
228
- })
229
- .instruction()
230
- ];
231
- return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
232
- });
233
- }
234
215
  }
235
216
  exports.default = PoseidonsProtocolClient;
@@ -616,42 +616,6 @@
616
616
  "writable": true,
617
617
  "address": "t3DohmswhKk94PPbPYwA6ZKACyY3y5kbcqeQerAJjmV"
618
618
  },
619
- {
620
- "name": "user_ata",
621
- "writable": true,
622
- "pda": {
623
- "seeds": [
624
- {
625
- "kind": "account",
626
- "path": "user"
627
- },
628
- {
629
- "kind": "account",
630
- "path": "token_program"
631
- },
632
- {
633
- "kind": "account",
634
- "path": "mint"
635
- }
636
- ],
637
- "program": {
638
- "kind": "const",
639
- "value": [
640
- 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
641
- 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
642
- 219, 233, 248, 89
643
- ]
644
- }
645
- }
646
- },
647
- {
648
- "name": "token_program",
649
- "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
650
- },
651
- {
652
- "name": "associated_token_program",
653
- "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
654
- },
655
619
  {
656
620
  "name": "system_program",
657
621
  "address": "11111111111111111111111111111111"
@@ -698,6 +662,10 @@
698
662
  "name": "user",
699
663
  "writable": true
700
664
  },
665
+ {
666
+ "name": "refer",
667
+ "writable": true
668
+ },
701
669
  {
702
670
  "name": "mint",
703
671
  "writable": true,
@@ -710,7 +678,7 @@
710
678
  "seeds": [
711
679
  {
712
680
  "kind": "account",
713
- "path": "user"
681
+ "path": "signer"
714
682
  },
715
683
  {
716
684
  "kind": "account",
@@ -782,117 +750,6 @@
782
750
  }
783
751
  }
784
752
  ]
785
- },
786
- {
787
- "name": "withdraw_funds",
788
- "discriminator": [241, 36, 29, 111, 208, 31, 104, 217],
789
- "accounts": [
790
- {
791
- "name": "signer",
792
- "writable": true,
793
- "signer": true
794
- },
795
- {
796
- "name": "payer",
797
- "writable": true,
798
- "signer": true
799
- },
800
- {
801
- "name": "user",
802
- "writable": true,
803
- "pda": {
804
- "seeds": [
805
- {
806
- "kind": "const",
807
- "value": [117, 115, 101, 114]
808
- },
809
- {
810
- "kind": "account",
811
- "path": "signer"
812
- }
813
- ]
814
- }
815
- },
816
- {
817
- "name": "mint",
818
- "writable": true,
819
- "address": "t3DohmswhKk94PPbPYwA6ZKACyY3y5kbcqeQerAJjmV"
820
- },
821
- {
822
- "name": "signer_ata",
823
- "writable": true,
824
- "pda": {
825
- "seeds": [
826
- {
827
- "kind": "account",
828
- "path": "signer"
829
- },
830
- {
831
- "kind": "account",
832
- "path": "token_program"
833
- },
834
- {
835
- "kind": "account",
836
- "path": "mint"
837
- }
838
- ],
839
- "program": {
840
- "kind": "const",
841
- "value": [
842
- 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
843
- 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
844
- 219, 233, 248, 89
845
- ]
846
- }
847
- }
848
- },
849
- {
850
- "name": "user_ata",
851
- "writable": true,
852
- "pda": {
853
- "seeds": [
854
- {
855
- "kind": "account",
856
- "path": "user"
857
- },
858
- {
859
- "kind": "account",
860
- "path": "token_program"
861
- },
862
- {
863
- "kind": "account",
864
- "path": "mint"
865
- }
866
- ],
867
- "program": {
868
- "kind": "const",
869
- "value": [
870
- 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
871
- 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
872
- 219, 233, 248, 89
873
- ]
874
- }
875
- }
876
- },
877
- {
878
- "name": "token_program",
879
- "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
880
- },
881
- {
882
- "name": "associated_token_program",
883
- "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
884
- },
885
- {
886
- "name": "system_program",
887
- "address": "11111111111111111111111111111111"
888
- }
889
- ],
890
- "args": [
891
- {
892
- "name": "amount",
893
- "type": "u64"
894
- }
895
- ]
896
753
  }
897
754
  ],
898
755
  "accounts": [
@@ -972,6 +829,11 @@
972
829
  "code": 6004,
973
830
  "name": "InvalidAmount",
974
831
  "msg": "Invalid amount"
832
+ },
833
+ {
834
+ "code": 6005,
835
+ "name": "InvalidRefer",
836
+ "msg": "Invalid refer"
975
837
  }
976
838
  ],
977
839
  "types": [
@@ -849,71 +849,6 @@ export type PoseidonsProtocol = {
849
849
  writable: true;
850
850
  address: 't3DohmswhKk94PPbPYwA6ZKACyY3y5kbcqeQerAJjmV';
851
851
  },
852
- {
853
- name: 'userAta';
854
- writable: true;
855
- pda: {
856
- seeds: [
857
- {
858
- kind: 'account';
859
- path: 'user';
860
- },
861
- {
862
- kind: 'account';
863
- path: 'tokenProgram';
864
- },
865
- {
866
- kind: 'account';
867
- path: 'mint';
868
- }
869
- ];
870
- program: {
871
- kind: 'const';
872
- value: [
873
- 140,
874
- 151,
875
- 37,
876
- 143,
877
- 78,
878
- 36,
879
- 137,
880
- 241,
881
- 187,
882
- 61,
883
- 16,
884
- 41,
885
- 20,
886
- 142,
887
- 13,
888
- 131,
889
- 11,
890
- 90,
891
- 19,
892
- 153,
893
- 218,
894
- 255,
895
- 16,
896
- 132,
897
- 4,
898
- 142,
899
- 123,
900
- 216,
901
- 219,
902
- 233,
903
- 248,
904
- 89
905
- ];
906
- };
907
- };
908
- },
909
- {
910
- name: 'tokenProgram';
911
- address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
912
- },
913
- {
914
- name: 'associatedTokenProgram';
915
- address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
916
- },
917
852
  {
918
853
  name: 'systemProgram';
919
854
  address: '11111111111111111111111111111111';
@@ -960,6 +895,10 @@ export type PoseidonsProtocol = {
960
895
  name: 'user';
961
896
  writable: true;
962
897
  },
898
+ {
899
+ name: 'refer';
900
+ writable: true;
901
+ },
963
902
  {
964
903
  name: 'mint';
965
904
  writable: true;
@@ -972,7 +911,7 @@ export type PoseidonsProtocol = {
972
911
  seeds: [
973
912
  {
974
913
  kind: 'account';
975
- path: 'user';
914
+ path: 'signer';
976
915
  },
977
916
  {
978
917
  kind: 'account';
@@ -1102,175 +1041,6 @@ export type PoseidonsProtocol = {
1102
1041
  };
1103
1042
  }
1104
1043
  ];
1105
- },
1106
- {
1107
- name: 'withdrawFunds';
1108
- discriminator: [241, 36, 29, 111, 208, 31, 104, 217];
1109
- accounts: [
1110
- {
1111
- name: 'signer';
1112
- writable: true;
1113
- signer: true;
1114
- },
1115
- {
1116
- name: 'payer';
1117
- writable: true;
1118
- signer: true;
1119
- },
1120
- {
1121
- name: 'user';
1122
- writable: true;
1123
- pda: {
1124
- seeds: [
1125
- {
1126
- kind: 'const';
1127
- value: [117, 115, 101, 114];
1128
- },
1129
- {
1130
- kind: 'account';
1131
- path: 'signer';
1132
- }
1133
- ];
1134
- };
1135
- },
1136
- {
1137
- name: 'mint';
1138
- writable: true;
1139
- address: 't3DohmswhKk94PPbPYwA6ZKACyY3y5kbcqeQerAJjmV';
1140
- },
1141
- {
1142
- name: 'signerAta';
1143
- writable: true;
1144
- pda: {
1145
- seeds: [
1146
- {
1147
- kind: 'account';
1148
- path: 'signer';
1149
- },
1150
- {
1151
- kind: 'account';
1152
- path: 'tokenProgram';
1153
- },
1154
- {
1155
- kind: 'account';
1156
- path: 'mint';
1157
- }
1158
- ];
1159
- program: {
1160
- kind: 'const';
1161
- value: [
1162
- 140,
1163
- 151,
1164
- 37,
1165
- 143,
1166
- 78,
1167
- 36,
1168
- 137,
1169
- 241,
1170
- 187,
1171
- 61,
1172
- 16,
1173
- 41,
1174
- 20,
1175
- 142,
1176
- 13,
1177
- 131,
1178
- 11,
1179
- 90,
1180
- 19,
1181
- 153,
1182
- 218,
1183
- 255,
1184
- 16,
1185
- 132,
1186
- 4,
1187
- 142,
1188
- 123,
1189
- 216,
1190
- 219,
1191
- 233,
1192
- 248,
1193
- 89
1194
- ];
1195
- };
1196
- };
1197
- },
1198
- {
1199
- name: 'userAta';
1200
- writable: true;
1201
- pda: {
1202
- seeds: [
1203
- {
1204
- kind: 'account';
1205
- path: 'user';
1206
- },
1207
- {
1208
- kind: 'account';
1209
- path: 'tokenProgram';
1210
- },
1211
- {
1212
- kind: 'account';
1213
- path: 'mint';
1214
- }
1215
- ];
1216
- program: {
1217
- kind: 'const';
1218
- value: [
1219
- 140,
1220
- 151,
1221
- 37,
1222
- 143,
1223
- 78,
1224
- 36,
1225
- 137,
1226
- 241,
1227
- 187,
1228
- 61,
1229
- 16,
1230
- 41,
1231
- 20,
1232
- 142,
1233
- 13,
1234
- 131,
1235
- 11,
1236
- 90,
1237
- 19,
1238
- 153,
1239
- 218,
1240
- 255,
1241
- 16,
1242
- 132,
1243
- 4,
1244
- 142,
1245
- 123,
1246
- 216,
1247
- 219,
1248
- 233,
1249
- 248,
1250
- 89
1251
- ];
1252
- };
1253
- };
1254
- },
1255
- {
1256
- name: 'tokenProgram';
1257
- address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
1258
- },
1259
- {
1260
- name: 'associatedTokenProgram';
1261
- address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
1262
- },
1263
- {
1264
- name: 'systemProgram';
1265
- address: '11111111111111111111111111111111';
1266
- }
1267
- ];
1268
- args: [
1269
- {
1270
- name: 'amount';
1271
- type: 'u64';
1272
- }
1273
- ];
1274
1044
  }
1275
1045
  ];
1276
1046
  accounts: [
@@ -1350,6 +1120,11 @@ export type PoseidonsProtocol = {
1350
1120
  code: 6004;
1351
1121
  name: 'invalidAmount';
1352
1122
  msg: 'Invalid amount';
1123
+ },
1124
+ {
1125
+ code: 6005;
1126
+ name: 'invalidRefer';
1127
+ msg: 'Invalid refer';
1353
1128
  }
1354
1129
  ];
1355
1130
  types: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/poseidons-protocol",
3
- "version": "0.1.3",
3
+ "version": "0.1.6",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",