@streamflow/stream 7.3.1 → 7.3.2
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/cjs/sui/StreamClient.js +15 -37
- package/dist/esm/sui/StreamClient.js +8 -30
- package/package.json +4 -5
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const bcs_1 = require("@mysten/bcs");
|
|
4
3
|
const client_1 = require("@mysten/sui/client");
|
|
5
4
|
const transactions_1 = require("@mysten/sui/transactions");
|
|
6
5
|
const utils_1 = require("@mysten/sui/utils");
|
|
7
|
-
const
|
|
6
|
+
const bcs_1 = require("@mysten/sui/bcs");
|
|
8
7
|
const BaseStreamClient_js_1 = require("../common/BaseStreamClient.js");
|
|
9
8
|
const types_js_1 = require("../common/types.js");
|
|
10
9
|
const constants_js_1 = require("./constants.js");
|
|
@@ -58,39 +57,18 @@ class SuiStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
|
|
|
58
57
|
const metadataToRecipient = {};
|
|
59
58
|
const errors = [];
|
|
60
59
|
try {
|
|
61
|
-
const
|
|
60
|
+
const executedTx = await wallet.signAndExecuteTransaction({
|
|
62
61
|
transaction: tx,
|
|
63
62
|
options: { showEffects: true, showEvents: true },
|
|
64
63
|
});
|
|
65
|
-
|
|
66
|
-
// effects may be string according to Sui Wallet standard
|
|
64
|
+
const digest = executedTx.digest;
|
|
65
|
+
// effects may be string according to Sui Wallet standard, events won't even be returned
|
|
67
66
|
// https://github.com/MystenLabs/ts-sdks/blob/main/packages/wallet-standard/src/features/suiSignAndExecuteTransaction.ts#L34
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (currentEffects) {
|
|
74
|
-
effectsShort = currentEffects.status.Success
|
|
75
|
-
? {
|
|
76
|
-
status: "success",
|
|
77
|
-
}
|
|
78
|
-
: {
|
|
79
|
-
status: "failure",
|
|
80
|
-
error: currentEffects.status.$kind,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
else if (effects && effects.status) {
|
|
85
|
-
effectsShort = {
|
|
86
|
-
status: effects.status.status,
|
|
87
|
-
error: effects.status.error,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
if (!effectsShort) {
|
|
91
|
-
console.warn(`Got no effects from the transaction ${digest}, raw: ${effects}`);
|
|
92
|
-
}
|
|
93
|
-
if (effectsShort?.status === "failure") {
|
|
67
|
+
const { events, effects } = !executedTx.effects || typeof executedTx.effects === "string"
|
|
68
|
+
? await this.client.getTransactionBlock({ digest, options: { showEvents: true, showEffects: true } })
|
|
69
|
+
: executedTx;
|
|
70
|
+
txs.push(digest);
|
|
71
|
+
if (effects.status.status === "failure") {
|
|
94
72
|
multipleStreamData.recipients.forEach((recipient) => {
|
|
95
73
|
errors.push({
|
|
96
74
|
error: effects.status.error ?? "Unknown error!",
|
|
@@ -256,14 +234,14 @@ class SuiStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
|
|
|
256
234
|
tx.object(this.configId),
|
|
257
235
|
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
258
236
|
tx.gas,
|
|
259
|
-
|
|
260
|
-
.vector(
|
|
237
|
+
bcs_1.bcs
|
|
238
|
+
.vector(bcs_1.bcs.bool())
|
|
261
239
|
.serialize(updateData.enableAutomaticWithdrawal !== undefined ? [updateData.enableAutomaticWithdrawal] : []),
|
|
262
|
-
|
|
263
|
-
.vector(
|
|
240
|
+
bcs_1.bcs
|
|
241
|
+
.vector(bcs_1.bcs.u64())
|
|
264
242
|
.serialize(updateData.withdrawFrequency !== undefined ? [updateData.withdrawFrequency.toString()] : []),
|
|
265
|
-
|
|
266
|
-
.vector(
|
|
243
|
+
bcs_1.bcs
|
|
244
|
+
.vector(bcs_1.bcs.u64())
|
|
267
245
|
.serialize(updateData.amountPerPeriod !== undefined ? [updateData.amountPerPeriod.toString()] : []),
|
|
268
246
|
],
|
|
269
247
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fromBase64 } from "@mysten/bcs";
|
|
2
1
|
import { SuiClient } from "@mysten/sui/client";
|
|
3
2
|
import { Transaction } from "@mysten/sui/transactions";
|
|
4
3
|
import { SUI_CLOCK_OBJECT_ID, SUI_TYPE_ARG } from "@mysten/sui/utils";
|
|
@@ -60,39 +59,18 @@ export default class SuiStreamClient extends BaseStreamClient {
|
|
|
60
59
|
const metadataToRecipient = {};
|
|
61
60
|
const errors = [];
|
|
62
61
|
try {
|
|
63
|
-
const
|
|
62
|
+
const executedTx = await wallet.signAndExecuteTransaction({
|
|
64
63
|
transaction: tx,
|
|
65
64
|
options: { showEffects: true, showEvents: true },
|
|
66
65
|
});
|
|
67
|
-
|
|
68
|
-
// effects may be string according to Sui Wallet standard
|
|
66
|
+
const digest = executedTx.digest;
|
|
67
|
+
// effects may be string according to Sui Wallet standard, events won't even be returned
|
|
69
68
|
// https://github.com/MystenLabs/ts-sdks/blob/main/packages/wallet-standard/src/features/suiSignAndExecuteTransaction.ts#L34
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (currentEffects) {
|
|
76
|
-
effectsShort = currentEffects.status.Success
|
|
77
|
-
? {
|
|
78
|
-
status: "success",
|
|
79
|
-
}
|
|
80
|
-
: {
|
|
81
|
-
status: "failure",
|
|
82
|
-
error: currentEffects.status.$kind,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else if (effects && effects.status) {
|
|
87
|
-
effectsShort = {
|
|
88
|
-
status: effects.status.status,
|
|
89
|
-
error: effects.status.error,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
if (!effectsShort) {
|
|
93
|
-
console.warn(`Got no effects from the transaction ${digest}, raw: ${effects}`);
|
|
94
|
-
}
|
|
95
|
-
if (effectsShort?.status === "failure") {
|
|
69
|
+
const { events, effects } = !executedTx.effects || typeof executedTx.effects === "string"
|
|
70
|
+
? await this.client.getTransactionBlock({ digest, options: { showEvents: true, showEffects: true } })
|
|
71
|
+
: executedTx;
|
|
72
|
+
txs.push(digest);
|
|
73
|
+
if (effects.status.status === "failure") {
|
|
96
74
|
multipleStreamData.recipients.forEach((recipient) => {
|
|
97
75
|
errors.push({
|
|
98
76
|
error: effects.status.error ?? "Unknown error!",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/stream",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.2",
|
|
4
4
|
"description": "JavaScript SDK to interact with Streamflow protocol.",
|
|
5
5
|
"homepage": "https://github.com/streamflow-finance/js-sdk/",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"lint": "eslint --fix .",
|
|
43
43
|
"prepublishOnly": "pnpm run lint && pnpm run test run && pnpm run build"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "f124c062b751ea955dc18caeb1ccee5e6e7b0301",
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@streamflow/eslint-config": "7.3.
|
|
47
|
+
"@streamflow/eslint-config": "7.3.2",
|
|
48
48
|
"@types/bn.js": "5.1.1",
|
|
49
49
|
"@types/ethereum-checksum-address": "^0.0.0",
|
|
50
50
|
"date-fns": "2.28.0",
|
|
@@ -54,13 +54,12 @@
|
|
|
54
54
|
"@coral-xyz/anchor": "^0.30.1",
|
|
55
55
|
"@coral-xyz/borsh": "0.30.1",
|
|
56
56
|
"@manahippo/aptos-wallet-adapter": "1.0.10",
|
|
57
|
-
"@mysten/bcs": "1.1.0",
|
|
58
57
|
"@mysten/sui": "1.12.0",
|
|
59
58
|
"@solana/buffer-layout": "4.0.1",
|
|
60
59
|
"@solana/spl-token": "0.4.9",
|
|
61
60
|
"@solana/wallet-adapter-base": "0.9.19",
|
|
62
61
|
"@solana/web3.js": "1.95.4",
|
|
63
|
-
"@streamflow/common": "7.3.
|
|
62
|
+
"@streamflow/common": "7.3.2",
|
|
64
63
|
"@suiet/wallet-kit": "^0.3.3",
|
|
65
64
|
"aptos": "1.21.0",
|
|
66
65
|
"bn.js": "5.2.1",
|