@triadxyz/triad-protocol 0.1.2-alpha.8 → 0.1.2-beta
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.d.ts +2 -0
- package/dist/index.js +4 -3
- package/dist/stake.d.ts +135 -0
- package/dist/stake.js +483 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +107 -0
- package/dist/ticker.js +0 -6
- package/dist/types/idl_triad_protocol.json +1902 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +2 -0
- package/dist/types/stake.d.ts +130 -0
- package/dist/types/stake.js +20 -0
- package/dist/types/triad_protocol.d.ts +1527 -405
- package/dist/types/triad_protocol.js +0 -664
- package/dist/utils/constants.d.ts +31 -0
- package/dist/utils/constants.js +14 -1
- package/dist/utils/helpers.d.ts +19 -0
- package/dist/utils/helpers.js +88 -1
- package/dist/utils/stake-season-1/rarity.json +11036 -0
- package/dist/utils/stake-season-1/users-collections-week-1.json +3290 -0
- package/dist/vault.js +22 -6
- package/package.json +9 -8
package/dist/vault.js
CHANGED
|
@@ -54,7 +54,6 @@ class Vault {
|
|
|
54
54
|
try {
|
|
55
55
|
const UserPositionPDA = (0, helpers_1.getUserPositionAddressSync)(this.program.programId, this.provider.wallet.publicKey, tickerPDA);
|
|
56
56
|
const VaultPDA = (0, helpers_1.getVaultAddressSync)(this.program.programId, tickerPDA);
|
|
57
|
-
const VaultTokenAccountPDA = (0, helpers_1.getTokenVaultAddressSync)(this.program.programId, VaultPDA);
|
|
58
57
|
const userTokenAccount = yield (0, spl_token_1.getAssociatedTokenAddress)(mint, this.provider.wallet.publicKey);
|
|
59
58
|
let hasUserPosition = false;
|
|
60
59
|
try {
|
|
@@ -73,7 +72,6 @@ class Vault {
|
|
|
73
72
|
.createUserPosition()
|
|
74
73
|
.accounts({
|
|
75
74
|
signer: this.provider.wallet.publicKey,
|
|
76
|
-
userPosition: UserPositionPDA,
|
|
77
75
|
ticker: tickerPDA
|
|
78
76
|
})
|
|
79
77
|
.instruction());
|
|
@@ -87,7 +85,6 @@ class Vault {
|
|
|
87
85
|
userPosition: UserPositionPDA,
|
|
88
86
|
ticker: tickerPDA,
|
|
89
87
|
vault: VaultPDA,
|
|
90
|
-
vaultTokenAccount: VaultTokenAccountPDA,
|
|
91
88
|
userTokenAccount
|
|
92
89
|
})
|
|
93
90
|
.instruction());
|
|
@@ -97,7 +94,17 @@ class Vault {
|
|
|
97
94
|
recentBlockhash: blockhash,
|
|
98
95
|
instructions
|
|
99
96
|
}).compileToV0Message();
|
|
100
|
-
|
|
97
|
+
const hash = yield this.provider.sendAndConfirm(new web3_js_1.VersionedTransaction(message));
|
|
98
|
+
const { blockhash: blockhash2, lastValidBlockHeight } = yield this.provider.connection.getLatestBlockhash();
|
|
99
|
+
const confirmTx = yield this.provider.connection.confirmTransaction({
|
|
100
|
+
signature: hash,
|
|
101
|
+
blockhash: blockhash2,
|
|
102
|
+
lastValidBlockHeight
|
|
103
|
+
}, 'finalized');
|
|
104
|
+
if (confirmTx.value.err) {
|
|
105
|
+
throw new Error('Failed to open position');
|
|
106
|
+
}
|
|
107
|
+
return hash;
|
|
101
108
|
}
|
|
102
109
|
catch (error) {
|
|
103
110
|
console.error(error);
|
|
@@ -139,7 +146,6 @@ class Vault {
|
|
|
139
146
|
.createUserPosition()
|
|
140
147
|
.accounts({
|
|
141
148
|
signer: this.provider.wallet.publicKey,
|
|
142
|
-
userPosition: UserPositionPDA,
|
|
143
149
|
ticker: tickerPDA
|
|
144
150
|
})
|
|
145
151
|
.instruction());
|
|
@@ -160,7 +166,17 @@ class Vault {
|
|
|
160
166
|
recentBlockhash: blockhash,
|
|
161
167
|
instructions
|
|
162
168
|
}).compileToV0Message();
|
|
163
|
-
|
|
169
|
+
const hash = yield this.provider.sendAndConfirm(new web3_js_1.VersionedTransaction(message));
|
|
170
|
+
const { blockhash: blockhash2, lastValidBlockHeight } = yield this.provider.connection.getLatestBlockhash();
|
|
171
|
+
const confirmTx = yield this.provider.connection.confirmTransaction({
|
|
172
|
+
signature: hash,
|
|
173
|
+
blockhash: blockhash2,
|
|
174
|
+
lastValidBlockHeight
|
|
175
|
+
}, 'finalized');
|
|
176
|
+
if (confirmTx.value.err) {
|
|
177
|
+
throw new Error('Failed to open position');
|
|
178
|
+
}
|
|
179
|
+
return hash;
|
|
164
180
|
}
|
|
165
181
|
catch (error) {
|
|
166
182
|
console.error(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@triadxyz/triad-protocol",
|
|
3
|
-
"version": "0.1.2-
|
|
3
|
+
"version": "0.1.2-beta",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"clean": "rimraf dist",
|
|
9
9
|
"build": "yarn run clean && tsc",
|
|
10
10
|
"prepublishOnly": "yarn build",
|
|
11
|
-
"start": "yarn build && node ./dist/test.js"
|
|
11
|
+
"start": "yarn build && node ./dist/test.js",
|
|
12
|
+
"test": "rimraf dist && tsc && node ./dist/test.js"
|
|
12
13
|
},
|
|
13
14
|
"publishConfig": {
|
|
14
15
|
"access": "public"
|
|
@@ -24,18 +25,18 @@
|
|
|
24
25
|
"blockchain",
|
|
25
26
|
"protocol",
|
|
26
27
|
"triad",
|
|
27
|
-
"trading protocols"
|
|
28
|
+
"trading protocols",
|
|
29
|
+
"dex",
|
|
30
|
+
"SPL 404"
|
|
28
31
|
],
|
|
29
32
|
"author": "Triad Labs",
|
|
30
33
|
"license": "ISC",
|
|
31
34
|
"dependencies": {
|
|
32
|
-
"@coral-xyz/anchor": "0.
|
|
33
|
-
"@
|
|
34
|
-
"@pythnetwork/client": "^2.19.0",
|
|
35
|
-
"@shadow-drive/sdk": "5.0.0",
|
|
36
|
-
"@solana/spl-token": "^0.3.11",
|
|
35
|
+
"@coral-xyz/anchor": "0.30.0",
|
|
36
|
+
"@solana/spl-token": "0.4.6",
|
|
37
37
|
"@solana/web3.js": "1.89.1",
|
|
38
38
|
"axios": "^1.5.1",
|
|
39
|
+
"bn.js": "^5.2.1",
|
|
39
40
|
"bs58": "5.0.0",
|
|
40
41
|
"uuid": "^9.0.1"
|
|
41
42
|
},
|