@ton/ton 16.0.0 → 16.2.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.
- package/README.md +47 -11
- package/dist/client/TonClient.d.ts +6 -6
- package/dist/client/TonClient.js +105 -80
- package/dist/client/TonClient4.d.ts +1 -1
- package/dist/client/TonClient4.js +227 -138
- package/dist/client/api/HttpApi.d.ts +122 -122
- package/dist/client/api/HttpApi.js +103 -72
- package/dist/client/api/TonCache.js +3 -3
- package/dist/config/ConfigParser.d.ts +221 -409
- package/dist/config/ConfigParser.js +407 -89
- package/dist/elector/ElectorContract.js +46 -20
- package/dist/index.d.ts +22 -22
- package/dist/index.js +2 -1
- package/dist/jetton/JettonMaster.js +5 -3
- package/dist/jetton/JettonWallet.js +2 -2
- package/dist/multisig/MultisigOrder.d.ts +2 -2
- package/dist/multisig/MultisigOrder.js +1 -1
- package/dist/multisig/MultisigOrderBuilder.d.ts +2 -2
- package/dist/multisig/MultisigOrderBuilder.js +1 -1
- package/dist/multisig/MultisigWallet.d.ts +3 -3
- package/dist/multisig/MultisigWallet.js +8 -8
- package/dist/utils/createTestClient.d.ts +1 -1
- package/dist/utils/createTestClient.js +6 -2
- package/dist/utils/createTestClient4.d.ts +1 -1
- package/dist/utils/createTestClient4.js +5 -1
- package/dist/utils/fees.d.ts +2 -2
- package/dist/utils/fees.js +21 -6
- package/dist/utils/{randomTestKey.d.ts → testUtils.d.ts} +2 -0
- package/dist/utils/testUtils.js +21 -0
- package/dist/utils/testWallets.d.ts +10 -10
- package/dist/utils/time.js +5 -3
- package/dist/utils/toUrlSafe.js +6 -6
- package/dist/wallets/WalletContractV1R1.d.ts +1 -57
- package/dist/wallets/WalletContractV1R1.js +15 -99
- package/dist/wallets/WalletContractV1R2.d.ts +1 -57
- package/dist/wallets/WalletContractV1R2.js +15 -100
- package/dist/wallets/WalletContractV1R3.d.ts +1 -57
- package/dist/wallets/WalletContractV1R3.js +15 -99
- package/dist/wallets/WalletContractV2R1.d.ts +1 -59
- package/dist/wallets/WalletContractV2R1.js +15 -101
- package/dist/wallets/WalletContractV2R2.d.ts +1 -59
- package/dist/wallets/WalletContractV2R2.js +15 -101
- package/dist/wallets/WalletContractV3R1.d.ts +1 -56
- package/dist/wallets/WalletContractV3R1.js +15 -103
- package/dist/wallets/WalletContractV3R2.d.ts +1 -56
- package/dist/wallets/WalletContractV3R2.js +15 -103
- package/dist/wallets/WalletContractV4.d.ts +2 -2
- package/dist/wallets/WalletContractV5Beta.d.ts +3 -3
- package/dist/wallets/WalletContractV5R1.d.ts +3 -3
- package/dist/wallets/signing/createWalletTransfer.d.ts +11 -3
- package/dist/wallets/signing/createWalletTransfer.js +18 -15
- package/dist/wallets/signing/singer.d.ts +2 -1
- package/dist/wallets/signing/singer.js +11 -5
- package/dist/wallets/v1/r1.d.ts +59 -0
- package/dist/wallets/v1/r1.js +103 -0
- package/dist/wallets/v1/r2.d.ts +59 -0
- package/dist/wallets/v1/r2.js +104 -0
- package/dist/wallets/v1/r3.d.ts +59 -0
- package/dist/wallets/v1/r3.js +103 -0
- package/dist/wallets/v2/r1.d.ts +61 -0
- package/dist/wallets/v2/r1.js +107 -0
- package/dist/wallets/v2/r2.d.ts +61 -0
- package/dist/wallets/v2/r2.js +107 -0
- package/dist/wallets/v3/r1.d.ts +58 -0
- package/dist/wallets/v3/r1.js +109 -0
- package/dist/wallets/v3/r2.d.ts +58 -0
- package/dist/wallets/v3/r2.js +109 -0
- package/dist/wallets/v4/WalletContractV4.d.ts +4 -2
- package/dist/wallets/v4/WalletContractV4.js +36 -32
- package/dist/wallets/v4/WalletContractV4Actions.d.ts +4 -4
- package/dist/wallets/v4/WalletContractV4Actions.js +10 -10
- package/dist/wallets/v5beta/WalletContractV5Beta.d.ts +7 -5
- package/dist/wallets/v5beta/WalletContractV5Beta.js +44 -28
- package/dist/wallets/v5beta/WalletV5BetaActions.d.ts +1 -1
- package/dist/wallets/v5beta/WalletV5BetaActions.js +25 -18
- package/dist/wallets/v5beta/WalletV5BetaWalletId.d.ts +2 -2
- package/dist/wallets/v5beta/WalletV5BetaWalletId.js +6 -4
- package/dist/wallets/v5beta/WalletV5OutActions.d.ts +4 -4
- package/dist/wallets/v5beta/WalletV5OutActions.js +3 -1
- package/dist/wallets/v5r1/WalletContractV5R1.d.ts +10 -6
- package/dist/wallets/v5r1/WalletContractV5R1.js +55 -36
- package/dist/wallets/v5r1/WalletV5R1Actions.d.ts +3 -3
- package/dist/wallets/v5r1/WalletV5R1Actions.js +32 -25
- package/dist/wallets/v5r1/WalletV5R1WalletId.d.ts +2 -2
- package/dist/wallets/v5r1/WalletV5R1WalletId.js +16 -10
- package/package.json +62 -65
- package/dist/client/TonClient.spec.d.ts +0 -1
- package/dist/client/TonClient.spec.js +0 -59
- package/dist/client/TonClient4.spec.d.ts +0 -1
- package/dist/client/TonClient4.spec.js +0 -67
- package/dist/config/ConfigParser.spec.d.ts +0 -8
- package/dist/config/ConfigParser.spec.js +0 -137
- package/dist/elector/ElectorContract.spec.d.ts +0 -8
- package/dist/elector/ElectorContract.spec.js +0 -104
- package/dist/jetton/JettonMaster.spec.d.ts +0 -8
- package/dist/jetton/JettonMaster.spec.js +0 -27
- package/dist/multisig/MultisigOrder.spec.d.ts +0 -1
- package/dist/multisig/MultisigOrder.spec.js +0 -139
- package/dist/multisig/MultisigWallet.spec.d.ts +0 -1
- package/dist/multisig/MultisigWallet.spec.js +0 -248
- package/dist/utils/fees.spec.d.ts +0 -1
- package/dist/utils/fees.spec.js +0 -83
- package/dist/utils/randomTestKey.js +0 -23
- package/dist/wallets/WalletContractV1R1.spec.d.ts +0 -8
- package/dist/wallets/WalletContractV1R1.spec.js +0 -67
- package/dist/wallets/WalletContractV1R2.spec.d.ts +0 -8
- package/dist/wallets/WalletContractV1R2.spec.js +0 -67
- package/dist/wallets/WalletContractV1R3.spec.d.ts +0 -8
- package/dist/wallets/WalletContractV1R3.spec.js +0 -44
- package/dist/wallets/WalletContractV2R1.spec.d.ts +0 -8
- package/dist/wallets/WalletContractV2R1.spec.js +0 -67
- package/dist/wallets/WalletContractV2R2.spec.d.ts +0 -8
- package/dist/wallets/WalletContractV2R2.spec.js +0 -67
- package/dist/wallets/WalletContractV3R1.spec.d.ts +0 -8
- package/dist/wallets/WalletContractV3R1.spec.js +0 -67
- package/dist/wallets/WalletContractV3R2.spec.d.ts +0 -8
- package/dist/wallets/WalletContractV3R2.spec.js +0 -67
- package/dist/wallets/v4/WalletContractV4.spec.d.ts +0 -8
- package/dist/wallets/v4/WalletContractV4.spec.js +0 -157
- package/dist/wallets/v4/WalletContractV4Actions.spec.d.ts +0 -1
- package/dist/wallets/v4/WalletContractV4Actions.spec.js +0 -74
- package/dist/wallets/v5beta/WalletContractV5Beta.spec.d.ts +0 -8
- package/dist/wallets/v5beta/WalletContractV5Beta.spec.js +0 -317
- package/dist/wallets/v5beta/WalletV5BetaActions.spec.d.ts +0 -1
- package/dist/wallets/v5beta/WalletV5BetaActions.spec.js +0 -166
- package/dist/wallets/v5beta/WalletV5BetaWalletId.spec.d.ts +0 -1
- package/dist/wallets/v5beta/WalletV5BetaWalletId.spec.js +0 -68
- package/dist/wallets/v5r1/WalletContractV5R1.spec.d.ts +0 -8
- package/dist/wallets/v5r1/WalletContractV5R1.spec.js +0 -340
- package/dist/wallets/v5r1/WalletV5R1Actions.spec.d.ts +0 -1
- package/dist/wallets/v5r1/WalletV5R1Actions.spec.js +0 -262
- package/dist/wallets/v5r1/WalletV5R1WalletId.spec.d.ts +0 -1
- package/dist/wallets/v5r1/WalletV5R1WalletId.spec.js +0 -103
|
@@ -11,7 +11,7 @@ const FrozenDictValue = {
|
|
|
11
11
|
const weight = src.loadUintBig(64);
|
|
12
12
|
const stake = src.loadCoins();
|
|
13
13
|
return { address, weight, stake };
|
|
14
|
-
}
|
|
14
|
+
},
|
|
15
15
|
};
|
|
16
16
|
const EntitiesDictValue = {
|
|
17
17
|
serialize(src, builder) {
|
|
@@ -24,7 +24,7 @@ const EntitiesDictValue = {
|
|
|
24
24
|
const address = new core_1.Address(-1, src.loadBuffer(32));
|
|
25
25
|
const adnl = src.loadBuffer(32);
|
|
26
26
|
return { stake, address, adnl };
|
|
27
|
-
}
|
|
27
|
+
},
|
|
28
28
|
};
|
|
29
29
|
class ElectorContract {
|
|
30
30
|
//readonly source: ContractSource = new UnknownContractSource('org.ton.elector', -1, 'Elector Contract');
|
|
@@ -33,17 +33,19 @@ class ElectorContract {
|
|
|
33
33
|
}
|
|
34
34
|
constructor() {
|
|
35
35
|
// Please note that we are NOT loading address from config to avoid mistake and send validator money to a wrong contract
|
|
36
|
-
this.address = core_1.Address.parseRaw(
|
|
36
|
+
this.address = core_1.Address.parseRaw("-1:3333333333333333333333333333333333333333333333333333333333333333");
|
|
37
37
|
}
|
|
38
38
|
async getReturnedStake(provider, address) {
|
|
39
39
|
if (address.workChain !== -1) {
|
|
40
|
-
throw Error(
|
|
40
|
+
throw Error("Only masterchain addresses could have stake");
|
|
41
41
|
}
|
|
42
|
-
const res = await provider.get(
|
|
42
|
+
const res = await provider.get("compute_returned_stake", [
|
|
43
|
+
{ type: "int", value: BigInt("0x" + address.hash.toString("hex")) },
|
|
44
|
+
]);
|
|
43
45
|
return res.stack.readBigNumber();
|
|
44
46
|
}
|
|
45
47
|
async getPastElectionsList(provider) {
|
|
46
|
-
const res = await provider.get(
|
|
48
|
+
const res = await provider.get("past_elections_list", []);
|
|
47
49
|
const electionsListRaw = new core_1.TupleReader(res.stack.readLispList());
|
|
48
50
|
const elections = [];
|
|
49
51
|
while (electionsListRaw.remaining > 0) {
|
|
@@ -57,7 +59,7 @@ class ElectorContract {
|
|
|
57
59
|
return elections;
|
|
58
60
|
}
|
|
59
61
|
async getPastElections(provider) {
|
|
60
|
-
const res = await provider.get(
|
|
62
|
+
const res = await provider.get("past_elections", []);
|
|
61
63
|
const electionsRaw = new core_1.TupleReader(res.stack.readLispList());
|
|
62
64
|
const elections = [];
|
|
63
65
|
while (electionsRaw.remaining > 0) {
|
|
@@ -70,11 +72,24 @@ class ElectorContract {
|
|
|
70
72
|
const totalStake = electionsEntry.readBigNumber();
|
|
71
73
|
const bonuses = electionsEntry.readBigNumber();
|
|
72
74
|
let frozen = new Map();
|
|
73
|
-
const frozenData = frozenDict
|
|
75
|
+
const frozenData = frozenDict
|
|
76
|
+
.beginParse()
|
|
77
|
+
.loadDictDirect(core_1.Dictionary.Keys.Buffer(32), FrozenDictValue);
|
|
74
78
|
for (const [key, value] of frozenData) {
|
|
75
|
-
frozen.set(BigInt("0x" + key.toString("hex")).toString(10), {
|
|
79
|
+
frozen.set(BigInt("0x" + key.toString("hex")).toString(10), {
|
|
80
|
+
address: value["address"],
|
|
81
|
+
weight: value["weight"],
|
|
82
|
+
stake: value["stake"],
|
|
83
|
+
});
|
|
76
84
|
}
|
|
77
|
-
elections.push({
|
|
85
|
+
elections.push({
|
|
86
|
+
id,
|
|
87
|
+
unfreezeAt,
|
|
88
|
+
stakeHeld,
|
|
89
|
+
totalStake,
|
|
90
|
+
bonuses,
|
|
91
|
+
frozen,
|
|
92
|
+
});
|
|
78
93
|
}
|
|
79
94
|
return elections;
|
|
80
95
|
}
|
|
@@ -83,8 +98,8 @@ class ElectorContract {
|
|
|
83
98
|
// NOTE: this method doesn't call get method since for some reason it doesn't work
|
|
84
99
|
//
|
|
85
100
|
const account = await provider.getState();
|
|
86
|
-
if (account.state.type !==
|
|
87
|
-
throw Error(
|
|
101
|
+
if (account.state.type !== "active") {
|
|
102
|
+
throw Error("Unexpected error");
|
|
88
103
|
}
|
|
89
104
|
const cell = core_1.Cell.fromBoc(account.state.data)[0];
|
|
90
105
|
const cs = cell.beginParse();
|
|
@@ -104,10 +119,21 @@ class ElectorContract {
|
|
|
104
119
|
// const finished = sc.loadBit();
|
|
105
120
|
if (entitiesData) {
|
|
106
121
|
for (const [key, value] of entitiesData) {
|
|
107
|
-
entities.push({
|
|
122
|
+
entities.push({
|
|
123
|
+
pubkey: key,
|
|
124
|
+
stake: value["stake"],
|
|
125
|
+
address: value["address"],
|
|
126
|
+
adnl: value["adnl"],
|
|
127
|
+
});
|
|
108
128
|
}
|
|
109
129
|
}
|
|
110
|
-
return {
|
|
130
|
+
return {
|
|
131
|
+
minStake,
|
|
132
|
+
allStakes,
|
|
133
|
+
endElectionsTime,
|
|
134
|
+
startWorkTime,
|
|
135
|
+
entities,
|
|
136
|
+
};
|
|
111
137
|
}
|
|
112
138
|
// possible code for fetching data via get method if it is possible to set gas limit by request
|
|
113
139
|
// async getElectionEntities(block: number) {
|
|
@@ -134,15 +160,15 @@ class ElectorContract {
|
|
|
134
160
|
// return { minStake, allStakes, endElectionsTime, startWorkTime, entities };
|
|
135
161
|
// }
|
|
136
162
|
async getActiveElectionId(provider) {
|
|
137
|
-
const res = await provider.get(
|
|
163
|
+
const res = await provider.get("active_election_id", []);
|
|
138
164
|
const electionId = res.stack.readNumber();
|
|
139
165
|
return electionId > 0 ? electionId : null;
|
|
140
166
|
}
|
|
141
167
|
async getComplaints(provider, electionId) {
|
|
142
168
|
const b = new core_1.TupleBuilder();
|
|
143
169
|
b.writeNumber(electionId);
|
|
144
|
-
const res = await provider.get(
|
|
145
|
-
if (res.stack.peek().type ===
|
|
170
|
+
const res = await provider.get("list_complaints", b.build());
|
|
171
|
+
if (res.stack.peek().type === "null") {
|
|
146
172
|
return [];
|
|
147
173
|
}
|
|
148
174
|
//let tuple = new TupleReader(res.result);
|
|
@@ -153,7 +179,7 @@ class ElectorContract {
|
|
|
153
179
|
const id = complaintsEntry.readBigNumber();
|
|
154
180
|
const completeUnpackedComplaint = complaintsEntry.readTuple();
|
|
155
181
|
const unpackedComplaints = completeUnpackedComplaint.readTuple();
|
|
156
|
-
const publicKey = Buffer.from(unpackedComplaints.readBigNumber().toString(16),
|
|
182
|
+
const publicKey = Buffer.from(unpackedComplaints.readBigNumber().toString(16), "hex");
|
|
157
183
|
// prod_info#34 utime:uint32 mc_blk_ref:ExtBlkRef state_proof:^(MERKLE_PROOF Block)
|
|
158
184
|
// prod_proof:^(MERKLE_PROOF ShardState) = ProducerInfo;
|
|
159
185
|
// no_blk_gen from_utime:uint32 prod_info:^ProducerInfo = ComplaintDescr;
|
|
@@ -161,7 +187,7 @@ class ElectorContract {
|
|
|
161
187
|
const description = unpackedComplaints.readCell();
|
|
162
188
|
const createdAt = unpackedComplaints.readNumber();
|
|
163
189
|
const severity = unpackedComplaints.readNumber();
|
|
164
|
-
const rewardAddress = new core_1.Address(-1, Buffer.from(unpackedComplaints.readBigNumber().toString(16),
|
|
190
|
+
const rewardAddress = new core_1.Address(-1, Buffer.from(unpackedComplaints.readBigNumber().toString(16), "hex"));
|
|
165
191
|
const paid = unpackedComplaints.readBigNumber();
|
|
166
192
|
const suggestedFine = unpackedComplaints.readBigNumber();
|
|
167
193
|
const suggestedFinePart = unpackedComplaints.readBigNumber();
|
|
@@ -183,7 +209,7 @@ class ElectorContract {
|
|
|
183
209
|
rewardAddress,
|
|
184
210
|
votes,
|
|
185
211
|
remainingWeight,
|
|
186
|
-
vsetId
|
|
212
|
+
vsetId,
|
|
187
213
|
});
|
|
188
214
|
}
|
|
189
215
|
return results;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,25 +5,25 @@
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
export * from
|
|
9
|
-
export { HttpApi, HttpApiParameters } from
|
|
10
|
-
export { TonClient, TonClientParameters } from
|
|
11
|
-
export { TonClient4, TonClient4Parameters } from
|
|
12
|
-
export { WalletContractV1R1 } from
|
|
13
|
-
export { WalletContractV1R2 } from
|
|
14
|
-
export { WalletContractV1R3 } from
|
|
15
|
-
export { WalletContractV2R1 } from
|
|
16
|
-
export { WalletContractV2R2 } from
|
|
17
|
-
export { WalletContractV3R1 } from
|
|
18
|
-
export { WalletContractV3R2 } from
|
|
19
|
-
export { WalletContractV4 } from
|
|
20
|
-
export { WalletContractV5Beta } from
|
|
21
|
-
export { WalletContractV5R1 } from
|
|
22
|
-
export { JettonMaster } from
|
|
23
|
-
export { JettonWallet } from
|
|
24
|
-
export { MultisigOrder } from
|
|
25
|
-
export { MultisigOrderBuilder } from
|
|
26
|
-
export { MultisigWallet } from
|
|
27
|
-
export { ElectorContract } from
|
|
28
|
-
export { GasLimitsPrices, StoragePrices, MsgPrices, WorkchainDescriptor, configParse5, configParse8, configParse12, configParse13, configParse15, configParse16, configParse17, configParse18, configParse28, configParse29, configParse40, configParseBridge, configParseGasLimitsPrices, configParseMasterAddress, configParseMasterAddressRequired, configParseMsgPrices, configParseValidatorSet, configParseWorkchainDescriptor, parseBridge, parseProposalSetup, parseValidatorSet, parseVotingSetup, parseFullConfig, loadConfigParamById, loadConfigParamsAsSlice } from
|
|
29
|
-
export { computeExternalMessageFees, computeFwdFees, computeGasPrices, computeMessageForwardFees, computeStorageFees } from
|
|
8
|
+
export * from "@ton/core";
|
|
9
|
+
export { HttpApi, HttpApiParameters } from "./client/api/HttpApi";
|
|
10
|
+
export { TonClient, TonClientParameters } from "./client/TonClient";
|
|
11
|
+
export { TonClient4, TonClient4Parameters, } from "./client/TonClient4";
|
|
12
|
+
export { WalletContractV1R1 } from "./wallets/WalletContractV1R1";
|
|
13
|
+
export { WalletContractV1R2 } from "./wallets/WalletContractV1R2";
|
|
14
|
+
export { WalletContractV1R3 } from "./wallets/WalletContractV1R3";
|
|
15
|
+
export { WalletContractV2R1 } from "./wallets/WalletContractV2R1";
|
|
16
|
+
export { WalletContractV2R2 } from "./wallets/WalletContractV2R2";
|
|
17
|
+
export { WalletContractV3R1 } from "./wallets/WalletContractV3R1";
|
|
18
|
+
export { WalletContractV3R2 } from "./wallets/WalletContractV3R2";
|
|
19
|
+
export { WalletContractV4 } from "./wallets/WalletContractV4";
|
|
20
|
+
export { WalletContractV5Beta } from "./wallets/WalletContractV5Beta";
|
|
21
|
+
export { WalletContractV5R1 } from "./wallets/WalletContractV5R1";
|
|
22
|
+
export { JettonMaster } from "./jetton/JettonMaster";
|
|
23
|
+
export { JettonWallet } from "./jetton/JettonWallet";
|
|
24
|
+
export { MultisigOrder } from "./multisig/MultisigOrder";
|
|
25
|
+
export { MultisigOrderBuilder } from "./multisig/MultisigOrderBuilder";
|
|
26
|
+
export { MultisigWallet } from "./multisig/MultisigWallet";
|
|
27
|
+
export { ElectorContract } from "./elector/ElectorContract";
|
|
28
|
+
export { GasLimitsPrices, StoragePrices, MsgPrices, WorkchainDescriptor, configParse5, configParse8, configParse12, configParse13, configParse15, configParse16, configParse17, configParse18, configParse28, configParse29, configParse40, configParseBridge, configParseGasLimitsPrices, configParseMasterAddress, configParseMasterAddressRequired, configParseMsgPrices, configParseValidatorSet, configParseWorkchainDescriptor, parseBridge, parseProposalSetup, parseValidatorSet, parseVotingSetup, parseFullConfig, parseFullerConfig, loadConfigParamById, loadConfigParamsAsSlice, } from "./config/ConfigParser";
|
|
29
|
+
export { computeExternalMessageFees, computeFwdFees, computeGasPrices, computeMessageForwardFees, computeStorageFees, } from "./utils/fees";
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
21
21
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.computeStorageFees = exports.computeMessageForwardFees = exports.computeGasPrices = exports.computeFwdFees = exports.computeExternalMessageFees = exports.loadConfigParamsAsSlice = exports.loadConfigParamById = exports.parseFullConfig = exports.parseVotingSetup = exports.parseValidatorSet = exports.parseProposalSetup = exports.parseBridge = exports.configParseWorkchainDescriptor = exports.configParseValidatorSet = exports.configParseMsgPrices = exports.configParseMasterAddressRequired = exports.configParseMasterAddress = exports.configParseGasLimitsPrices = exports.configParseBridge = exports.configParse40 = exports.configParse29 = exports.configParse28 = exports.configParse18 = exports.configParse17 = exports.configParse16 = exports.configParse15 = exports.configParse13 = exports.configParse12 = exports.configParse8 = exports.configParse5 = exports.ElectorContract = exports.MultisigWallet = exports.MultisigOrderBuilder = exports.MultisigOrder = exports.JettonWallet = exports.JettonMaster = exports.WalletContractV5R1 = exports.WalletContractV5Beta = exports.WalletContractV4 = exports.WalletContractV3R2 = exports.WalletContractV3R1 = exports.WalletContractV2R2 = exports.WalletContractV2R1 = exports.WalletContractV1R3 = exports.WalletContractV1R2 = exports.WalletContractV1R1 = exports.TonClient4 = exports.TonClient = exports.HttpApi = void 0;
|
|
24
|
+
exports.computeStorageFees = exports.computeMessageForwardFees = exports.computeGasPrices = exports.computeFwdFees = exports.computeExternalMessageFees = exports.loadConfigParamsAsSlice = exports.loadConfigParamById = exports.parseFullerConfig = exports.parseFullConfig = exports.parseVotingSetup = exports.parseValidatorSet = exports.parseProposalSetup = exports.parseBridge = exports.configParseWorkchainDescriptor = exports.configParseValidatorSet = exports.configParseMsgPrices = exports.configParseMasterAddressRequired = exports.configParseMasterAddress = exports.configParseGasLimitsPrices = exports.configParseBridge = exports.configParse40 = exports.configParse29 = exports.configParse28 = exports.configParse18 = exports.configParse17 = exports.configParse16 = exports.configParse15 = exports.configParse13 = exports.configParse12 = exports.configParse8 = exports.configParse5 = exports.ElectorContract = exports.MultisigWallet = exports.MultisigOrderBuilder = exports.MultisigOrder = exports.JettonWallet = exports.JettonMaster = exports.WalletContractV5R1 = exports.WalletContractV5Beta = exports.WalletContractV4 = exports.WalletContractV3R2 = exports.WalletContractV3R1 = exports.WalletContractV2R2 = exports.WalletContractV2R1 = exports.WalletContractV1R3 = exports.WalletContractV1R2 = exports.WalletContractV1R1 = exports.TonClient4 = exports.TonClient = exports.HttpApi = void 0;
|
|
25
25
|
__exportStar(require("@ton/core"), exports);
|
|
26
26
|
//
|
|
27
27
|
// toncenter Client
|
|
@@ -106,6 +106,7 @@ Object.defineProperty(exports, "parseProposalSetup", { enumerable: true, get: fu
|
|
|
106
106
|
Object.defineProperty(exports, "parseValidatorSet", { enumerable: true, get: function () { return ConfigParser_1.parseValidatorSet; } });
|
|
107
107
|
Object.defineProperty(exports, "parseVotingSetup", { enumerable: true, get: function () { return ConfigParser_1.parseVotingSetup; } });
|
|
108
108
|
Object.defineProperty(exports, "parseFullConfig", { enumerable: true, get: function () { return ConfigParser_1.parseFullConfig; } });
|
|
109
|
+
Object.defineProperty(exports, "parseFullerConfig", { enumerable: true, get: function () { return ConfigParser_1.parseFullerConfig; } });
|
|
109
110
|
Object.defineProperty(exports, "loadConfigParamById", { enumerable: true, get: function () { return ConfigParser_1.loadConfigParamById; } });
|
|
110
111
|
Object.defineProperty(exports, "loadConfigParamsAsSlice", { enumerable: true, get: function () { return ConfigParser_1.loadConfigParamsAsSlice; } });
|
|
111
112
|
//
|
|
@@ -17,11 +17,13 @@ class JettonMaster {
|
|
|
17
17
|
this.address = address;
|
|
18
18
|
}
|
|
19
19
|
async getWalletAddress(provider, owner) {
|
|
20
|
-
let res = await provider.get(
|
|
20
|
+
let res = await provider.get("get_wallet_address", [
|
|
21
|
+
{ type: "slice", cell: (0, core_1.beginCell)().storeAddress(owner).endCell() },
|
|
22
|
+
]);
|
|
21
23
|
return res.stack.readAddress();
|
|
22
24
|
}
|
|
23
25
|
async getJettonData(provider) {
|
|
24
|
-
let res = await provider.get(
|
|
26
|
+
let res = await provider.get("get_jetton_data", []);
|
|
25
27
|
let totalSupply = res.stack.readBigNumber();
|
|
26
28
|
let mintable = res.stack.readBoolean();
|
|
27
29
|
let adminAddress = res.stack.readAddress();
|
|
@@ -32,7 +34,7 @@ class JettonMaster {
|
|
|
32
34
|
mintable,
|
|
33
35
|
adminAddress,
|
|
34
36
|
content,
|
|
35
|
-
walletCode
|
|
37
|
+
walletCode,
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -17,10 +17,10 @@ class JettonWallet {
|
|
|
17
17
|
}
|
|
18
18
|
async getBalance(provider) {
|
|
19
19
|
let state = await provider.getState();
|
|
20
|
-
if (state.state.type !==
|
|
20
|
+
if (state.state.type !== "active") {
|
|
21
21
|
return 0n;
|
|
22
22
|
}
|
|
23
|
-
let res = await provider.get(
|
|
23
|
+
let res = await provider.get("get_wallet_data", []);
|
|
24
24
|
return res.stack.readBigNumber();
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -36,7 +36,7 @@ class MultisigOrder {
|
|
|
36
36
|
addSignature(ownerId, signature, multisig) {
|
|
37
37
|
const signingHash = this.payload.hash();
|
|
38
38
|
if (!(0, crypto_1.signVerify)(signingHash, signature, multisig.owners.get(ownerId).slice(0, -1))) {
|
|
39
|
-
throw Error(
|
|
39
|
+
throw Error("invalid signature");
|
|
40
40
|
}
|
|
41
41
|
this.signatures[ownerId] = signature;
|
|
42
42
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Builder, MessageRelaxed } from
|
|
2
|
-
import { MultisigOrder } from
|
|
1
|
+
import { Builder, MessageRelaxed } from "@ton/core";
|
|
2
|
+
import { MultisigOrder } from "./MultisigOrder";
|
|
3
3
|
export declare class MultisigOrderBuilder {
|
|
4
4
|
messages: Builder;
|
|
5
5
|
queryId: bigint;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TonClient } from
|
|
2
|
-
import { Address, ContractProvider, Dictionary, Sender, StateInit } from
|
|
3
|
-
import { MultisigOrder } from
|
|
1
|
+
import { TonClient } from "../index";
|
|
2
|
+
import { Address, ContractProvider, Dictionary, Sender, StateInit } from "@ton/core";
|
|
3
|
+
import { MultisigOrder } from "./MultisigOrder";
|
|
4
4
|
export declare class MultisigWallet {
|
|
5
5
|
owners: Dictionary<number, Buffer>;
|
|
6
6
|
workchain: number;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.MultisigWallet = void 0;
|
|
5
5
|
const crypto_1 = require("@ton/crypto");
|
|
6
6
|
const core_1 = require("@ton/core");
|
|
7
|
-
const MULTISIG_CODE = core_1.Cell.fromBase64(
|
|
7
|
+
const MULTISIG_CODE = core_1.Cell.fromBase64("te6ccgECKwEABBgAART/APSkE/S88sgLAQIBIAIDAgFIBAUE2vIgxwCOgzDbPOCDCNcYIPkBAdMH2zwiwAAToVNxePQOb6Hyn9s8VBq6+RDyoAb0BCD5AQHTH1EYuvKq0z9wUwHwCgHCCAGDCryx8mhTFYBA9A5voSCYDqQgwgryZw7f+COqH1NAufJhVCOjU04gIyEiAgLMBgcCASAMDQIBIAgJAgFmCgsAA9GEAiPymAvHoHN9CYbZ5S7Z4BPHohwhJQAtAKkItdJEqCTItdKlwLUAdAT8ArobBKAATwhbpEx4CBukTDgAdAg10rDAJrUAvALyFjPFszJ4HHXI8gBzxb0AMmACASAODwIBIBQVARW77ZbVA0cFUg2zyCoCAUgQEQIBIBITAXOxHXQgwjXGCD5AQHTB4IB1MTtQ9hTIHj0Dm+h8p/XC/9eMfkQ8qCuAfQEIW6TW3Ey4PkBWNs8AaQBgJwA9rtqA6ADoAPoCAXoCEfyAgPyA3XlP+AXkegAA54tkwAAXrhlXP8EA1WZ2oexAAgEgFhcCASAYGQFRtyVbZ4YmRmpGEAgegc30McJNhFpAADMaYeYuAFrgJhwLb+4cC3d0bhAjAYm1WZtnhqvgb+2xxsoicAgej430pBHEoFpAADHDhBACGuQkuuBk9kUWE5kAOeLKhACQCB6IYFImHFImHFImXEA2YlzNijAjAgEgGhsAF7UGtc4QQDVZnah7EAIBIBwdAgOZOB4fARGsGm2eL4G2CUAjABWt+UEAzJV2oewYQAENqTbPBVfBYCMAFa3f3CCAarM7UPYgAiDbPALyZfgAUENxQxPbPO1UIyoACtP/0wcwBKDbPC+uUyCw8mISsQKkJbNTHLmwJYEA4aojoCi8sPJpggGGoPgBBZcCERACPj4wjo0REB/bPEDXePRDEL0F4lQWW1Rz51YQU9zbPFRxClR6vCQlKCYAIO1E0NMf0wfTB9M/9AT0BNEAXgGOGjDSAAHyo9MH0wdQA9cBIPkBBfkBFbrypFAD4GwhIddKqgIi10m68qtwVCATAAwByMv/ywcE1ts87VT4D3AlblOJvrGYEG4QLVDHXwePGzBUJANQTds8UFWgRlAQSRA6SwlTuds8UFQWf+L4AAeDJaGOLCaAQPSWb6UglDBTA7neII4WODk5CNIAAZfTBzAW8AcFkTDifwgHBZJsMeKz5jAGKicoKQBgcI4pA9CDCNcY0wf0BDBTFnj0Dm+h8qXXC/9URUT5EPKmrlIgsVIDvRShI27mbCIyAH5SML6OIF8D+ACTItdKmALTB9QC+wAC6DJwyMoAQBSAQPRDAvAHjhdxyMsAFMsHEssHWM8BWM8WQBOAQPRDAeIBII6KEEUQNEMA2zztVJJfBuIqABzIyx/LB8sHyz/0APQAyQ==");
|
|
8
8
|
class MultisigWallet {
|
|
9
9
|
constructor(publicKeys, workchain, walletId, k, opts) {
|
|
10
10
|
this.provider = null;
|
|
@@ -44,7 +44,7 @@ class MultisigWallet {
|
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
46
|
if (!opts.client) {
|
|
47
|
-
throw Error(
|
|
47
|
+
throw Error("Either provider or client must be specified");
|
|
48
48
|
}
|
|
49
49
|
provider = opts.client.provider(address, {
|
|
50
50
|
code: null,
|
|
@@ -52,8 +52,8 @@ class MultisigWallet {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
const contractState = (await provider.getState()).state;
|
|
55
|
-
if (contractState.type !==
|
|
56
|
-
throw Error(
|
|
55
|
+
if (contractState.type !== "active") {
|
|
56
|
+
throw Error("Contract must be active");
|
|
57
57
|
}
|
|
58
58
|
const data = core_1.Cell.fromBoc(contractState.data)[0].beginParse();
|
|
59
59
|
const walletId = data.loadUint(32);
|
|
@@ -74,7 +74,7 @@ class MultisigWallet {
|
|
|
74
74
|
}
|
|
75
75
|
async deployExternal(provider) {
|
|
76
76
|
if (!provider && !this.provider) {
|
|
77
|
-
throw Error(
|
|
77
|
+
throw Error("you must specify provider if there is no such property in MultisigWallet instance");
|
|
78
78
|
}
|
|
79
79
|
if (!provider) {
|
|
80
80
|
provider = this.provider;
|
|
@@ -93,7 +93,7 @@ class MultisigWallet {
|
|
|
93
93
|
}
|
|
94
94
|
async sendOrder(order, secretKey, provider) {
|
|
95
95
|
if (!provider && !this.provider) {
|
|
96
|
-
throw Error(
|
|
96
|
+
throw Error("you must specify provider if there is no such property in MultisigWallet instance");
|
|
97
97
|
}
|
|
98
98
|
if (!provider) {
|
|
99
99
|
provider = this.provider;
|
|
@@ -110,7 +110,7 @@ class MultisigWallet {
|
|
|
110
110
|
}
|
|
111
111
|
async sendOrderWithoutSecretKey(order, signature, ownerId, provider) {
|
|
112
112
|
if (!provider && !this.provider) {
|
|
113
|
-
throw Error(
|
|
113
|
+
throw Error("you must specify provider if there is no such property in MultisigWallet instance");
|
|
114
114
|
}
|
|
115
115
|
if (!provider) {
|
|
116
116
|
provider = this.provider;
|
|
@@ -128,7 +128,7 @@ class MultisigWallet {
|
|
|
128
128
|
return key;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
throw Error(
|
|
131
|
+
throw Error("public key is not an owner");
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
exports.MultisigWallet = MultisigWallet;
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
import { TonClient } from "../client/TonClient";
|
|
9
|
-
export declare function createTestClient(net?:
|
|
9
|
+
export declare function createTestClient(net?: "testnet" | "mainnet"): TonClient;
|
|
@@ -11,7 +11,11 @@ exports.createTestClient = createTestClient;
|
|
|
11
11
|
const TonClient_1 = require("../client/TonClient");
|
|
12
12
|
function createTestClient(net) {
|
|
13
13
|
return new TonClient_1.TonClient({
|
|
14
|
-
endpoint: net ===
|
|
15
|
-
|
|
14
|
+
endpoint: net === "mainnet"
|
|
15
|
+
? "https://mainnet.tonhubapi.com/jsonRPC"
|
|
16
|
+
: "https://testnet.toncenter.com/api/v2/jsonRPC",
|
|
17
|
+
apiKey: net !== "mainnet"
|
|
18
|
+
? "32df40f4ffc11053334bcdf09c7d3a9e6487ee0cb715edf8cf667c543edb10ca"
|
|
19
|
+
: undefined,
|
|
16
20
|
});
|
|
17
21
|
}
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
import { TonClient4 } from "../client/TonClient4";
|
|
9
|
-
export declare function createTestClient4(net?:
|
|
9
|
+
export declare function createTestClient4(net?: "testnet" | "mainnet"): TonClient4;
|
|
@@ -10,5 +10,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.createTestClient4 = createTestClient4;
|
|
11
11
|
const TonClient4_1 = require("../client/TonClient4");
|
|
12
12
|
function createTestClient4(net) {
|
|
13
|
-
return new TonClient4_1.TonClient4({
|
|
13
|
+
return new TonClient4_1.TonClient4({
|
|
14
|
+
endpoint: net === "mainnet"
|
|
15
|
+
? "https://mainnet-v4.tonhubapi.com"
|
|
16
|
+
: "https://testnet-v4.tonhubapi.com",
|
|
17
|
+
});
|
|
14
18
|
}
|
package/dist/utils/fees.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Cell } from
|
|
2
|
-
import { MsgPrices, StoragePrices } from
|
|
1
|
+
import { Cell } from "@ton/core";
|
|
2
|
+
import { MsgPrices, StoragePrices } from "../config/ConfigParser";
|
|
3
3
|
export declare function computeStorageFees(data: {
|
|
4
4
|
now: number;
|
|
5
5
|
lastPaid: number;
|
package/dist/utils/fees.js
CHANGED
|
@@ -11,18 +11,31 @@ const core_1 = require("@ton/core");
|
|
|
11
11
|
//
|
|
12
12
|
function computeStorageFees(data) {
|
|
13
13
|
const { lastPaid, now, storagePrices, storageStat, special, masterchain } = data;
|
|
14
|
-
if (now <= lastPaid ||
|
|
14
|
+
if (now <= lastPaid ||
|
|
15
|
+
storagePrices.length === 0 ||
|
|
16
|
+
now < storagePrices[0].utime_since ||
|
|
17
|
+
special) {
|
|
15
18
|
return BigInt(0);
|
|
16
19
|
}
|
|
17
20
|
let upto = Math.max(lastPaid, storagePrices[0].utime_since);
|
|
18
21
|
let total = BigInt(0);
|
|
19
22
|
for (let i = 0; i < storagePrices.length && upto < now; i++) {
|
|
20
|
-
let valid_until =
|
|
23
|
+
let valid_until = i < storagePrices.length - 1
|
|
24
|
+
? Math.min(now, storagePrices[i + 1].utime_since)
|
|
25
|
+
: now;
|
|
21
26
|
let payment = BigInt(0);
|
|
22
27
|
if (upto < valid_until) {
|
|
23
28
|
let delta = valid_until - upto;
|
|
24
|
-
payment +=
|
|
25
|
-
|
|
29
|
+
payment +=
|
|
30
|
+
BigInt(storageStat.cells) *
|
|
31
|
+
(masterchain
|
|
32
|
+
? storagePrices[i].mc_cell_price_ps
|
|
33
|
+
: storagePrices[i].cell_price_ps);
|
|
34
|
+
payment +=
|
|
35
|
+
BigInt(storageStat.bits) *
|
|
36
|
+
(masterchain
|
|
37
|
+
? storagePrices[i].mc_bit_price_ps
|
|
38
|
+
: storagePrices[i].bit_price_ps);
|
|
26
39
|
payment = payment * BigInt(delta);
|
|
27
40
|
}
|
|
28
41
|
upto = valid_until;
|
|
@@ -34,7 +47,8 @@ function computeStorageFees(data) {
|
|
|
34
47
|
// Source: https://github.com/ton-foundation/ton/blob/ae5c0720143e231c32c3d2034cfe4e533a16d969/crypto/block/transaction.cpp#L1218
|
|
35
48
|
//
|
|
36
49
|
function computeFwdFees(msgPrices, cells, bits) {
|
|
37
|
-
return msgPrices.lumpPrice +
|
|
50
|
+
return (msgPrices.lumpPrice +
|
|
51
|
+
shr16ceil(msgPrices.bitPrice * bits + msgPrices.cellPrice * cells));
|
|
38
52
|
}
|
|
39
53
|
//
|
|
40
54
|
// Source: https://github.com/ton-foundation/ton/blob/ae5c0720143e231c32c3d2034cfe4e533a16d969/crypto/block/transaction.cpp#L761
|
|
@@ -45,7 +59,8 @@ function computeGasPrices(gasUsed, prices) {
|
|
|
45
59
|
}
|
|
46
60
|
else {
|
|
47
61
|
// td::rshift(gas_price256 * (gas_used - cfg.flat_gas_limit), 16, 1) + cfg.flat_gas_price
|
|
48
|
-
return prices.flatPrice +
|
|
62
|
+
return (prices.flatPrice +
|
|
63
|
+
((prices.price * (gasUsed - prices.flatLimit)) >> 16n));
|
|
49
64
|
}
|
|
50
65
|
}
|
|
51
66
|
//
|
|
@@ -5,4 +5,6 @@
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
+
import { Address } from "@ton/core";
|
|
8
9
|
export declare function randomTestKey(seed: string): import("@ton/crypto").KeyPair;
|
|
10
|
+
export declare function testAddress(seed: string, workchain?: number): Address;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Whales Corp.
|
|
4
|
+
* All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.randomTestKey = randomTestKey;
|
|
11
|
+
exports.testAddress = testAddress;
|
|
12
|
+
const core_1 = require("@ton/core");
|
|
13
|
+
const crypto_1 = require("@ton/crypto");
|
|
14
|
+
function randomTestKey(seed) {
|
|
15
|
+
const hash = (0, crypto_1.sha256_sync)(seed);
|
|
16
|
+
return (0, crypto_1.keyPairFromSeed)(hash);
|
|
17
|
+
}
|
|
18
|
+
function testAddress(seed, workchain = 0) {
|
|
19
|
+
const hash = (0, crypto_1.sha256_sync)(seed);
|
|
20
|
+
return new core_1.Address(workchain, hash);
|
|
21
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { OpenedContract } from
|
|
2
|
-
import { WalletContractV5R1 } from
|
|
3
|
-
import { WalletContractV5Beta } from
|
|
4
|
-
import { WalletContractV4 } from
|
|
5
|
-
import { WalletContractV3R2 } from
|
|
6
|
-
import { WalletContractV3R1 } from
|
|
7
|
-
import { WalletContractV2R2 } from
|
|
8
|
-
import { WalletContractV2R1 } from
|
|
9
|
-
import { WalletContractV1R2 } from
|
|
10
|
-
import { WalletContractV1R1 } from
|
|
1
|
+
import { OpenedContract } from "@ton/core";
|
|
2
|
+
import { WalletContractV5R1 } from "../wallets/v5r1/WalletContractV5R1";
|
|
3
|
+
import { WalletContractV5Beta } from "../wallets/v5beta/WalletContractV5Beta";
|
|
4
|
+
import { WalletContractV4 } from "../wallets/WalletContractV4";
|
|
5
|
+
import { WalletContractV3R2 } from "../wallets/WalletContractV3R2";
|
|
6
|
+
import { WalletContractV3R1 } from "../wallets/WalletContractV3R1";
|
|
7
|
+
import { WalletContractV2R2 } from "../wallets/WalletContractV2R2";
|
|
8
|
+
import { WalletContractV2R1 } from "../wallets/WalletContractV2R1";
|
|
9
|
+
import { WalletContractV1R2 } from "../wallets/WalletContractV1R2";
|
|
10
|
+
import { WalletContractV1R1 } from "../wallets/WalletContractV1R1";
|
|
11
11
|
type WalletContract = WalletContractV5R1 | WalletContractV5Beta | WalletContractV4 | WalletContractV3R2 | WalletContractV3R1 | WalletContractV2R2 | WalletContractV2R1 | WalletContractV1R2 | WalletContractV1R1;
|
|
12
12
|
export declare const tillNextSeqno: (wallet: OpenedContract<WalletContract>, oldSeqno: number, maxTries?: number) => Promise<void>;
|
|
13
13
|
export {};
|
package/dist/utils/time.js
CHANGED
|
@@ -13,11 +13,13 @@ exports.delayBreakable = delayBreakable;
|
|
|
13
13
|
exports.forever = forever;
|
|
14
14
|
exports.backoff = backoff;
|
|
15
15
|
function exponentialBackoffDelay(currentFailureCount, minDelay, maxDelay, maxFailureCount) {
|
|
16
|
-
let maxDelayRet = minDelay +
|
|
16
|
+
let maxDelayRet = minDelay +
|
|
17
|
+
((maxDelay - minDelay) / maxFailureCount) *
|
|
18
|
+
Math.max(currentFailureCount, maxFailureCount);
|
|
17
19
|
return Math.round(Math.random() * maxDelayRet);
|
|
18
20
|
}
|
|
19
21
|
async function delay(ms) {
|
|
20
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
22
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
21
23
|
}
|
|
22
24
|
function delayBreakable(ms) {
|
|
23
25
|
// We can cancel delay from outer code
|
|
@@ -27,7 +29,7 @@ function delayBreakable(ms) {
|
|
|
27
29
|
promiseResolver();
|
|
28
30
|
}
|
|
29
31
|
};
|
|
30
|
-
let promise = new Promise(resolve => {
|
|
32
|
+
let promise = new Promise((resolve) => {
|
|
31
33
|
promiseResolver = resolve;
|
|
32
34
|
setTimeout(resolve, ms);
|
|
33
35
|
});
|
package/dist/utils/toUrlSafe.js
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.toUrlSafe = toUrlSafe;
|
|
11
11
|
function toUrlSafe(src) {
|
|
12
|
-
while (src.indexOf(
|
|
13
|
-
src = src.replace(
|
|
12
|
+
while (src.indexOf("/") >= 0) {
|
|
13
|
+
src = src.replace("/", "_");
|
|
14
14
|
}
|
|
15
|
-
while (src.indexOf(
|
|
16
|
-
src = src.replace(
|
|
15
|
+
while (src.indexOf("+") >= 0) {
|
|
16
|
+
src = src.replace("+", "-");
|
|
17
17
|
}
|
|
18
|
-
while (src.indexOf(
|
|
19
|
-
src = src.replace(
|
|
18
|
+
while (src.indexOf("=") >= 0) {
|
|
19
|
+
src = src.replace("=", "");
|
|
20
20
|
}
|
|
21
21
|
return src;
|
|
22
22
|
}
|