@defisaver/sdk 1.3.36 → 1.3.37-semi-continuous-dev
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 +55 -9
- package/docs/DEV.md +63 -0
- package/esm/src/Action.js +21 -13
- package/esm/src/ActionWithL2.js +4 -0
- package/esm/src/Recipe.js +5 -1
- package/package.json +2 -6
- package/src/Action.ts +18 -9
- package/src/ActionWithL2.ts +2 -0
- package/src/Recipe.ts +4 -1
- package/test/Action.js +83 -3
- package/test/ActionWithL2.js +65 -19
- package/test/Recipe.js +97 -0
- package/tsconfig.json +1 -5
- package/umd/index.js +24 -13
- package/ACTIONS.md +0 -1765
- package/DEV.md +0 -43
- package/docs/md/.nojekyll +0 -1
- package/docs/md/README.md +0 -12
- package/docs/md/classes/AaveBorrowAction.md +0 -458
- package/docs/md/classes/AaveClaimStkAaveAction.md +0 -455
- package/docs/md/classes/AaveCollateralSwitchAction.md +0 -455
- package/docs/md/classes/AavePaybackAction.md +0 -458
- package/docs/md/classes/AaveSupplyAction.md +0 -458
- package/docs/md/classes/AaveV2FlashLoanAction.md +0 -458
- package/docs/md/classes/AaveV2FlashLoanPaybackAction.md +0 -454
- package/docs/md/classes/AaveV3ATokenPaybackAction.md +0 -644
- package/docs/md/classes/AaveV3BorrowAction.md +0 -606
- package/docs/md/classes/AaveV3ClaimRewardsAction.md +0 -603
- package/docs/md/classes/AaveV3CollateralSwitchAction.md +0 -603
- package/docs/md/classes/AaveV3FlashLoanAction.md +0 -604
- package/docs/md/classes/AaveV3FlashLoanPaybackAction.md +0 -454
- package/docs/md/classes/AaveV3PaybackAction.md +0 -618
- package/docs/md/classes/AaveV3RatioCheckAction.md +0 -454
- package/docs/md/classes/AaveV3RatioTrigger.md +0 -454
- package/docs/md/classes/AaveV3SetEModeAction.md +0 -601
- package/docs/md/classes/AaveV3SupplyAction.md +0 -618
- package/docs/md/classes/AaveV3SwapBorrowRateModeAction.md +0 -602
- package/docs/md/classes/AaveV3WithdrawAction.md +0 -603
- package/docs/md/classes/AaveWithdrawAction.md +0 -456
- package/docs/md/classes/Action.md +0 -604
- package/docs/md/classes/ActionWithL2.md +0 -612
- package/docs/md/classes/AutomationV2Unsub.md +0 -452
- package/docs/md/classes/BalancerFlashLoanAction.md +0 -456
- package/docs/md/classes/BalancerFlashLoanPaybackAction.md +0 -454
- package/docs/md/classes/BalancerV2ClaimAction.md +0 -457
- package/docs/md/classes/BalancerV2SupplyAction.md +0 -458
- package/docs/md/classes/BalancerV2WithdrawAction.md +0 -470
- package/docs/md/classes/CBChickenInAction.md +0 -454
- package/docs/md/classes/CBChickenOutAction.md +0 -455
- package/docs/md/classes/CBCreateAction.md +0 -454
- package/docs/md/classes/CBRedeemAction.md +0 -456
- package/docs/md/classes/ChainLinkPriceTrigger.md +0 -453
- package/docs/md/classes/ChangeProxyOwnerAction.md +0 -453
- package/docs/md/classes/CompV3RatioTrigger.md +0 -454
- package/docs/md/classes/CompoundBorrowAction.md +0 -455
- package/docs/md/classes/CompoundClaimAction.md +0 -456
- package/docs/md/classes/CompoundCollateralSwitchAction.md +0 -454
- package/docs/md/classes/CompoundGetDebtAction.md +0 -452
- package/docs/md/classes/CompoundPaybackAction.md +0 -456
- package/docs/md/classes/CompoundRatioTrigger.md +0 -453
- package/docs/md/classes/CompoundSupplyAction.md +0 -456
- package/docs/md/classes/CompoundV3AllowAction.md +0 -455
- package/docs/md/classes/CompoundV3BorrowAction.md +0 -456
- package/docs/md/classes/CompoundV3ClaimAction.md +0 -456
- package/docs/md/classes/CompoundV3PaybackAction.md +0 -468
- package/docs/md/classes/CompoundV3RatioCheckAction.md +0 -456
- package/docs/md/classes/CompoundV3SupplyAction.md +0 -468
- package/docs/md/classes/CompoundV3TransferAction.md +0 -457
- package/docs/md/classes/CompoundV3WithdrawAction.md +0 -457
- package/docs/md/classes/CompoundWithdrawAction.md +0 -455
- package/docs/md/classes/ConvexClaimAction.md +0 -466
- package/docs/md/classes/ConvexDepositAction.md +0 -468
- package/docs/md/classes/ConvexWithdrawAction.md +0 -468
- package/docs/md/classes/CurveClaimFeesAction.md +0 -452
- package/docs/md/classes/CurveDepositAction.md +0 -467
- package/docs/md/classes/CurveGaugeDepositAction.md +0 -455
- package/docs/md/classes/CurveGaugeWithdrawAction.md +0 -454
- package/docs/md/classes/CurveMintCrvAction.md +0 -452
- package/docs/md/classes/CurveStethPoolDepositAction.md +0 -456
- package/docs/md/classes/CurveStethPoolWithdrawAction.md +0 -457
- package/docs/md/classes/CurveSwapAction.md +0 -457
- package/docs/md/classes/CurveWithdrawAction.md +0 -468
- package/docs/md/classes/DfsWeb3.md +0 -212
- package/docs/md/classes/DyDxFlashLoanAction.md +0 -456
- package/docs/md/classes/DyDxFlashLoanPaybackAction.md +0 -454
- package/docs/md/classes/DyDxWithdrawAction.md +0 -455
- package/docs/md/classes/EulerFlashLoanAction.md +0 -456
- package/docs/md/classes/EulerFlashLoanPaybackAction.md +0 -454
- package/docs/md/classes/GUniDeposit.md +0 -461
- package/docs/md/classes/GUniWithdraw.md +0 -458
- package/docs/md/classes/GasFeeAction.md +0 -454
- package/docs/md/classes/GasFeeActionL2.md +0 -455
- package/docs/md/classes/GasPriceTrigger.md +0 -35
- package/docs/md/classes/InstPullTokensAction.md +0 -454
- package/docs/md/classes/LidoStakeAction.md +0 -455
- package/docs/md/classes/LidoUnwrapAction.md +0 -455
- package/docs/md/classes/LidoWrapAction.md +0 -456
- package/docs/md/classes/LiquityBorrowAction.md +0 -457
- package/docs/md/classes/LiquityClaimAction.md +0 -453
- package/docs/md/classes/LiquityClaimSPRewardsAction.md +0 -454
- package/docs/md/classes/LiquityClaimStakingRewardsAction.md +0 -454
- package/docs/md/classes/LiquityCloseAction.md +0 -454
- package/docs/md/classes/LiquityEthGainToTroveAction.md +0 -455
- package/docs/md/classes/LiquityOpenAction.md +0 -459
- package/docs/md/classes/LiquityPaybackAction.md +0 -456
- package/docs/md/classes/LiquityRatioTrigger.md +0 -453
- package/docs/md/classes/LiquityRedeemAction.md +0 -461
- package/docs/md/classes/LiquitySPDepositAction.md +0 -456
- package/docs/md/classes/LiquitySPWithdrawAction.md +0 -458
- package/docs/md/classes/LiquityStakeAction.md +0 -456
- package/docs/md/classes/LiquitySupplyAction.md +0 -456
- package/docs/md/classes/LiquityUnstakeAction.md +0 -458
- package/docs/md/classes/LiquityWithdrawAction.md +0 -456
- package/docs/md/classes/MStableClaimAction.md +0 -456
- package/docs/md/classes/MStableDepositAction.md +0 -461
- package/docs/md/classes/MStableWithdrawAction.md +0 -461
- package/docs/md/classes/MakerClaimAction.md +0 -455
- package/docs/md/classes/MakerFlashLoanAction.md +0 -455
- package/docs/md/classes/MakerFlashLoanPaybackAction.md +0 -454
- package/docs/md/classes/MakerGenerateAction.md +0 -456
- package/docs/md/classes/MakerGiveAction.md +0 -456
- package/docs/md/classes/MakerMergeAction.md +0 -455
- package/docs/md/classes/MakerOpenVaultAction.md +0 -454
- package/docs/md/classes/MakerPaybackAction.md +0 -456
- package/docs/md/classes/MakerRatioAction.md +0 -453
- package/docs/md/classes/MakerRatioCheckAction.md +0 -457
- package/docs/md/classes/MakerRatioTrigger.md +0 -453
- package/docs/md/classes/MakerSupplyAction.md +0 -457
- package/docs/md/classes/MakerWithdrawAction.md +0 -457
- package/docs/md/classes/PullTokenAction.md +0 -455
- package/docs/md/classes/RariDepositAction.md +0 -458
- package/docs/md/classes/RariWithdrawAction.md +0 -459
- package/docs/md/classes/Recipe.md +0 -195
- package/docs/md/classes/ReflexerGenerateAction.md +0 -455
- package/docs/md/classes/ReflexerNativeUniV2SaviourDepositAction.md +0 -455
- package/docs/md/classes/ReflexerNativeUniV2SaviourGetReservesAction.md +0 -454
- package/docs/md/classes/ReflexerNativeUniV2SaviourWithdrawAction.md +0 -455
- package/docs/md/classes/ReflexerOpenSafeAction.md +0 -453
- package/docs/md/classes/ReflexerPaybackAction.md +0 -455
- package/docs/md/classes/ReflexerRatioTrigger.md +0 -453
- package/docs/md/classes/ReflexerSupplyAction.md +0 -456
- package/docs/md/classes/ReflexerWithdrawAction.md +0 -456
- package/docs/md/classes/SellAction.md +0 -613
- package/docs/md/classes/SendTokenAction.md +0 -467
- package/docs/md/classes/SendTokenAndUnwrapAction.md +0 -455
- package/docs/md/classes/Strategy.md +0 -195
- package/docs/md/classes/SubInputsAction.md +0 -454
- package/docs/md/classes/SumInputsAction.md +0 -454
- package/docs/md/classes/TimestampTrigger.md +0 -451
- package/docs/md/classes/ToggleSubAction.md +0 -454
- package/docs/md/classes/TokenBalanceAction.md +0 -452
- package/docs/md/classes/TrailingStopTrigger.md +0 -453
- package/docs/md/classes/TransferNFTAction.md +0 -454
- package/docs/md/classes/UniV3CurrentTickTrigger.md +0 -452
- package/docs/md/classes/UniswapSupplyAction.md +0 -461
- package/docs/md/classes/UniswapV3CollectAction.md +0 -614
- package/docs/md/classes/UniswapV3CreatePoolAction.md +0 -611
- package/docs/md/classes/UniswapV3MintAction.md +0 -610
- package/docs/md/classes/UniswapV3SupplyAction.md +0 -63
- package/docs/md/classes/UniswapV3WithdrawAction.md +0 -618
- package/docs/md/classes/UniswapWithdrawAction.md +0 -460
- package/docs/md/classes/UnwrapEthAction.md +0 -600
- package/docs/md/classes/UpdateSubAction.md +0 -454
- package/docs/md/classes/WrapEthAction.md +0 -599
- package/docs/md/classes/YearnSupplyAction.md +0 -456
- package/docs/md/classes/YearnWithdrawAction.md +0 -456
- package/docs/md/modules.md +0 -814
package/test/Recipe.js
CHANGED
|
@@ -93,3 +93,100 @@ describe('Recipe', () => {
|
|
|
93
93
|
it('encodeForDsProxyCall', () => encodeForDsProxyCall(recipe));
|
|
94
94
|
})
|
|
95
95
|
})
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
describe('Recipe composition', () => {
|
|
99
|
+
const AbiCoder = require('web3-eth-abi');
|
|
100
|
+
const owner = '0x0000000000000000000000000000000000000001';
|
|
101
|
+
const otherOwner = '0x0000000000000000000000000000000000000002';
|
|
102
|
+
|
|
103
|
+
it('encodes ordered action data, IDs and mappings in the recipe tuple', () => {
|
|
104
|
+
const first = new dfs.Action('MockDeposit', owner, ['uint256'], ['7']);
|
|
105
|
+
const second = new dfs.Action('MockSwap', owner, ['uint256', 'address'], ['$1', otherOwner]);
|
|
106
|
+
const recipe = new dfs.Recipe('Mapped recipe', [first]);
|
|
107
|
+
assert.strictEqual(recipe.addAction(second), recipe);
|
|
108
|
+
const zeroWord = '0'.repeat(64);
|
|
109
|
+
// Expected values are independent of the actions' encoding methods.
|
|
110
|
+
const expected = [
|
|
111
|
+
'Mapped recipe',
|
|
112
|
+
[`0x${'7'.padStart(64, '0')}`, `0x${zeroWord}${'2'.padStart(64, '0')}`],
|
|
113
|
+
[`0x${zeroWord}`, `0x${zeroWord}`],
|
|
114
|
+
['0xf7012350', '0xe45f86c0'],
|
|
115
|
+
[[0], [1, 0]],
|
|
116
|
+
];
|
|
117
|
+
const signature = 'executeRecipe((string,bytes[],bytes32[],bytes4[],uint8[][]))';
|
|
118
|
+
const data = AbiCoder.encodeParameter('(string,bytes[],bytes32[],bytes4[],uint8[][])', expected);
|
|
119
|
+
assert.deepEqual(recipe.encodeForDsProxyCall(), [
|
|
120
|
+
dfs.getAddr('RecipeExecutor'),
|
|
121
|
+
AbiCoder.encodeFunctionSignature(signature) + data.slice(2),
|
|
122
|
+
]);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('sums ETH values exactly above JavaScript safe integer precision', async () => {
|
|
126
|
+
const recipe = new dfs.Recipe('ETH value', [
|
|
127
|
+
new dfs.actions.basic.WrapEthAction('1000000000000000000'),
|
|
128
|
+
new dfs.actions.basic.WrapEthAction('1'),
|
|
129
|
+
new dfs.actions.basic.WrapEthAction('99', false),
|
|
130
|
+
]);
|
|
131
|
+
assert.equal(await recipe.getEthValue(), '1000000000000000001');
|
|
132
|
+
assert.equal(await new dfs.Recipe('Empty').getEthValue(), '0');
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('deduplicates ERC-20 approvals by asset and owner and excludes native ETH', async () => {
|
|
136
|
+
const weth = getAssetInfo('WETH').address;
|
|
137
|
+
const dai = getAssetInfo('DAI').address;
|
|
138
|
+
const recipe = new dfs.Recipe('Approvals', [
|
|
139
|
+
new dfs.actions.basic.PullTokenAction(weth, owner, '1'),
|
|
140
|
+
new dfs.actions.basic.PullTokenAction(weth, owner, '2'),
|
|
141
|
+
new dfs.actions.basic.PullTokenAction(weth, otherOwner, '3'),
|
|
142
|
+
new dfs.actions.basic.PullTokenAction(dai, owner, '4'),
|
|
143
|
+
]);
|
|
144
|
+
const nativeAction = new dfs.Action('Native', owner, [], []);
|
|
145
|
+
nativeAction.getAssetsToApprove = async () => [{ asset: getAssetInfo('ETH').address, owner }];
|
|
146
|
+
recipe.addAction(nativeAction);
|
|
147
|
+
assert.deepEqual(await recipe.getAssetsToApprove(), [
|
|
148
|
+
{ asset: weth, owner, specialApproveLabel: undefined },
|
|
149
|
+
{ asset: weth, owner: otherOwner, specialApproveLabel: undefined },
|
|
150
|
+
{ asset: dai, owner, specialApproveLabel: undefined },
|
|
151
|
+
]);
|
|
152
|
+
assert.deepEqual(await new dfs.Recipe('Empty').getAssetsToApprove(), []);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('rejects non-action entries both at construction and when adding an action', () => {
|
|
156
|
+
assert.throws(() => new dfs.Recipe('Invalid', [{}]), TypeError, 'Supplied action does not inherit Action');
|
|
157
|
+
const recipe = new dfs.Recipe('Empty');
|
|
158
|
+
assert.throws(() => recipe.addAction({}), TypeError, 'Supplied action does not inherit Action');
|
|
159
|
+
assert.lengthOf(recipe.actions, 0);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
describe('Recipe validation and NFT approvals', () => {
|
|
165
|
+
const owner = '0x0000000000000000000000000000000000000001';
|
|
166
|
+
const collectionA = '0x0000000000000000000000000000000000000002';
|
|
167
|
+
const collectionB = '0x0000000000000000000000000000000000000003';
|
|
168
|
+
|
|
169
|
+
it('keeps different NFT contracts, token IDs and owners while removing exact duplicates', async () => {
|
|
170
|
+
const approvals = [
|
|
171
|
+
{ owner, nft: collectionA, tokenId: '1' },
|
|
172
|
+
{ owner, nft: collectionA, tokenId: '1' },
|
|
173
|
+
{ owner, nft: collectionB, tokenId: '1' },
|
|
174
|
+
{ owner, nft: collectionA, tokenId: '2' },
|
|
175
|
+
{ owner: collectionB, nft: collectionA, tokenId: '1' },
|
|
176
|
+
];
|
|
177
|
+
const actions = approvals.map(approval => {
|
|
178
|
+
const action = new dfs.Action('NFT', owner, [], []);
|
|
179
|
+
action.getAssetsToApprove = async () => [approval];
|
|
180
|
+
return action;
|
|
181
|
+
});
|
|
182
|
+
assert.deepEqual(await new dfs.Recipe('NFT approvals', actions).getAssetsToApprove(),
|
|
183
|
+
[approvals[0], ...approvals.slice(2)].map(approval => ({ ...approval, specialApproveLabel: undefined })));
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('reports empty recipes clearly for both regular and TxSaver encoding', () => {
|
|
187
|
+
const recipe = new dfs.Recipe('Empty');
|
|
188
|
+
assert.throws(() => recipe.encodeForDsProxyCall(), 'Cannot encode an empty recipe');
|
|
189
|
+
assert.throws(() => recipe.encodeForTxSaverCall({ shouldTakeFeeFromPosition: false }),
|
|
190
|
+
'Cannot encode an empty recipe');
|
|
191
|
+
});
|
|
192
|
+
});
|
package/tsconfig.json
CHANGED
package/umd/index.js
CHANGED
|
@@ -59,9 +59,6 @@ class Action {
|
|
|
59
59
|
* @param args
|
|
60
60
|
*/
|
|
61
61
|
constructor(name, contractAddress, paramTypes, args) {
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
*/
|
|
65
62
|
_classPrivateMethodInitSpec(this, _Action_brand);
|
|
66
63
|
_defineProperty(this, "contractAddress", void 0);
|
|
67
64
|
_defineProperty(this, "paramTypes", void 0);
|
|
@@ -89,11 +86,11 @@ class Action {
|
|
|
89
86
|
*/
|
|
90
87
|
_getArgumentMapping() {
|
|
91
88
|
return this.mappableArgs.map(arg => {
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
// eslint-disable-next-line
|
|
95
|
-
return parseInt(arg.substr(1));
|
|
89
|
+
if (Array.isArray(arg) && /\$\d+/.test(arg.toString())) {
|
|
90
|
+
throw TypeError('Input can\'t be mapped to arrays (tuples/structs). Specify `mappableArgs` array in constructor.');
|
|
96
91
|
}
|
|
92
|
+
var reference = _assertClassBrand(_Action_brand, this, _getReturnValueReference).call(this, arg);
|
|
93
|
+
if (reference !== undefined) return reference;
|
|
97
94
|
return 0;
|
|
98
95
|
});
|
|
99
96
|
}
|
|
@@ -139,7 +136,7 @@ class Action {
|
|
|
139
136
|
var paramTypeParsed = this._parseParamType(paramType, arg);
|
|
140
137
|
if (Array.isArray(arg)) return arg.map((_arg, i) => this._replaceWithPlaceholders(_arg, paramTypeParsed[i]));
|
|
141
138
|
if (typeof paramType === 'string') {
|
|
142
|
-
if (
|
|
139
|
+
if (_assertClassBrand(_Action_brand, this, _getReturnValueReference).call(this, arg) !== undefined) return _assertClassBrand(_Action_brand, this, _getPlaceholderForType).call(this, paramType);
|
|
143
140
|
if (new RegExp(/&\w+/).test(arg)) return _assertClassBrand(_Action_brand, this, _getPlaceholderForType).call(this, paramType);
|
|
144
141
|
}
|
|
145
142
|
return arg;
|
|
@@ -243,13 +240,24 @@ class Action {
|
|
|
243
240
|
});
|
|
244
241
|
}
|
|
245
242
|
}
|
|
243
|
+
function _getReturnValueReference(arg) {
|
|
244
|
+
if (typeof arg !== 'string' || !/\$\d+/.test(arg)) return undefined;
|
|
245
|
+
var index = Number(arg.slice(1));
|
|
246
|
+
if (!/^\$\d+$/.test(arg) || !Number.isSafeInteger(index) || index < 1) {
|
|
247
|
+
throw new Error("Invalid action return reference: ".concat(arg));
|
|
248
|
+
}
|
|
249
|
+
return index;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
*
|
|
253
|
+
*/
|
|
246
254
|
function _getArgumentMappingWithSlots(subSlots) {
|
|
247
255
|
return this.mappableArgs.map(arg => {
|
|
248
|
-
if (
|
|
249
|
-
|
|
250
|
-
// eslint-disable-next-line
|
|
251
|
-
return parseInt(arg.substr(1));
|
|
256
|
+
if (Array.isArray(arg) && /\$\d+/.test(arg.toString())) {
|
|
257
|
+
throw TypeError('Input can\'t be mapped to arrays (tuples/structs). Specify `mappableArgs` array in constructor.');
|
|
252
258
|
}
|
|
259
|
+
var reference = _assertClassBrand(_Action_brand, this, _getReturnValueReference).call(this, arg);
|
|
260
|
+
if (reference !== undefined) return reference;
|
|
253
261
|
|
|
254
262
|
// Handle SubSlots placeholder values in strategies
|
|
255
263
|
if (new RegExp(/&\w+/).test(arg)) {
|
|
@@ -1043,10 +1051,12 @@ class ActionWithL2 extends _Action__WEBPACK_IMPORTED_MODULE_1__.Action {
|
|
|
1043
1051
|
}
|
|
1044
1052
|
numberToBytes2(number) {
|
|
1045
1053
|
var hexNumber = number.toString(16);
|
|
1054
|
+
if (!/^[0-9a-f]{1,4}$/i.test(hexNumber)) throw new RangeError('Value must fit in an unsigned 2-byte integer');
|
|
1046
1055
|
return hexNumber.padStart(4, '0');
|
|
1047
1056
|
}
|
|
1048
1057
|
numberToBytes1(number) {
|
|
1049
1058
|
var hexNumber = number.toString(16);
|
|
1059
|
+
if (!/^[0-9a-f]{1,2}$/i.test(hexNumber)) throw new RangeError('Value must fit in an unsigned 1-byte integer');
|
|
1050
1060
|
return hexNumber.padStart(2, '0');
|
|
1051
1061
|
}
|
|
1052
1062
|
numberToBytes32(number) {
|
|
@@ -1233,7 +1243,7 @@ class Recipe {
|
|
|
1233
1243
|
for (var pairsPerAction of assetOwnerPairs) {
|
|
1234
1244
|
var _loop = function* _loop(pair) {
|
|
1235
1245
|
var isNft = !pair.asset;
|
|
1236
|
-
if (!uniqueAssetOwnerPairs.find(_pair => _pair.owner === pair.owner && (isNft ? _pair.tokenId === pair.tokenId : _pair.asset === pair.asset))) {
|
|
1246
|
+
if (!uniqueAssetOwnerPairs.find(_pair => _pair.owner === pair.owner && (isNft ? 'nft' in _pair && _pair.nft === pair.nft && _pair.tokenId === pair.tokenId : _pair.asset === pair.asset))) {
|
|
1237
1247
|
if (isNft) {
|
|
1238
1248
|
uniqueAssetOwnerPairs.push({
|
|
1239
1249
|
owner: pair.owner,
|
|
@@ -1295,6 +1305,7 @@ class Recipe {
|
|
|
1295
1305
|
}
|
|
1296
1306
|
}
|
|
1297
1307
|
function _encodeForCall() {
|
|
1308
|
+
if (this.actions.length === 0) throw new Error('Cannot encode an empty recipe');
|
|
1298
1309
|
var encoded = this.actions.map(action => action.encodeForRecipe());
|
|
1299
1310
|
var transposed = encoded[0].map((_, colIndex) => encoded.map(row => row[colIndex]));
|
|
1300
1311
|
var taskStruct = [this.name, ...transposed];
|