@streamflow/stream 7.5.3 → 8.0.0-alpha.p287.25d0c28
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/BaseStreamClient-CQOC8m8V.d.cts +542 -0
- package/dist/cjs/aptos/index.cjs +456 -0
- package/dist/cjs/aptos/index.cjs.map +1 -0
- package/dist/cjs/aptos/index.d.cts +14 -0
- package/dist/cjs/evm/index.cjs +1915 -0
- package/dist/cjs/evm/index.cjs.map +1 -0
- package/dist/cjs/evm/index.d.cts +13 -0
- package/dist/cjs/index-CYu6i--S.d.cts +136 -0
- package/dist/cjs/index-DUVcpIhD.d.cts +203 -0
- package/dist/cjs/index-b7Qo5mCj.d.cts +664 -0
- package/dist/cjs/index-fNLnPKzv.d.cts +213 -0
- package/dist/cjs/index.cjs +7189 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +192 -0
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.cjs +4 -0
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.cjs.map +1 -0
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.d.cts +1234 -0
- package/dist/cjs/solana/index.cjs +3749 -0
- package/dist/cjs/solana/index.cjs.map +1 -0
- package/dist/cjs/solana/index.d.cts +17 -0
- package/dist/cjs/sui/index.cjs +1021 -0
- package/dist/cjs/sui/index.cjs.map +1 -0
- package/dist/cjs/sui/index.d.cts +13 -0
- package/dist/esm/BaseStreamClient-CQOC8m8V.d.ts +542 -0
- package/dist/esm/aptos/index.d.ts +14 -4
- package/dist/esm/aptos/index.js +443 -4
- package/dist/esm/aptos/index.js.map +1 -0
- package/dist/esm/evm/index.d.ts +13 -5
- package/dist/esm/evm/index.js +1902 -5
- package/dist/esm/evm/index.js.map +1 -0
- package/dist/esm/index-BEo0O2IG.d.ts +664 -0
- package/dist/esm/index-CWmb3-x9.d.ts +136 -0
- package/dist/esm/index-Cgv37xlG.d.ts +213 -0
- package/dist/esm/index-D6QYg8hn.d.ts +203 -0
- package/dist/esm/index.d.ts +192 -10
- package/dist/esm/index.js +7096 -10
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/solana/descriptor/idl/streamflow_aligned_unlocks.json +917 -1368
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.d.ts +3 -1
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.js +3 -1
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.js.map +1 -0
- package/dist/esm/solana/index.d.ts +17 -7
- package/dist/esm/solana/index.js +3693 -7
- package/dist/esm/solana/index.js.map +1 -0
- package/dist/esm/sui/index.d.ts +13 -4
- package/dist/esm/sui/index.js +1011 -4
- package/dist/esm/sui/index.js.map +1 -0
- package/package.json +57 -27
- package/dist/cjs/__tests__/aptos/streamClient.spec.js +0 -111
- package/dist/cjs/__tests__/common/GenericStreamClient.spec.js +0 -45
- package/dist/cjs/aptos/StreamClient.js +0 -226
- package/dist/cjs/aptos/constants.js +0 -27
- package/dist/cjs/aptos/index.js +0 -38
- package/dist/cjs/aptos/types.js +0 -69
- package/dist/cjs/aptos/utils.js +0 -34
- package/dist/cjs/aptos/wallet.js +0 -34
- package/dist/cjs/common/BaseStreamClient.js +0 -23
- package/dist/cjs/common/GenericStreamClient.js +0 -102
- package/dist/cjs/common/constants.js +0 -10
- package/dist/cjs/common/contractUtils.js +0 -77
- package/dist/cjs/common/types.js +0 -141
- package/dist/cjs/common/utils.js +0 -69
- package/dist/cjs/evm/StreamClient.js +0 -238
- package/dist/cjs/evm/abi.js +0 -1257
- package/dist/cjs/evm/constants.js +0 -38
- package/dist/cjs/evm/ercAbi.js +0 -224
- package/dist/cjs/evm/index.js +0 -40
- package/dist/cjs/evm/types.js +0 -66
- package/dist/cjs/evm/utils.js +0 -11
- package/dist/cjs/index.js +0 -43
- package/dist/cjs/solana/StreamClient.js +0 -1042
- package/dist/cjs/solana/constants.js +0 -95
- package/dist/cjs/solana/descriptor/idl/streamflow_aligned_unlocks.json +0 -1437
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.js +0 -2
- package/dist/cjs/solana/index.js +0 -40
- package/dist/cjs/solana/instructionTypes.js +0 -2
- package/dist/cjs/solana/instructions.js +0 -298
- package/dist/cjs/solana/layout.js +0 -182
- package/dist/cjs/solana/lib/derive-accounts.js +0 -17
- package/dist/cjs/solana/lib/utils.js +0 -127
- package/dist/cjs/solana/timelockIDL.js +0 -422
- package/dist/cjs/solana/types.js +0 -93
- package/dist/cjs/sui/StreamClient.js +0 -416
- package/dist/cjs/sui/constants.js +0 -42
- package/dist/cjs/sui/index.js +0 -37
- package/dist/cjs/sui/types.js +0 -68
- package/dist/cjs/sui/utils.js +0 -46
- package/dist/cjs/sui/wallet.js +0 -40
- package/dist/esm/__tests__/aptos/streamClient.spec.d.ts +0 -1
- package/dist/esm/__tests__/aptos/streamClient.spec.js +0 -106
- package/dist/esm/__tests__/common/GenericStreamClient.spec.d.ts +0 -1
- package/dist/esm/__tests__/common/GenericStreamClient.spec.js +0 -40
- package/dist/esm/aptos/StreamClient.d.ts +0 -53
- package/dist/esm/aptos/StreamClient.js +0 -226
- package/dist/esm/aptos/constants.d.ts +0 -8
- package/dist/esm/aptos/constants.js +0 -24
- package/dist/esm/aptos/types.d.ts +0 -109
- package/dist/esm/aptos/types.js +0 -105
- package/dist/esm/aptos/utils.d.ts +0 -7
- package/dist/esm/aptos/utils.js +0 -30
- package/dist/esm/aptos/wallet.d.ts +0 -9
- package/dist/esm/aptos/wallet.js +0 -33
- package/dist/esm/common/BaseStreamClient.d.ts +0 -22
- package/dist/esm/common/BaseStreamClient.js +0 -19
- package/dist/esm/common/GenericStreamClient.d.ts +0 -72
- package/dist/esm/common/GenericStreamClient.js +0 -101
- package/dist/esm/common/constants.d.ts +0 -4
- package/dist/esm/common/constants.js +0 -4
- package/dist/esm/common/contractUtils.d.ts +0 -63
- package/dist/esm/common/contractUtils.js +0 -61
- package/dist/esm/common/types.d.ts +0 -353
- package/dist/esm/common/types.js +0 -135
- package/dist/esm/common/utils.d.ts +0 -32
- package/dist/esm/common/utils.js +0 -59
- package/dist/esm/evm/StreamClient.d.ts +0 -32
- package/dist/esm/evm/StreamClient.js +0 -237
- package/dist/esm/evm/abi.d.ts +0 -111
- package/dist/esm/evm/abi.js +0 -1255
- package/dist/esm/evm/constants.d.ts +0 -20
- package/dist/esm/evm/constants.js +0 -35
- package/dist/esm/evm/ercAbi.d.ts +0 -39
- package/dist/esm/evm/ercAbi.js +0 -222
- package/dist/esm/evm/types.d.ts +0 -98
- package/dist/esm/evm/types.js +0 -102
- package/dist/esm/evm/utils.d.ts +0 -1
- package/dist/esm/evm/utils.js +0 -8
- package/dist/esm/solana/StreamClient.d.ts +0 -150
- package/dist/esm/solana/StreamClient.js +0 -1017
- package/dist/esm/solana/constants.d.ts +0 -70
- package/dist/esm/solana/constants.js +0 -92
- package/dist/esm/solana/instructionTypes.d.ts +0 -101
- package/dist/esm/solana/instructionTypes.js +0 -1
- package/dist/esm/solana/instructions.d.ts +0 -142
- package/dist/esm/solana/instructions.js +0 -265
- package/dist/esm/solana/layout.d.ts +0 -27
- package/dist/esm/solana/layout.js +0 -155
- package/dist/esm/solana/lib/derive-accounts.d.ts +0 -4
- package/dist/esm/solana/lib/derive-accounts.js +0 -11
- package/dist/esm/solana/lib/utils.d.ts +0 -22
- package/dist/esm/solana/lib/utils.js +0 -117
- package/dist/esm/solana/timelockIDL.d.ts +0 -22
- package/dist/esm/solana/timelockIDL.js +0 -420
- package/dist/esm/solana/types.d.ts +0 -180
- package/dist/esm/solana/types.js +0 -142
- package/dist/esm/sui/StreamClient.d.ts +0 -82
- package/dist/esm/sui/StreamClient.js +0 -417
- package/dist/esm/sui/constants.d.ts +0 -10
- package/dist/esm/sui/constants.js +0 -39
- package/dist/esm/sui/types.d.ts +0 -167
- package/dist/esm/sui/types.js +0 -104
- package/dist/esm/sui/utils.d.ts +0 -11
- package/dist/esm/sui/utils.js +0 -39
- package/dist/esm/sui/wallet.d.ts +0 -17
- package/dist/esm/sui/wallet.js +0 -38
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ContractErrorCode, ICluster } from "../common/types.js";
|
|
2
|
-
// TODO: remove Devnet and Local addresses as they are not deployed, they are just a copy Testnet values
|
|
3
|
-
export const SUI_PROGRAM_IDS = {
|
|
4
|
-
[ICluster.Mainnet]: "0xe456a3a1d4e58e85b4b7175fabe6dae895b983f1379bb8948d6ec2f137b08a7b",
|
|
5
|
-
[ICluster.Devnet]: "0x34dacd839e1758ebb70bdcd4e08f18fbfef5e2b96d9aa7ce2b4a71d96ca0df5a",
|
|
6
|
-
[ICluster.Testnet]: "0x34dacd839e1758ebb70bdcd4e08f18fbfef5e2b96d9aa7ce2b4a71d96ca0df5a",
|
|
7
|
-
[ICluster.Local]: "0x34dacd839e1758ebb70bdcd4e08f18fbfef5e2b96d9aa7ce2b4a71d96ca0df5a",
|
|
8
|
-
};
|
|
9
|
-
export const SUI_CONFIG_IDS = {
|
|
10
|
-
[ICluster.Mainnet]: "0x6cf6760b64245b8d23ef57c28ddceb6adbd540a23a509fef29b82237da4ab87b",
|
|
11
|
-
[ICluster.Devnet]: "0xd6c9f5074584f58074ce56e3c5cc436d82258ec3285f186a0d6438a60bacdbf8",
|
|
12
|
-
[ICluster.Testnet]: "0xd6c9f5074584f58074ce56e3c5cc436d82258ec3285f186a0d6438a60bacdbf8",
|
|
13
|
-
[ICluster.Local]: "0xd6c9f5074584f58074ce56e3c5cc436d82258ec3285f186a0d6438a60bacdbf8",
|
|
14
|
-
};
|
|
15
|
-
export const SUI_FEE_TABLE_IDS = {
|
|
16
|
-
[ICluster.Mainnet]: "0xad9b75399632583fb9fcae6b5bcca34e6542ab3bedb630ecbd3f15cb1cc48dbe",
|
|
17
|
-
[ICluster.Devnet]: "0x6057b093904c5bdfec1067d2b8a4dc35f65bcab03b3029ad716c4882b0f36078",
|
|
18
|
-
[ICluster.Testnet]: "0x6057b093904c5bdfec1067d2b8a4dc35f65bcab03b3029ad716c4882b0f36078",
|
|
19
|
-
[ICluster.Local]: "0x6057b093904c5bdfec1067d2b8a4dc35f65bcab03b3029ad716c4882b0f36078",
|
|
20
|
-
};
|
|
21
|
-
export const SUI_ERROR_MATCH_REGEX = /MoveAbort\(MoveLocation \{ module: ModuleId \{ address: (\w+), name: Identifier\("([\w_]+)"\) }, function: \d+, instruction: \d+, function_name: Some\("([\w_]+)"\) }, (\d+)\) in command (\d+)/;
|
|
22
|
-
export const SUI_MODULE_ERROR_MAP = {
|
|
23
|
-
protocol: {
|
|
24
|
-
1: ContractErrorCode.ECONTRACT_NOT_INIT,
|
|
25
|
-
2: ContractErrorCode.EBAD_AMOUNT,
|
|
26
|
-
3: ContractErrorCode.ENO_PERMISSIONS,
|
|
27
|
-
4: ContractErrorCode.EBADINPUT,
|
|
28
|
-
5: ContractErrorCode.ECLOSED,
|
|
29
|
-
6: ContractErrorCode.EBAD_INPUT_AMOUNT_PER_PERIOD,
|
|
30
|
-
8: ContractErrorCode.EBAD_INPUT_UPDATE_RATE,
|
|
31
|
-
9: ContractErrorCode.EBAD_INPUT_CLIFF_AMOUNT,
|
|
32
|
-
10: ContractErrorCode.EBAD_INPUT_PERIOD,
|
|
33
|
-
11: ContractErrorCode.EBAD_INPUT_START,
|
|
34
|
-
13: ContractErrorCode.EBAD_INSUFFICIENT_WITHDRAWAL_FEES,
|
|
35
|
-
14: ContractErrorCode.EBAD_INSUFFICIENT_AMOUNT,
|
|
36
|
-
15: ContractErrorCode.EPAUSED,
|
|
37
|
-
16: ContractErrorCode.ENOTPAUSED,
|
|
38
|
-
},
|
|
39
|
-
};
|
package/dist/esm/sui/types.d.ts
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { Keypair } from "@mysten/sui/cryptography";
|
|
2
|
-
import { WalletContextState } from "@suiet/wallet-kit";
|
|
3
|
-
import { Transaction } from "@mysten/sui/transactions";
|
|
4
|
-
import { ExecuteTransactionRequestType, SuiTransactionBlockResponseOptions } from "@mysten/sui/client";
|
|
5
|
-
import BN from "bn.js";
|
|
6
|
-
import { LinearStream, StreamType } from "../common/types.js";
|
|
7
|
-
export interface ICreateStreamSuiExt {
|
|
8
|
-
senderWallet: WalletContextState | Keypair;
|
|
9
|
-
}
|
|
10
|
-
export interface ITransactionSuiExt {
|
|
11
|
-
senderWallet: WalletContextState | Keypair;
|
|
12
|
-
tokenId: string;
|
|
13
|
-
}
|
|
14
|
-
export interface ISuiIdParameters {
|
|
15
|
-
program: string;
|
|
16
|
-
config: string;
|
|
17
|
-
feeTable: string;
|
|
18
|
-
}
|
|
19
|
-
export interface IContractCreated {
|
|
20
|
-
address: string;
|
|
21
|
-
}
|
|
22
|
-
export interface IContractWithdrawn {
|
|
23
|
-
address: string;
|
|
24
|
-
amount: number;
|
|
25
|
-
streamflow_amount: number;
|
|
26
|
-
partner_amount: number;
|
|
27
|
-
}
|
|
28
|
-
export interface StreamResource {
|
|
29
|
-
id: {
|
|
30
|
-
id: string;
|
|
31
|
-
};
|
|
32
|
-
amount: string;
|
|
33
|
-
amount_per_period: string;
|
|
34
|
-
balance: string;
|
|
35
|
-
canceled_at: string;
|
|
36
|
-
cliff_amount: string;
|
|
37
|
-
closed: boolean;
|
|
38
|
-
created: string;
|
|
39
|
-
current_pause_start: string;
|
|
40
|
-
end: string;
|
|
41
|
-
fees: {
|
|
42
|
-
fields: {
|
|
43
|
-
partner_fee: string;
|
|
44
|
-
partner_fee_percentage: string;
|
|
45
|
-
partner_fee_withdrawn: string;
|
|
46
|
-
streamflow_fee: string;
|
|
47
|
-
streamflow_fee_percentage: string;
|
|
48
|
-
streamflow_fee_withdrawn: string;
|
|
49
|
-
};
|
|
50
|
-
type: string;
|
|
51
|
-
};
|
|
52
|
-
funds_unlocked_at_last_rate_change: string;
|
|
53
|
-
last_rate_change_time: string;
|
|
54
|
-
last_withdrawn_at: string;
|
|
55
|
-
meta: {
|
|
56
|
-
fields: {
|
|
57
|
-
automatic_withdrawal: boolean;
|
|
58
|
-
can_topup: boolean;
|
|
59
|
-
can_update_rate: boolean;
|
|
60
|
-
cancelable_by_recipient: boolean;
|
|
61
|
-
cancelable_by_sender: boolean;
|
|
62
|
-
contract_name: number[];
|
|
63
|
-
pausable: boolean;
|
|
64
|
-
transferable_by_recipient: boolean;
|
|
65
|
-
transferable_by_sender: boolean;
|
|
66
|
-
withdrawal_frequency: string;
|
|
67
|
-
};
|
|
68
|
-
type: string;
|
|
69
|
-
};
|
|
70
|
-
partner: string;
|
|
71
|
-
pause_cumulative: string;
|
|
72
|
-
period: string;
|
|
73
|
-
recipient: string;
|
|
74
|
-
sender: string;
|
|
75
|
-
start: string;
|
|
76
|
-
version: string;
|
|
77
|
-
withdrawn: string;
|
|
78
|
-
}
|
|
79
|
-
export interface ClassResource {
|
|
80
|
-
streamflow_fee: string;
|
|
81
|
-
treasury: string;
|
|
82
|
-
tx_fee: string;
|
|
83
|
-
withdrawor: string;
|
|
84
|
-
}
|
|
85
|
-
export interface FeeTableResource {
|
|
86
|
-
values: {
|
|
87
|
-
type: string;
|
|
88
|
-
fields: {
|
|
89
|
-
id: {
|
|
90
|
-
id: string;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
export interface FeeValueResource {
|
|
96
|
-
name: string;
|
|
97
|
-
value: {
|
|
98
|
-
type: string;
|
|
99
|
-
fields: {
|
|
100
|
-
partner_fee: string;
|
|
101
|
-
streamflow_fee: string;
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
export declare class Contract implements LinearStream {
|
|
106
|
-
magic: number;
|
|
107
|
-
version: number;
|
|
108
|
-
createdAt: number;
|
|
109
|
-
withdrawnAmount: BN;
|
|
110
|
-
canceledAt: number;
|
|
111
|
-
end: number;
|
|
112
|
-
lastWithdrawnAt: number;
|
|
113
|
-
sender: string;
|
|
114
|
-
senderTokens: string;
|
|
115
|
-
recipient: string;
|
|
116
|
-
recipientTokens: string;
|
|
117
|
-
mint: string;
|
|
118
|
-
escrowTokens: string;
|
|
119
|
-
streamflowTreasury: string;
|
|
120
|
-
streamflowTreasuryTokens: string;
|
|
121
|
-
streamflowFeeTotal: BN;
|
|
122
|
-
streamflowFeeWithdrawn: BN;
|
|
123
|
-
streamflowFeePercent: number;
|
|
124
|
-
partnerFeeTotal: BN;
|
|
125
|
-
partnerFeeWithdrawn: BN;
|
|
126
|
-
partnerFeePercent: number;
|
|
127
|
-
partner: string;
|
|
128
|
-
partnerTokens: string;
|
|
129
|
-
start: number;
|
|
130
|
-
depositedAmount: BN;
|
|
131
|
-
period: number;
|
|
132
|
-
amountPerPeriod: BN;
|
|
133
|
-
cliff: number;
|
|
134
|
-
cliffAmount: BN;
|
|
135
|
-
cancelableBySender: boolean;
|
|
136
|
-
cancelableByRecipient: boolean;
|
|
137
|
-
automaticWithdrawal: boolean;
|
|
138
|
-
transferableBySender: boolean;
|
|
139
|
-
transferableByRecipient: boolean;
|
|
140
|
-
canTopup: boolean;
|
|
141
|
-
name: string;
|
|
142
|
-
withdrawalFrequency: number;
|
|
143
|
-
closed: boolean;
|
|
144
|
-
currentPauseStart: number;
|
|
145
|
-
pauseCumulative: BN;
|
|
146
|
-
lastRateChangeTime: number;
|
|
147
|
-
fundsUnlockedAtLastRateChange: BN;
|
|
148
|
-
type: StreamType;
|
|
149
|
-
constructor(stream: StreamResource, tokenId: string);
|
|
150
|
-
unlocked(currentTimestamp: number): BN;
|
|
151
|
-
remaining(decimals: number): number;
|
|
152
|
-
}
|
|
153
|
-
export interface SuiParsedError {
|
|
154
|
-
module: "protocol" | "admin" | "fee_manager";
|
|
155
|
-
code: number;
|
|
156
|
-
name: string;
|
|
157
|
-
}
|
|
158
|
-
export interface SuiErrorInfo {
|
|
159
|
-
index?: number;
|
|
160
|
-
text: string;
|
|
161
|
-
parsed?: SuiParsedError;
|
|
162
|
-
}
|
|
163
|
-
export interface SuiSignAndExecuteTransactionBlockInput {
|
|
164
|
-
transaction: Transaction;
|
|
165
|
-
requestType?: ExecuteTransactionRequestType;
|
|
166
|
-
options?: SuiTransactionBlockResponseOptions;
|
|
167
|
-
}
|
package/dist/esm/sui/types.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import BN from "bn.js";
|
|
2
|
-
import { buildStreamType, calculateUnlockedAmount } from "../common/contractUtils.js";
|
|
3
|
-
import { getNumberFromBN } from "../common/utils.js";
|
|
4
|
-
export class Contract {
|
|
5
|
-
magic;
|
|
6
|
-
version;
|
|
7
|
-
createdAt;
|
|
8
|
-
withdrawnAmount;
|
|
9
|
-
canceledAt;
|
|
10
|
-
end;
|
|
11
|
-
lastWithdrawnAt;
|
|
12
|
-
sender;
|
|
13
|
-
senderTokens;
|
|
14
|
-
recipient;
|
|
15
|
-
recipientTokens;
|
|
16
|
-
mint;
|
|
17
|
-
escrowTokens;
|
|
18
|
-
streamflowTreasury;
|
|
19
|
-
streamflowTreasuryTokens;
|
|
20
|
-
streamflowFeeTotal;
|
|
21
|
-
streamflowFeeWithdrawn;
|
|
22
|
-
streamflowFeePercent;
|
|
23
|
-
partnerFeeTotal;
|
|
24
|
-
partnerFeeWithdrawn;
|
|
25
|
-
partnerFeePercent;
|
|
26
|
-
partner;
|
|
27
|
-
partnerTokens;
|
|
28
|
-
start;
|
|
29
|
-
depositedAmount;
|
|
30
|
-
period;
|
|
31
|
-
amountPerPeriod;
|
|
32
|
-
cliff;
|
|
33
|
-
cliffAmount;
|
|
34
|
-
cancelableBySender;
|
|
35
|
-
cancelableByRecipient;
|
|
36
|
-
automaticWithdrawal;
|
|
37
|
-
transferableBySender;
|
|
38
|
-
transferableByRecipient;
|
|
39
|
-
canTopup;
|
|
40
|
-
name;
|
|
41
|
-
withdrawalFrequency;
|
|
42
|
-
closed;
|
|
43
|
-
currentPauseStart;
|
|
44
|
-
pauseCumulative;
|
|
45
|
-
lastRateChangeTime;
|
|
46
|
-
fundsUnlockedAtLastRateChange;
|
|
47
|
-
type;
|
|
48
|
-
constructor(stream, tokenId) {
|
|
49
|
-
const meta = stream.meta.fields;
|
|
50
|
-
const fees = stream.fees.fields;
|
|
51
|
-
this.magic = 0;
|
|
52
|
-
this.version = parseInt(stream.version);
|
|
53
|
-
this.createdAt = parseInt(stream.created);
|
|
54
|
-
this.withdrawnAmount = new BN(stream.withdrawn);
|
|
55
|
-
this.canceledAt = parseInt(stream.canceled_at);
|
|
56
|
-
this.end = parseInt(stream.end);
|
|
57
|
-
this.lastWithdrawnAt = parseInt(stream.last_withdrawn_at);
|
|
58
|
-
this.sender = stream.sender;
|
|
59
|
-
this.senderTokens = stream.sender;
|
|
60
|
-
this.recipient = stream.recipient;
|
|
61
|
-
this.recipientTokens = stream.recipient;
|
|
62
|
-
this.mint = tokenId;
|
|
63
|
-
this.escrowTokens = "";
|
|
64
|
-
this.streamflowTreasury = "";
|
|
65
|
-
this.streamflowTreasuryTokens = "";
|
|
66
|
-
this.streamflowFeeTotal = new BN(0);
|
|
67
|
-
this.streamflowFeeWithdrawn = new BN(0);
|
|
68
|
-
this.streamflowFeePercent = parseInt(fees.streamflow_fee_percentage) / 10000;
|
|
69
|
-
this.partnerFeeTotal = new BN(0);
|
|
70
|
-
this.partnerFeeWithdrawn = new BN(0);
|
|
71
|
-
this.partnerFeePercent = parseInt(fees.partner_fee_percentage) / 10000;
|
|
72
|
-
this.partner = stream.partner;
|
|
73
|
-
this.partnerTokens = "";
|
|
74
|
-
this.start = parseInt(stream.start);
|
|
75
|
-
this.depositedAmount = new BN(stream.amount);
|
|
76
|
-
this.period = parseInt(stream.period);
|
|
77
|
-
this.amountPerPeriod = new BN(stream.amount_per_period);
|
|
78
|
-
this.cliff = parseInt(stream.start);
|
|
79
|
-
this.cliffAmount = new BN(stream.cliff_amount);
|
|
80
|
-
this.cancelableBySender = meta.cancelable_by_sender;
|
|
81
|
-
this.cancelableByRecipient = meta.cancelable_by_recipient;
|
|
82
|
-
this.automaticWithdrawal = meta.automatic_withdrawal;
|
|
83
|
-
this.transferableBySender = meta.transferable_by_sender;
|
|
84
|
-
this.transferableByRecipient = meta.transferable_by_recipient;
|
|
85
|
-
this.canTopup = meta.can_topup;
|
|
86
|
-
this.name = String.fromCharCode(...meta.contract_name);
|
|
87
|
-
this.withdrawalFrequency = parseInt(meta.withdrawal_frequency);
|
|
88
|
-
this.closed = stream.closed;
|
|
89
|
-
this.currentPauseStart = parseInt(stream.current_pause_start);
|
|
90
|
-
this.pauseCumulative = new BN(stream.pause_cumulative);
|
|
91
|
-
this.lastRateChangeTime = parseInt(stream.last_rate_change_time);
|
|
92
|
-
this.fundsUnlockedAtLastRateChange = new BN(stream.funds_unlocked_at_last_rate_change);
|
|
93
|
-
this.type = buildStreamType(this);
|
|
94
|
-
}
|
|
95
|
-
unlocked(currentTimestamp) {
|
|
96
|
-
return calculateUnlockedAmount({
|
|
97
|
-
...this,
|
|
98
|
-
currentTimestamp,
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
remaining(decimals) {
|
|
102
|
-
return getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
103
|
-
}
|
|
104
|
-
}
|
package/dist/esm/sui/utils.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { GetTransactionBlockParams, SuiClient, SuiTransactionBlockResponse } from "@mysten/sui/client";
|
|
2
|
-
import { SuiErrorInfo } from "./types.js";
|
|
3
|
-
export declare function extractSuiErrorInfo(errorText: string): SuiErrorInfo;
|
|
4
|
-
/**
|
|
5
|
-
* Fetches transaction block with a retry:
|
|
6
|
-
* retries `Could not find the referenced transaction` error as it could be that some validators still don't have the tx;
|
|
7
|
-
*
|
|
8
|
-
* @param client sui client to use
|
|
9
|
-
* @param input transaction fetch payload,
|
|
10
|
-
*/
|
|
11
|
-
export declare function getTransactionBlock(client: SuiClient, input: GetTransactionBlockParams): Promise<SuiTransactionBlockResponse>;
|
package/dist/esm/sui/utils.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import pRetry from "p-retry";
|
|
2
|
-
import { SUI_ERROR_MATCH_REGEX, SUI_MODULE_ERROR_MAP } from "./constants.js";
|
|
3
|
-
export function extractSuiErrorInfo(errorText) {
|
|
4
|
-
const error = { text: errorText };
|
|
5
|
-
const match = SUI_ERROR_MATCH_REGEX.exec(errorText);
|
|
6
|
-
if (!match) {
|
|
7
|
-
return error;
|
|
8
|
-
}
|
|
9
|
-
const moduleName = match[2];
|
|
10
|
-
const errorCode = Number(match[4]);
|
|
11
|
-
const errorName = SUI_MODULE_ERROR_MAP[moduleName] ? SUI_MODULE_ERROR_MAP[moduleName][errorCode] : undefined;
|
|
12
|
-
const index = Number(match[5]);
|
|
13
|
-
if (index) {
|
|
14
|
-
error.index = index;
|
|
15
|
-
}
|
|
16
|
-
if (errorName) {
|
|
17
|
-
error.parsed = {
|
|
18
|
-
module: moduleName,
|
|
19
|
-
code: errorCode,
|
|
20
|
-
name: errorName,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
return error;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Fetches transaction block with a retry:
|
|
27
|
-
* retries `Could not find the referenced transaction` error as it could be that some validators still don't have the tx;
|
|
28
|
-
*
|
|
29
|
-
* @param client sui client to use
|
|
30
|
-
* @param input transaction fetch payload,
|
|
31
|
-
*/
|
|
32
|
-
export function getTransactionBlock(client, input) {
|
|
33
|
-
return pRetry(() => client.getTransactionBlock(input), {
|
|
34
|
-
retries: 5,
|
|
35
|
-
shouldRetry: (error) => error.message.includes("Could not find the referenced transaction"),
|
|
36
|
-
minTimeout: 500,
|
|
37
|
-
maxTimeout: 1000,
|
|
38
|
-
});
|
|
39
|
-
}
|
package/dist/esm/sui/wallet.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Keypair } from "@mysten/sui/cryptography";
|
|
2
|
-
import { WalletContextState } from "@suiet/wallet-kit";
|
|
3
|
-
import { SuiClient, SuiTransactionBlockResponse } from "@mysten/sui/client";
|
|
4
|
-
import { SuiSignAndExecuteTransactionBlockInput } from "./types.js";
|
|
5
|
-
/**
|
|
6
|
-
* Utility function to check if the transaction initiator is a Wallet object
|
|
7
|
-
* @param {Keypair | WalletContextState} 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;
|
|
11
|
-
export declare class SuiWalletWrapper<T extends WalletContextState | Keypair> {
|
|
12
|
-
wallet: T;
|
|
13
|
-
address: string;
|
|
14
|
-
client: SuiClient;
|
|
15
|
-
constructor(wallet: T, client: SuiClient);
|
|
16
|
-
signAndExecuteTransaction(input: SuiSignAndExecuteTransactionBlockInput): Promise<SuiTransactionBlockResponse>;
|
|
17
|
-
}
|
package/dist/esm/sui/wallet.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Keypair } from "@mysten/sui/cryptography";
|
|
2
|
-
/**
|
|
3
|
-
* Utility function to check if the transaction initiator is a Wallet object
|
|
4
|
-
* @param {Keypair | WalletContextState} walletOrKeypair - Wallet or Keypair in question
|
|
5
|
-
* @return {boolean} - Returns true if parameter is a Wallet.
|
|
6
|
-
*/
|
|
7
|
-
export function isSignerKeypair(walletOrKeypair) {
|
|
8
|
-
return (walletOrKeypair instanceof Keypair ||
|
|
9
|
-
walletOrKeypair.constructor === Keypair ||
|
|
10
|
-
walletOrKeypair.constructor.name === Keypair.prototype.constructor.name ||
|
|
11
|
-
"getSecretKey" in walletOrKeypair);
|
|
12
|
-
}
|
|
13
|
-
export class SuiWalletWrapper {
|
|
14
|
-
wallet;
|
|
15
|
-
address;
|
|
16
|
-
client;
|
|
17
|
-
constructor(wallet, client) {
|
|
18
|
-
this.client = client;
|
|
19
|
-
this.wallet = wallet;
|
|
20
|
-
if (isSignerKeypair(wallet)) {
|
|
21
|
-
this.address = wallet.toSuiAddress();
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
this.address = wallet.address;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
async signAndExecuteTransaction(input) {
|
|
28
|
-
if (isSignerKeypair(this.wallet)) {
|
|
29
|
-
return this.client.signAndExecuteTransaction({
|
|
30
|
-
...input,
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
signer: this.wallet,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
return this.wallet.signAndExecuteTransaction(input);
|
|
37
|
-
}
|
|
38
|
-
}
|