Skip to content

Commit a7e696a

Browse files
authored
refetch transaction after confirming on sui (#249)
* refetch transaction after confirming on sui * v7.3.2
1 parent 1c65f9a commit a7e696a

File tree

8 files changed

+16
-38
lines changed

8 files changed

+16
-38
lines changed

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"packages": [
33
"packages/*"
44
],
5-
"version": "7.3.1",
5+
"version": "7.3.2",
66
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
77
}

packages/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@streamflow/common",
3-
"version": "7.3.1",
3+
"version": "7.3.2",
44
"description": "Common utilities and types used by streamflow packages.",
55
"homepage": "https://github.com/streamflow-finance/js-sdk/",
66
"main": "./dist/esm/index.js",

packages/distributor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@streamflow/distributor",
3-
"version": "7.3.1",
3+
"version": "7.3.2",
44
"description": "JavaScript SDK to interact with Streamflow Airdrop protocol.",
55
"homepage": "https://github.com/streamflow-finance/js-sdk/",
66
"main": "dist/esm/index.js",

packages/eslint-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@streamflow/eslint-config",
3-
"version": "7.3.1",
3+
"version": "7.3.2",
44
"license": "ISC",
55
"main": "index.js",
66
"files": [

packages/launchpad/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@streamflow/launchpad",
3-
"version": "7.3.1",
3+
"version": "7.3.2",
44
"description": "JavaScript SDK to interact with Streamflow Launchpad protocol.",
55
"homepage": "https://github.com/streamflow-finance/js-sdk/",
66
"main": "dist/esm/index.js",

packages/staking/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@streamflow/staking",
3-
"version": "7.3.1",
3+
"version": "7.3.2",
44
"description": "JavaScript SDK to interact with Streamflow Staking protocol.",
55
"homepage": "https://github.com/streamflow-finance/js-sdk/",
66
"main": "dist/esm/index.js",

packages/stream/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@streamflow/stream",
3-
"version": "7.3.1",
3+
"version": "7.3.2",
44
"description": "JavaScript SDK to interact with Streamflow protocol.",
55
"homepage": "https://github.com/streamflow-finance/js-sdk/",
66
"main": "./dist/esm/index.js",
@@ -54,7 +54,6 @@
5454
"@coral-xyz/anchor": "^0.30.1",
5555
"@coral-xyz/borsh": "0.30.1",
5656
"@manahippo/aptos-wallet-adapter": "1.0.10",
57-
"@mysten/bcs": "1.1.0",
5857
"@mysten/sui": "1.12.0",
5958
"@solana/buffer-layout": "4.0.1",
6059
"@solana/spl-token": "0.4.9",

packages/stream/sui/StreamClient.ts

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import BN from "bn.js";
2-
import { fromBase64 } from "@mysten/bcs";
32
import { CoinStruct, SuiClient } from "@mysten/sui/client";
43
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
54
import { SUI_CLOCK_OBJECT_ID, SUI_TYPE_ARG } from "@mysten/sui/utils";
@@ -109,40 +108,20 @@ export default class SuiStreamClient extends BaseStreamClient {
109108
const errors: ICreateMultiError[] = [];
110109

111110
try {
112-
const { digest, events, effects } = await wallet.signAndExecuteTransaction({
111+
const executedTx = await wallet.signAndExecuteTransaction({
113112
transaction: tx,
114113
options: { showEffects: true, showEvents: true },
115114
});
116-
txs.push(digest);
117-
118-
// effects may be string according to Sui Wallet standard
115+
const digest = executedTx.digest;
116+
// effects may be string according to Sui Wallet standard, events won't even be returned
119117
// https://github.com/MystenLabs/ts-sdks/blob/main/packages/wallet-standard/src/features/suiSignAndExecuteTransaction.ts#L34
120-
// Loosely ported from https://github.com/MystenLabs/ts-sdks/blob/main/packages/graphql-transport/src/mappers/transaction-block.ts#L376
121-
let effectsShort: { status: "success" | "failure"; error?: string } | undefined = undefined;
122-
if (typeof effects === "string") {
123-
const parsedEffects = bcs.TransactionEffects.parse(fromBase64(effects));
124-
const currentEffects = parsedEffects.V2 || parsedEffects.V1;
125-
if (currentEffects) {
126-
effectsShort = currentEffects.status.Success
127-
? {
128-
status: "success",
129-
}
130-
: {
131-
status: "failure",
132-
error: currentEffects.status.$kind,
133-
};
134-
}
135-
} else if (effects && effects.status) {
136-
effectsShort = {
137-
status: effects.status.status,
138-
error: effects.status.error,
139-
};
140-
}
141-
if (!effectsShort) {
142-
console.warn(`Got no effects from the transaction ${digest}, raw: ${effects}`);
143-
}
118+
const { events, effects } =
119+
!executedTx.effects || typeof executedTx.effects === "string"
120+
? await this.client.getTransactionBlock({ digest, options: { showEvents: true, showEffects: true } })
121+
: executedTx;
122+
txs.push(digest);
144123

145-
if (effectsShort?.status === "failure") {
124+
if (effects!.status.status === "failure") {
146125
multipleStreamData.recipients.forEach((recipient) => {
147126
errors.push({
148127
error: effects!.status.error ?? "Unknown error!",

0 commit comments

Comments
 (0)