@streamflow/stream 6.5.0 → 7.0.0-alpha.10
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 +17 -22
- package/dist/cjs/__tests__/aptos/streamClient.spec.js +111 -0
- package/dist/cjs/__tests__/common/GenericStreamClient.spec.js +45 -0
- package/dist/cjs/aptos/StreamClient.js +226 -0
- package/dist/cjs/aptos/constants.js +27 -0
- package/dist/{aptos → cjs/aptos}/index.js +6 -6
- package/dist/cjs/aptos/types.js +69 -0
- package/dist/{aptos → cjs/aptos}/utils.js +4 -4
- package/dist/cjs/aptos/wallet.js +34 -0
- package/dist/cjs/common/BaseStreamClient.js +23 -0
- package/dist/cjs/common/GenericStreamClient.js +102 -0
- package/dist/{common → cjs/common}/constants.js +2 -2
- package/dist/{common → cjs/common}/contractUtils.js +19 -20
- package/dist/cjs/common/utils.js +66 -0
- package/dist/cjs/evm/StreamClient.js +238 -0
- package/dist/cjs/evm/constants.js +38 -0
- package/dist/{evm → cjs/evm}/index.js +8 -8
- package/dist/{evm → cjs/evm}/types.js +26 -35
- package/dist/{evm → cjs/evm}/utils.js +2 -2
- package/dist/{index.js → cjs/index.js} +10 -10
- package/dist/cjs/solana/StreamClient.js +737 -0
- package/dist/{solana → cjs/solana}/constants.js +33 -33
- package/dist/cjs/solana/index.js +39 -0
- package/dist/{solana → cjs/solana}/instructions.js +83 -83
- package/dist/{solana → cjs/solana}/layout.js +8 -9
- package/dist/{solana → cjs/solana}/types.js +16 -26
- package/dist/cjs/solana/utils.js +134 -0
- package/dist/cjs/sui/StreamClient.js +402 -0
- package/dist/cjs/sui/constants.js +42 -0
- package/dist/{sui → cjs/sui}/index.js +5 -5
- package/dist/cjs/sui/types.js +68 -0
- package/dist/{sui → cjs/sui}/utils.js +7 -7
- package/dist/cjs/sui/wallet.js +40 -0
- package/dist/esm/__tests__/aptos/streamClient.spec.js +106 -0
- package/dist/esm/__tests__/common/GenericStreamClient.spec.js +40 -0
- package/dist/{aptos → esm/aptos}/StreamClient.d.ts +3 -3
- package/dist/esm/aptos/StreamClient.js +226 -0
- package/dist/{aptos → esm/aptos}/constants.d.ts +1 -1
- package/dist/esm/aptos/constants.js +24 -0
- package/dist/esm/aptos/index.d.ts +4 -0
- package/dist/esm/aptos/index.js +4 -0
- package/dist/{aptos → esm/aptos}/types.d.ts +13 -13
- package/dist/esm/aptos/types.js +105 -0
- package/dist/esm/aptos/utils.js +30 -0
- package/dist/esm/aptos/wallet.js +33 -0
- package/dist/{common → esm/common}/BaseStreamClient.d.ts +1 -1
- package/dist/esm/common/BaseStreamClient.js +19 -0
- package/dist/{common → esm/common}/GenericStreamClient.d.ts +6 -6
- package/dist/esm/common/GenericStreamClient.js +101 -0
- package/dist/esm/common/constants.d.ts +3 -0
- package/dist/esm/common/constants.js +3 -0
- package/dist/{common → esm/common}/contractUtils.d.ts +15 -15
- package/dist/esm/common/contractUtils.js +42 -0
- package/dist/{common → esm/common}/types.d.ts +19 -19
- package/dist/esm/common/types.js +106 -0
- package/dist/{common → esm/common}/utils.d.ts +11 -12
- package/dist/esm/common/utils.js +56 -0
- package/dist/{evm → esm/evm}/StreamClient.d.ts +4 -4
- package/dist/esm/evm/StreamClient.js +237 -0
- package/dist/esm/evm/abi.js +1255 -0
- package/dist/{evm → esm/evm}/constants.d.ts +1 -1
- package/dist/esm/evm/constants.js +35 -0
- package/dist/esm/evm/ercAbi.js +222 -0
- package/dist/esm/evm/index.d.ts +5 -0
- package/dist/esm/evm/index.js +5 -0
- package/dist/{evm → esm/evm}/types.d.ts +38 -38
- package/dist/esm/evm/types.js +102 -0
- package/dist/esm/evm/utils.js +8 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.js +9 -0
- package/dist/{solana → esm/solana}/StreamClient.d.ts +4 -4
- package/dist/esm/solana/StreamClient.js +711 -0
- package/dist/{solana → esm/solana}/constants.d.ts +3 -1
- package/dist/esm/solana/constants.js +62 -0
- package/dist/esm/solana/index.d.ts +6 -0
- package/dist/esm/solana/index.js +6 -0
- package/dist/esm/solana/instructionTypes.js +1 -0
- package/dist/{solana → esm/solana}/instructions.d.ts +18 -18
- package/dist/esm/solana/instructions.js +257 -0
- package/dist/{solana → esm/solana}/layout.d.ts +2 -1
- package/dist/esm/solana/layout.js +155 -0
- package/dist/esm/solana/timelockIDL.js +420 -0
- package/dist/{solana → esm/solana}/types.d.ts +38 -37
- package/dist/esm/solana/types.js +101 -0
- package/dist/{solana → esm/solana}/utils.d.ts +4 -1
- package/dist/esm/solana/utils.js +123 -0
- package/dist/{sui → esm/sui}/StreamClient.d.ts +3 -3
- package/dist/esm/sui/StreamClient.js +403 -0
- package/dist/{sui → esm/sui}/constants.d.ts +1 -1
- package/dist/esm/sui/constants.js +39 -0
- package/dist/esm/sui/index.d.ts +4 -0
- package/dist/esm/sui/index.js +4 -0
- package/dist/{sui → esm/sui}/types.d.ts +13 -13
- package/dist/esm/sui/types.js +104 -0
- package/dist/{sui → esm/sui}/utils.d.ts +1 -1
- package/dist/esm/sui/utils.js +23 -0
- package/dist/{sui → esm/sui}/wallet.d.ts +1 -1
- package/dist/esm/sui/wallet.js +38 -0
- package/package.json +37 -35
- package/dist/__tests__/aptos/streamClient.spec.js +0 -161
- package/dist/__tests__/common/GenericStreamClient.spec.js +0 -44
- package/dist/aptos/StreamClient.js +0 -431
- package/dist/aptos/constants.js +0 -28
- package/dist/aptos/index.d.ts +0 -4
- package/dist/aptos/types.js +0 -77
- package/dist/aptos/wallet.js +0 -89
- package/dist/common/BaseStreamClient.js +0 -71
- package/dist/common/GenericStreamClient.js +0 -128
- package/dist/common/constants.d.ts +0 -3
- package/dist/common/utils.js +0 -118
- package/dist/evm/StreamClient.js +0 -496
- package/dist/evm/constants.js +0 -39
- package/dist/evm/index.d.ts +0 -5
- package/dist/index.d.ts +0 -9
- package/dist/solana/StreamClient.js +0 -1253
- package/dist/solana/index.d.ts +0 -7
- package/dist/solana/index.js +0 -43
- package/dist/solana/utils.js +0 -211
- package/dist/sui/StreamClient.js +0 -648
- package/dist/sui/constants.js +0 -43
- package/dist/sui/index.d.ts +0 -4
- package/dist/sui/types.js +0 -102
- package/dist/sui/wallet.js +0 -90
- /package/dist/{common → cjs/common}/types.js +0 -0
- /package/dist/{evm → cjs/evm}/abi.js +0 -0
- /package/dist/{evm → cjs/evm}/ercAbi.js +0 -0
- /package/dist/{solana → cjs/solana}/instructionTypes.js +0 -0
- /package/dist/{solana → cjs/solana}/timelockIDL.js +0 -0
- /package/dist/{__tests__ → esm/__tests__}/aptos/streamClient.spec.d.ts +0 -0
- /package/dist/{__tests__ → esm/__tests__}/common/GenericStreamClient.spec.d.ts +0 -0
- /package/dist/{aptos → esm/aptos}/utils.d.ts +0 -0
- /package/dist/{aptos → esm/aptos}/wallet.d.ts +0 -0
- /package/dist/{evm → esm/evm}/abi.d.ts +0 -0
- /package/dist/{evm → esm/evm}/ercAbi.d.ts +0 -0
- /package/dist/{evm → esm/evm}/utils.d.ts +0 -0
- /package/dist/{solana → esm/solana}/instructionTypes.d.ts +0 -0
- /package/dist/{solana → esm/solana}/timelockIDL.d.ts +0 -0
package/dist/sui/constants.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a, _b, _c;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.SUI_MODULE_ERROR_MAP = exports.SUI_ERROR_MATCH_REGEX = exports.SUI_FEE_TABLE_IDS = exports.SUI_CONFIG_IDS = exports.SUI_PROGRAM_IDS = void 0;
|
|
5
|
-
var types_1 = require("../common/types");
|
|
6
|
-
// TODO: remove Devnet and Local addresses as they are not deployed, they are just a copy Testnet values
|
|
7
|
-
exports.SUI_PROGRAM_IDS = (_a = {},
|
|
8
|
-
_a[types_1.ICluster.Mainnet] = "0xe456a3a1d4e58e85b4b7175fabe6dae895b983f1379bb8948d6ec2f137b08a7b",
|
|
9
|
-
_a[types_1.ICluster.Devnet] = "0x34dacd839e1758ebb70bdcd4e08f18fbfef5e2b96d9aa7ce2b4a71d96ca0df5a",
|
|
10
|
-
_a[types_1.ICluster.Testnet] = "0x34dacd839e1758ebb70bdcd4e08f18fbfef5e2b96d9aa7ce2b4a71d96ca0df5a",
|
|
11
|
-
_a[types_1.ICluster.Local] = "0x34dacd839e1758ebb70bdcd4e08f18fbfef5e2b96d9aa7ce2b4a71d96ca0df5a",
|
|
12
|
-
_a);
|
|
13
|
-
exports.SUI_CONFIG_IDS = (_b = {},
|
|
14
|
-
_b[types_1.ICluster.Mainnet] = "0x6cf6760b64245b8d23ef57c28ddceb6adbd540a23a509fef29b82237da4ab87b",
|
|
15
|
-
_b[types_1.ICluster.Devnet] = "0xd6c9f5074584f58074ce56e3c5cc436d82258ec3285f186a0d6438a60bacdbf8",
|
|
16
|
-
_b[types_1.ICluster.Testnet] = "0xd6c9f5074584f58074ce56e3c5cc436d82258ec3285f186a0d6438a60bacdbf8",
|
|
17
|
-
_b[types_1.ICluster.Local] = "0xd6c9f5074584f58074ce56e3c5cc436d82258ec3285f186a0d6438a60bacdbf8",
|
|
18
|
-
_b);
|
|
19
|
-
exports.SUI_FEE_TABLE_IDS = (_c = {},
|
|
20
|
-
_c[types_1.ICluster.Mainnet] = "0xad9b75399632583fb9fcae6b5bcca34e6542ab3bedb630ecbd3f15cb1cc48dbe",
|
|
21
|
-
_c[types_1.ICluster.Devnet] = "0x6057b093904c5bdfec1067d2b8a4dc35f65bcab03b3029ad716c4882b0f36078",
|
|
22
|
-
_c[types_1.ICluster.Testnet] = "0x6057b093904c5bdfec1067d2b8a4dc35f65bcab03b3029ad716c4882b0f36078",
|
|
23
|
-
_c[types_1.ICluster.Local] = "0x6057b093904c5bdfec1067d2b8a4dc35f65bcab03b3029ad716c4882b0f36078",
|
|
24
|
-
_c);
|
|
25
|
-
exports.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+)/;
|
|
26
|
-
exports.SUI_MODULE_ERROR_MAP = {
|
|
27
|
-
protocol: {
|
|
28
|
-
1: types_1.ContractErrorCode.ECONTRACT_NOT_INIT,
|
|
29
|
-
2: types_1.ContractErrorCode.EBAD_AMOUNT,
|
|
30
|
-
3: types_1.ContractErrorCode.ENO_PERMISSIONS,
|
|
31
|
-
4: types_1.ContractErrorCode.EBADINPUT,
|
|
32
|
-
5: types_1.ContractErrorCode.ECLOSED,
|
|
33
|
-
6: types_1.ContractErrorCode.EBAD_INPUT_AMOUNT_PER_PERIOD,
|
|
34
|
-
8: types_1.ContractErrorCode.EBAD_INPUT_UPDATE_RATE,
|
|
35
|
-
9: types_1.ContractErrorCode.EBAD_INPUT_CLIFF_AMOUNT,
|
|
36
|
-
10: types_1.ContractErrorCode.EBAD_INPUT_PERIOD,
|
|
37
|
-
11: types_1.ContractErrorCode.EBAD_INPUT_START,
|
|
38
|
-
13: types_1.ContractErrorCode.EBAD_INSUFFICIENT_WITHDRAWAL_FEES,
|
|
39
|
-
14: types_1.ContractErrorCode.EBAD_INSUFFICIENT_AMOUNT,
|
|
40
|
-
15: types_1.ContractErrorCode.EPAUSED,
|
|
41
|
-
16: types_1.ContractErrorCode.ENOTPAUSED,
|
|
42
|
-
},
|
|
43
|
-
};
|
package/dist/sui/index.d.ts
DELETED
package/dist/sui/types.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
-
if (!m) return o;
|
|
16
|
-
var i = m.call(o), r, ar = [], e;
|
|
17
|
-
try {
|
|
18
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
-
}
|
|
20
|
-
catch (error) { e = { error: error }; }
|
|
21
|
-
finally {
|
|
22
|
-
try {
|
|
23
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
-
}
|
|
25
|
-
finally { if (e) throw e.error; }
|
|
26
|
-
}
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
30
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
31
|
-
if (ar || !(i in from)) {
|
|
32
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33
|
-
ar[i] = from[i];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.Contract = void 0;
|
|
43
|
-
var bn_js_1 = __importDefault(require("bn.js"));
|
|
44
|
-
var contractUtils_1 = require("../common/contractUtils");
|
|
45
|
-
var utils_1 = require("../common/utils");
|
|
46
|
-
var Contract = /** @class */ (function () {
|
|
47
|
-
function Contract(stream, tokenId) {
|
|
48
|
-
var meta = stream.meta.fields;
|
|
49
|
-
var fees = stream.fees.fields;
|
|
50
|
-
this.magic = 0;
|
|
51
|
-
this.version = parseInt(stream.version);
|
|
52
|
-
this.createdAt = parseInt(stream.created);
|
|
53
|
-
this.withdrawnAmount = new bn_js_1.default(stream.withdrawn);
|
|
54
|
-
this.canceledAt = parseInt(stream.canceled_at);
|
|
55
|
-
this.end = parseInt(stream.end);
|
|
56
|
-
this.lastWithdrawnAt = parseInt(stream.last_withdrawn_at);
|
|
57
|
-
this.sender = stream.sender;
|
|
58
|
-
this.senderTokens = stream.sender;
|
|
59
|
-
this.recipient = stream.recipient;
|
|
60
|
-
this.recipientTokens = stream.recipient;
|
|
61
|
-
this.mint = tokenId;
|
|
62
|
-
this.escrowTokens = "";
|
|
63
|
-
this.streamflowTreasury = "";
|
|
64
|
-
this.streamflowTreasuryTokens = "";
|
|
65
|
-
this.streamflowFeeTotal = new bn_js_1.default(0);
|
|
66
|
-
this.streamflowFeeWithdrawn = new bn_js_1.default(0);
|
|
67
|
-
this.streamflowFeePercent = parseInt(fees.streamflow_fee_percentage) / 10000;
|
|
68
|
-
this.partnerFeeTotal = new bn_js_1.default(0);
|
|
69
|
-
this.partnerFeeWithdrawn = new bn_js_1.default(0);
|
|
70
|
-
this.partnerFeePercent = parseInt(fees.partner_fee_percentage) / 10000;
|
|
71
|
-
this.partner = stream.partner;
|
|
72
|
-
this.partnerTokens = "";
|
|
73
|
-
this.start = parseInt(stream.start);
|
|
74
|
-
this.depositedAmount = new bn_js_1.default(stream.amount);
|
|
75
|
-
this.period = parseInt(stream.period);
|
|
76
|
-
this.amountPerPeriod = new bn_js_1.default(stream.amount_per_period);
|
|
77
|
-
this.cliff = parseInt(stream.start);
|
|
78
|
-
this.cliffAmount = new bn_js_1.default(stream.cliff_amount);
|
|
79
|
-
this.cancelableBySender = meta.cancelable_by_sender;
|
|
80
|
-
this.cancelableByRecipient = meta.cancelable_by_recipient;
|
|
81
|
-
this.automaticWithdrawal = meta.automatic_withdrawal;
|
|
82
|
-
this.transferableBySender = meta.transferable_by_sender;
|
|
83
|
-
this.transferableByRecipient = meta.transferable_by_recipient;
|
|
84
|
-
this.canTopup = meta.can_topup;
|
|
85
|
-
this.name = String.fromCharCode.apply(String, __spreadArray([], __read(meta.contract_name), false));
|
|
86
|
-
this.withdrawalFrequency = parseInt(meta.withdrawal_frequency);
|
|
87
|
-
this.closed = stream.closed;
|
|
88
|
-
this.currentPauseStart = parseInt(stream.current_pause_start);
|
|
89
|
-
this.pauseCumulative = new bn_js_1.default(stream.pause_cumulative);
|
|
90
|
-
this.lastRateChangeTime = parseInt(stream.last_rate_change_time);
|
|
91
|
-
this.fundsUnlockedAtLastRateChange = new bn_js_1.default(stream.funds_unlocked_at_last_rate_change);
|
|
92
|
-
this.type = (0, contractUtils_1.buildStreamType)(this);
|
|
93
|
-
}
|
|
94
|
-
Contract.prototype.unlocked = function (currentTimestamp) {
|
|
95
|
-
return (0, contractUtils_1.calculateUnlockedAmount)(__assign(__assign({}, this), { currentTimestamp: currentTimestamp }));
|
|
96
|
-
};
|
|
97
|
-
Contract.prototype.remaining = function (decimals) {
|
|
98
|
-
return (0, utils_1.getNumberFromBN)(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
99
|
-
};
|
|
100
|
-
return Contract;
|
|
101
|
-
}());
|
|
102
|
-
exports.Contract = Contract;
|
package/dist/sui/wallet.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.SuiWalletWrapper = exports.isSignerKeypair = void 0;
|
|
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 | WalletContextState} 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
|
-
"export" in walletOrKeypair);
|
|
62
|
-
}
|
|
63
|
-
exports.isSignerKeypair = isSignerKeypair;
|
|
64
|
-
var SuiWalletWrapper = /** @class */ (function () {
|
|
65
|
-
function SuiWalletWrapper(wallet, client) {
|
|
66
|
-
this.client = client;
|
|
67
|
-
this.wallet = wallet;
|
|
68
|
-
if (isSignerKeypair(wallet)) {
|
|
69
|
-
this.address = wallet.toSuiAddress();
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
this.address = wallet.address;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
SuiWalletWrapper.prototype.signAndExecuteTransactionBlock = function (input) {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
77
|
-
return __generator(this, function (_a) {
|
|
78
|
-
if (isSignerKeypair(this.wallet)) {
|
|
79
|
-
return [2 /*return*/, this.client.signAndExecuteTransactionBlock(__assign(__assign({}, input), {
|
|
80
|
-
// @ts-ignore
|
|
81
|
-
signer: this.wallet }))];
|
|
82
|
-
}
|
|
83
|
-
// @ts-ignore
|
|
84
|
-
return [2 /*return*/, this.wallet.signAndExecuteTransactionBlock(input)];
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
return SuiWalletWrapper;
|
|
89
|
-
}());
|
|
90
|
-
exports.SuiWalletWrapper = SuiWalletWrapper;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|