@unifiedflow/unified-flow-sdk 1.0.4 → 1.0.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.
- package/dist/client.d.ts +5 -0
- package/dist/client.js +8 -1
- package/package.json +22 -22
package/dist/client.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ export interface MilestoneInput {
|
|
|
8
8
|
amount: anchor.BN;
|
|
9
9
|
}
|
|
10
10
|
export type TxProgressPhase = "wallet_approval" | "sending" | "confirming";
|
|
11
|
+
export declare function getAnchorWallet(session: WalletSession): {
|
|
12
|
+
publicKey: anchor.web3.PublicKey;
|
|
13
|
+
signTransaction: <T extends anchor.web3.Transaction | anchor.web3.VersionedTransaction>(transaction: T) => Promise<T>;
|
|
14
|
+
signAllTransactions: <T extends anchor.web3.Transaction | anchor.web3.VersionedTransaction>(transactions: T[]) => Promise<T[]>;
|
|
15
|
+
};
|
|
11
16
|
export declare class UnifiedFlowClient {
|
|
12
17
|
private readonly program;
|
|
13
18
|
private readonly wallet;
|
package/dist/client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UnifiedFlowClient = exports.SOL_USD_FEED = exports.CHAINLINK_PROGRAM_ID = void 0;
|
|
4
|
+
exports.getAnchorWallet = getAnchorWallet;
|
|
4
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
6
|
const spl_token_1 = require("@solana/spl-token");
|
|
6
7
|
const kit_1 = require("@solana/kit");
|
|
@@ -177,25 +178,29 @@ class UnifiedFlowClient {
|
|
|
177
178
|
const vault = (0, pda_1.getVaultATA)(mint, streamPDA);
|
|
178
179
|
const anchorIx = await this.program.methods
|
|
179
180
|
.cancel()
|
|
180
|
-
.
|
|
181
|
+
.accountsStrict({
|
|
181
182
|
creator,
|
|
182
183
|
stream: streamPDA,
|
|
184
|
+
mint,
|
|
183
185
|
config,
|
|
184
186
|
vault,
|
|
185
187
|
creatorTokenAccount,
|
|
186
188
|
recipientTokenAccount,
|
|
187
189
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
190
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
188
191
|
})
|
|
189
192
|
.instruction();
|
|
190
193
|
const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash(this.commitment);
|
|
191
194
|
const kitIx = this._toKitInstruction(anchorIx, [
|
|
192
195
|
{ address: creator.toBase58(), role: kit_1.AccountRole.WRITABLE_SIGNER, signer: this.kitSigner },
|
|
193
196
|
{ address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
|
|
197
|
+
{ address: mint.toBase58(), role: kit_1.AccountRole.READONLY },
|
|
194
198
|
{ address: config.toBase58(), role: kit_1.AccountRole.READONLY },
|
|
195
199
|
{ address: vault.toBase58(), role: kit_1.AccountRole.WRITABLE },
|
|
196
200
|
{ address: creatorTokenAccount.toBase58(), role: kit_1.AccountRole.WRITABLE },
|
|
197
201
|
{ address: recipientTokenAccount.toBase58(), role: kit_1.AccountRole.WRITABLE },
|
|
198
202
|
{ address: spl_token_1.TOKEN_PROGRAM_ID.toBase58(), role: kit_1.AccountRole.READONLY },
|
|
203
|
+
{ address: web3_js_1.SystemProgram.programId.toBase58(), role: kit_1.AccountRole.READONLY },
|
|
199
204
|
]);
|
|
200
205
|
const txMsg = this._buildTxMessage(kitIx, blockhash, lastValidBlockHeight);
|
|
201
206
|
onStatus?.("sending");
|
|
@@ -215,6 +220,7 @@ class UnifiedFlowClient {
|
|
|
215
220
|
creator,
|
|
216
221
|
stream: streamPDA,
|
|
217
222
|
milestone: milestonePDA,
|
|
223
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
218
224
|
})
|
|
219
225
|
.instruction();
|
|
220
226
|
const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash(this.commitment);
|
|
@@ -222,6 +228,7 @@ class UnifiedFlowClient {
|
|
|
222
228
|
{ address: creator.toBase58(), role: kit_1.AccountRole.WRITABLE_SIGNER, signer: this.kitSigner },
|
|
223
229
|
{ address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
|
|
224
230
|
{ address: milestonePDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
|
|
231
|
+
{ address: web3_js_1.SystemProgram.programId.toBase58(), role: kit_1.AccountRole.READONLY },
|
|
225
232
|
]);
|
|
226
233
|
const txMsg = this._buildTxMessage(kitIx, blockhash, lastValidBlockHeight);
|
|
227
234
|
onStatus?.("sending");
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@unifiedflow/unified-flow-sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "SDK for the Unified Flow program",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"dist",
|
|
12
|
-
"README.md"
|
|
13
|
-
],
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@coral-xyz/anchor": "^0.32.1",
|
|
16
|
-
"@solana/client": "^1.7.0",
|
|
17
|
-
"@solana/spl-token": "^0.4.0",
|
|
18
|
-
"@solana/web3.js": "^1.90.0"
|
|
19
|
-
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"typescript": "^5.0.0"
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@unifiedflow/unified-flow-sdk",
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"description": "SDK for the Unified Flow program",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@coral-xyz/anchor": "^0.32.1",
|
|
16
|
+
"@solana/client": "^1.7.0",
|
|
17
|
+
"@solana/spl-token": "^0.4.0",
|
|
18
|
+
"@solana/web3.js": "^1.90.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "^5.0.0"
|
|
22
|
+
}
|
|
23
23
|
}
|