@streamflow/stream 5.6.4 → 5.6.5

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.
@@ -1,13 +1,13 @@
1
1
  import { ICreateStreamData, ICreateMultipleStreamData, IWithdrawData, ICancelData, ITransferData, ITopUpData, IGetOneData, IUpdateData, ITransactionResult, IMultiTransactionResult, ICreateResult, IGetAllData, Stream } from "./types";
2
2
  export declare abstract class BaseStreamClient {
3
- protected abstract create(streamData: ICreateStreamData, chainSpecificParams: any): Promise<ICreateResult>;
4
- protected abstract createMultiple(multipleStreamData: ICreateMultipleStreamData, chainSpecificParams: any): Promise<IMultiTransactionResult>;
5
- protected abstract withdraw(withdrawData: IWithdrawData, chainSpecificParams: any): Promise<ITransactionResult>;
6
- protected abstract cancel(cancelData: ICancelData, chainSpecificParams: any): Promise<ITransactionResult>;
7
- protected abstract transfer(transferData: ITransferData, chainSpecificParams: any): Promise<ITransactionResult>;
8
- protected abstract topup(topupData: ITopUpData, chainSpecificParams: any): Promise<ITransactionResult>;
9
- protected abstract getOne(getOneData: IGetOneData, chainSpecificParams: any): Promise<Stream>;
10
- protected abstract get(getAllData: IGetAllData, chainSpecificParams: any): Promise<[string, Stream][]>;
11
- protected abstract update(updateData: IUpdateData, chainSpecificParams: any): Promise<ITransactionResult>;
3
+ abstract create(streamData: ICreateStreamData, chainSpecificParams: any): Promise<ICreateResult>;
4
+ abstract createMultiple(multipleStreamData: ICreateMultipleStreamData, chainSpecificParams: any): Promise<IMultiTransactionResult>;
5
+ abstract withdraw(withdrawData: IWithdrawData, chainSpecificParams: any): Promise<ITransactionResult>;
6
+ abstract cancel(cancelData: ICancelData, chainSpecificParams: any): Promise<ITransactionResult>;
7
+ abstract transfer(transferData: ITransferData, chainSpecificParams: any): Promise<ITransactionResult>;
8
+ abstract topup(topupData: ITopUpData, chainSpecificParams: any): Promise<ITransactionResult>;
9
+ abstract getOne(getOneData: IGetOneData, chainSpecificParams: any): Promise<Stream>;
10
+ abstract get(getAllData: IGetAllData, chainSpecificParams: any): Promise<[string, Stream][]>;
11
+ abstract update(updateData: IUpdateData, chainSpecificParams: any): Promise<ITransactionResult>;
12
12
  extractErrorCode(err: Error): string | null;
13
13
  }
@@ -236,6 +236,7 @@ export interface Stream {
236
236
  fundsUnlockedAtLastRateChange: BN;
237
237
  type: StreamType;
238
238
  unlocked(currentTimestamp: number): BN;
239
+ remaining(decimals: number): number;
239
240
  }
