@streamflow/stream 5.10.4 → 6.0.0-alpha.0

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.
@@ -120,7 +120,9 @@ var SuiStreamClient = /** @class */ (function (_super) {
120
120
  switch (_e.label) {
121
121
  case 0:
122
122
  wallet = new wallet_1.SuiWalletWrapper(senderWallet, this.client);
123
- return [4 /*yield*/, this.getTotalFee({ address: (_b = streamData.partner) !== null && _b !== void 0 ? _b : wallet.address })];
123
+ return [4 /*yield*/, this.getTotalFee({
124
+ address: (_b = streamData.partner) !== null && _b !== void 0 ? _b : wallet.address,
125
+ })];
124
126
  case 1:
125
127
  totalFee = _e.sent();
126
128
  return [4 /*yield*/, this.generateCreateBlock(wallet.address, __assign(__assign({}, streamData), { recipients: [__assign({}, streamData)] }), totalFee)];
@@ -270,11 +272,7 @@ var SuiStreamClient = /** @class */ (function (_super) {
270
272
  txb.moveCall({
271
273
  target: "".concat(this.programId, "::protocol::cancel"),
272
274
  typeArguments: [tokenId],
273
- arguments: [
274
- txb.object(cancelData.id),
275
- txb.object(this.configId),
276
- txb.object(utils_1.SUI_CLOCK_OBJECT_ID),
277
- ],
275
+ arguments: [txb.object(cancelData.id), txb.object(this.configId), txb.object(utils_1.SUI_CLOCK_OBJECT_ID)],
278
276
  });
279
277
  return [4 /*yield*/, wallet.signAndExecuteTransactionBlock({
280
278
  transactionBlock: txb,
@@ -420,12 +418,8 @@ var SuiStreamClient = /** @class */ (function (_super) {
420
418
  txb.object(this.configId),
421
419
  txb.object(utils_1.SUI_CLOCK_OBJECT_ID),
422
420
  txb.gas,
423
- txb.pure(updateData.enableAutomaticWithdrawal !== undefined
424
- ? [updateData.enableAutomaticWithdrawal]
425
- : [], "vector<bool>"),
426
- txb.pure(updateData.withdrawFrequency !== undefined
427
- ? [updateData.withdrawFrequency.toString()]
428
- : [], "vector<u64>"),
421
+ txb.pure(updateData.enableAutomaticWithdrawal !== undefined ? [updateData.enableAutomaticWithdrawal] : [], "vector<bool>"),
422
+ txb.pure(updateData.withdrawFrequency !== undefined ? [updateData.withdrawFrequency.toString()] : [], "vector<u64>"),
429
423
  txb.pure(updateData.amountPerPeriod !== undefined ? [updateData.amountPerPeriod.toString()] : [], "vector<u64>"),
430
424
  ],
431
425
  });
package/dist/sui/utils.js CHANGED
@@ -10,9 +10,7 @@ function extractSuiErrorInfo(errorText) {
10
10
  }
11
11
  var moduleName = match[2];
12
12
  var errorCode = Number(match[4]);
13
- var errorName = constants_1.SUI_MODULE_ERROR_MAP[moduleName]
14
- ? constants_1.SUI_MODULE_ERROR_MAP[moduleName][errorCode]
15
- : undefined;
13
+ var errorName = constants_1.SUI_MODULE_ERROR_MAP[moduleName] ? constants_1.SUI_MODULE_ERROR_MAP[moduleName][errorCode] : undefined;
16
14
  var index = Number(match[5]);
17
15
  if (index) {
18
16
  error.index = index;
@@ -2,6 +2,12 @@ import { Keypair } from "@mysten/sui.js/cryptography";
2
2
  import { WalletContextState } from "@suiet/wallet-kit";
3
3
  import { SuiClient, SuiTransactionBlockResponse } from "@mysten/sui.js/client";
4
4
  import { SuiSignAndExecuteTransactionBlockInput } from "./types";
5
+ /**
6
+ * Utility function to check if the transaction initiator is a Wallet object
7
+ * @param {Keypair | SignerWalletAdapter} walletOrKeypair - Wallet or Keypair in question
8
+ * @return {boolean} - Returns true if parameter is a Wallet.
9
+ */
10
+ export declare function isSignerKeypair(walletOrKeypair: Keypair | WalletContextState): walletOrKeypair is Keypair;
5
11
  export declare class SuiWalletWrapper<T extends WalletContextState | Keypair> {
6
12
  wallet: T;
7
13
  address: string;
@@ -47,13 +47,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  }
48
48
  };
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.SuiWalletWrapper = void 0;
50
+ exports.SuiWalletWrapper = exports.isSignerKeypair = void 0;
51
51
  var cryptography_1 = require("@mysten/sui.js/cryptography");
52
+ /**
53
+ * Utility function to check if the transaction initiator is a Wallet object
54
+ * @param {Keypair | SignerWalletAdapter} walletOrKeypair - Wallet or Keypair in question
55
+ * @return {boolean} - Returns true if parameter is a Wallet.
56
+ */
57
+ function isSignerKeypair(walletOrKeypair) {
58
+ return (walletOrKeypair instanceof cryptography_1.Keypair ||
59
+ walletOrKeypair.constructor === cryptography_1.Keypair ||
60
+ walletOrKeypair.constructor.name === cryptography_1.Keypair.prototype.constructor.name);
61
+ }
62
+ exports.isSignerKeypair = isSignerKeypair;
52
63
  var SuiWalletWrapper = /** @class */ (function () {
53
64
  function SuiWalletWrapper(wallet, client) {
54
65
  this.client = client;
55
66
  this.wallet = wallet;
56
- if (wallet instanceof cryptography_1.Keypair) {
67
+ if (isSignerKeypair(wallet)) {
57
68
  this.address = wallet.toSuiAddress();
58
69
  }
59
70
  else {
@@ -63,9 +74,12 @@ var SuiWalletWrapper = /** @class */ (function () {
63
74
  SuiWalletWrapper.prototype.signAndExecuteTransactionBlock = function (input) {
64
75
  return __awaiter(this, void 0, void 0, function () {
65
76
  return __generator(this, function (_a) {
66
- if (this.wallet instanceof cryptography_1.Keypair) {
67
- return [2 /*return*/, this.client.signAndExecuteTransactionBlock(__assign(__assign({}, input), { signer: this.wallet }))];
77
+ if (isSignerKeypair(this.wallet)) {
78
+ return [2 /*return*/, this.client.signAndExecuteTransactionBlock(__assign(__assign({}, input), {
79
+ // @ts-ignore
80
+ signer: this.wallet }))];
68
81
  }
82
+ // @ts-ignore
69
83
  return [2 /*return*/, this.wallet.signAndExecuteTransactionBlock(input)];
70
84
  });
71
85
  });
package/package.json CHANGED
@@ -1,39 +1,60 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "5.10.4",
3
+ "version": "6.0.0-alpha.0",
4
4
  "description": "JavaScript SDK to interact with Streamflow protocol.",
5
5
  "homepage": "https://github.com/streamflow-finance/js-sdk/",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": "./dist/index.js",
10
+ "./aptos": "./dist/aptos/index.js",
11
+ "./evm": "./dist/evm/index.js",
12
+ "./solana": "./dist/solana/index.js",
13
+ "./sui": "./dist/sui/index.js"
14
+ },
15
+ "typesVersions": {
16
+ "*": {
17
+ "aptos": [
18
+ "dist/aptos/index.d.ts"
19
+ ],
20
+ "evm": [
21
+ "dist/evm/index.d.ts"
22
+ ],
23
+ "solana": [
24
+ "dist/solana/index.d.ts"
25
+ ],
26
+ "sui": [
27
+ "dist/sui/index.d.ts"
28
+ ]
29
+ }
30
+ },
8
31
  "scripts": {
9
32
  "build": "rm -rf dist; tsc -p tsconfig.json",
33
+ "pack": "pnpm build && pnpm pack",
10
34
  "test": "jest .",
11
- "lint": "eslint .",
35
+ "lint": "eslint --fix .",
12
36
  "prepublishOnly": "npm run lint && npm test && npm run build"
13
37
  },
14
- "gitHead": "6391e45fba526e981e5fb576109f79b5d6418197",
38
+ "gitHead": "5b1627a35ea628cf51c8b271db049211975302d1",
15
39
  "devDependencies": {
40
+ "@streamflow/eslint-config": "6.0.0-alpha.0",
16
41
  "@types/bn.js": "5.1.1",
17
42
  "@types/ethereum-checksum-address": "^0.0.0",
18
43
  "@types/jest": "29.2.4",
19
44
  "date-fns": "2.28.0",
20
- "eslint": "8.29.0",
21
- "eslint-config-airbnb-typescript": "17.0.0",
22
- "eslint-config-prettier": "8.5.0",
23
- "eslint-plugin-jest": "27.1.6",
24
- "eslint-plugin-prettier": "4.2.1",
25
45
  "jest": "29.3.1",
26
- "prettier": "2.8.1",
27
46
  "ts-jest": "29.0.3",
28
47
  "typescript": "^5.3.3"
29
48
  },
30
49
  "dependencies": {
50
+ "@coral-xyz/borsh": "^0.29.0",
31
51
  "@manahippo/aptos-wallet-adapter": "1.0.6",
32
52
  "@mysten/sui.js": "^0.45.1",
33
53
  "@solana/buffer-layout": "4.0.1 ",
34
54
  "@solana/spl-token": "0.3.6",
35
55
  "@solana/wallet-adapter-base": "0.9.19",
36
56
  "@solana/web3.js": "1.70.1",
57
+ "@streamflow/common": "6.0.0-alpha.0",
37
58
  "@suiet/wallet-kit": "0.2.22",
38
59
  "aptos": "1.4.0",
39
60
  "bn.js": "5.2.1",