240
241
  /**
241
242
  * Error wrapper for calls made to the contract on chain
@@ -2,9 +2,7 @@
2
2
  import { SignerWalletAdapter } from "@solana/wallet-adapter-base";
3
3
  import { Connection, Keypair, PublicKey } from "@solana/web3.js";
4
4
  import { DecodedStream, Account, BatchItem, BatchItemResult } from "./types";
5
- import { Stream } from "../common/types";
6
5
  export declare const decodeStream: (buf: Buffer) => DecodedStream;
7
- export declare const formatDecodedStream: (stream: DecodedStream) => Stream;
8
6
  /**
9
7
  * Wrapper function for Solana web3 getProgramAccounts with slightly better call interface
10
8
  * @param {Connection} connection - Solana web3 connection object.
@@ -50,13 +50,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
50
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
51
51
  };
52
52
  Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.extractSolanaErrorCode = exports.ata = exports.sendAndConfirmStreamRawTransaction = exports.signAllTransactionWithRecipients = exports.isSignerWallet = exports.getProgramAccounts = exports.formatDecodedStream = exports.decodeStream = void 0;
53
+ exports.extractSolanaErrorCode = exports.ata = exports.sendAndConfirmStreamRawTransaction = exports.signAllTransactionWithRecipients = exports.isSignerWallet = exports.getProgramAccounts = exports.decodeStream = void 0;
54
54
  var spl_token_1 = require("@solana/spl-token");
55
55
  var web3_js_1 = require("@solana/web3.js");
56
56
  var bn_js_1 = __importDefault(require("bn.js"));
57
57
  var bs58_1 = __importDefault(require("bs58"));
58
58
  var layout_1 = require("./layout");
59
- var contractUtils_1 = require("../common/contractUtils");
60
59
  var constants_1 = require("./constants");
61
60
  var decoder = new TextDecoder("utf-8");
62
61
  var LE = "le"; //little endian
@@ -108,64 +107,6 @@ var decodeStream = function (buf) {
108
107
  };
109
108
  };
110
109
  exports.decodeStream = decodeStream;
111
- // DeprecationWarning: This object will be deprecated starting from the version 4.0.0. Use
112
- // types/Contract instead
113
- var formatDecodedStream = function (stream) {
114
- var _a;
115
- var resp = {
116
- magic: stream.magic.toNumber(),
117
- version: stream.version.toNumber(),
118
- createdAt: stream.createdAt.toNumber(),
119
- withdrawnAmount: stream.withdrawnAmount,
120
- canceledAt: stream.canceledAt.toNumber(),
121
- end: stream.end.toNumber(),
122
- lastWithdrawnAt: stream.lastWithdrawnAt.toNumber(),
123
- sender: stream.sender.toBase58(),
124
- senderTokens: stream.senderTokens.toBase58(),
125
- recipient: stream.recipient.toBase58(),
126
- recipientTokens: stream.recipientTokens.toBase58(),
127
- mint: stream.mint.toBase58(),
128
- escrowTokens: stream.escrowTokens.toBase58(),
129
- streamflowTreasury: stream.streamflowTreasury.toBase58(),
130
- streamflowTreasuryTokens: stream.streamflowTreasuryTokens.toBase58(),
131
- streamflowFeeTotal: stream.streamflowFeeTotal,
132
- streamflowFeeWithdrawn: stream.streamflowFeeWithdrawn,
133
- streamflowFeePercent: stream.streamflowFeePercent.toNumber(),
134
- partnerFeeTotal: stream.partnerFeeTotal,
135
- partnerFeeWithdrawn: stream.partnerFeeWithdrawn,
136
- partnerFeePercent: stream.partnerFeePercent.toNumber(),
137
- partner: stream.partner.toBase58(),
138
- partnerTokens: (_a = stream.partnerTokens) === null || _a === void 0 ? void 0 : _a.toBase58(),
139
- start: stream.start.toNumber(),
140
- depositedAmount: stream.depositedAmount,
141
- period: stream.period.toNumber(),
142
- amountPerPeriod: stream.amountPerPeriod,
143
- cliff: stream.cliff.toNumber(),
144
- cliffAmount: stream.cliffAmount,
145
- cancelableBySender: stream.cancelableBySender,
146
- cancelableByRecipient: stream.cancelableByRecipient,
147
- automaticWithdrawal: stream.automaticWithdrawal,
148
- transferableBySender: stream.transferableBySender,
149
- transferableByRecipient: stream.transferableByRecipient,
150
- canTopup: stream.canTopup,
151
- name: stream.name,
152
- withdrawalFrequency: stream.withdrawFrequency.toNumber(),
153
- closed: stream.closed,
154
- currentPauseStart: stream.currentPauseStart.toNumber(),
155
- pauseCumulative: stream.pauseCumulative,
156
- lastRateChangeTime: stream.lastRateChangeTime.toNumber(),
157
- fundsUnlockedAtLastRateChange: stream.fundsUnlockedAtLastRateChange,
158
- type: (0, contractUtils_1.buildStreamType)(stream),
159
- unlocked: function () {
160
- return new bn_js_1.default(0);
161
- },
162
- withdrawn: function () {
163
- return new bn_js_1.default(0);
164
- }, //phantom method to preserve partial support of this object
165
- };
166
- return resp;
167
- };
168
- exports.formatDecodedStream = formatDecodedStream;
169
110
  /**
170
111
  * Wrapper function for Solana web3 getProgramAccounts with slightly better call interface
171
112
  * @param {Connection} connection - Solana web3 connection object.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "5.6.4",
3
+ "version": "5.6.5",
4
4
  "description": "JavaScript SDK to interact with Streamflow protocol.",
5
5
  "main": "dist/index.js",
6
6
  "homepage": "https://github.com/streamflow-finance/js-sdk/",
@@ -11,7 +11,7 @@
11
11
  "lint": "eslint .",
12
12
  "prepublishOnly": "npm run lint && npm test && npm run build"
13
13
  },
14
- "gitHead": "d0969533b82c8a08f9efd66dcf4ef4f65fd25725",
14
+ "gitHead": "c226049186636b6819b13ac894d33f5b7795e663",
15
15
  "devDependencies": {
16
16
  "@types/bn.js": "5.1.1",
17
17
  "@types/ethereum-checksum-address": "^0.0.0",