defi-kit 0.1.15 → 0.1.17
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/{chunk-MPJKCJ3K.mjs → chunk-QGWTWURU.mjs} +157 -84
- package/dist/chunk-QGWTWURU.mjs.map +1 -0
- package/dist/eth.d.ts +19 -1057
- package/dist/eth.js +166 -82
- package/dist/eth.js.map +1 -1
- package/dist/eth.mjs +4 -4
- package/dist/eth.mjs.map +1 -1
- package/dist/gor.d.ts +19 -1057
- package/dist/gor.js +1463 -48
- package/dist/gor.js.map +1 -1
- package/dist/gor.mjs +4 -4
- package/dist/gor.mjs.map +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{schema-055925a4.d.ts → schema-08b7d833.d.ts} +19 -19
- package/package.json +3 -2
- package/dist/chunk-MPJKCJ3K.mjs.map +0 -1
|
@@ -2737,14 +2737,20 @@ var Operator;
|
|
|
2737
2737
|
// node_modules/zodiac-roles-sdk/build/esm/sdk/src/permissions/utils.js
|
|
2738
2738
|
import { keccak256, ParamType, toUtf8Bytes } from "ethers/lib/utils";
|
|
2739
2739
|
var sighash = (signature) => keccak256(toUtf8Bytes(signature)).substring(0, 10);
|
|
2740
|
-
var
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2740
|
+
var coercePermission = (permission) => {
|
|
2741
|
+
if (isFunctionScoped(permission)) {
|
|
2742
|
+
return {
|
|
2743
|
+
targetAddress: permission.targetAddress.toLowerCase(),
|
|
2744
|
+
selector: "selector" in permission ? permission.selector.toLowerCase() : sighash(permission.signature),
|
|
2745
|
+
condition: typeof permission.condition === "function" ? permission.condition(ParamType.from("bytes")) : permission.condition,
|
|
2746
|
+
send: permission.send,
|
|
2747
|
+
delegatecall: permission.delegatecall
|
|
2748
|
+
};
|
|
2749
|
+
}
|
|
2750
|
+
return permission;
|
|
2751
|
+
};
|
|
2752
|
+
var isFunctionScoped = (permission) => {
|
|
2753
|
+
return "selector" in permission || "signature" in permission;
|
|
2748
2754
|
};
|
|
2749
2755
|
|
|
2750
2756
|
// node_modules/zodiac-roles-sdk/build/esm/sdk/src/permissions/authoring/conditions/allowances.js
|
|
@@ -2777,7 +2783,7 @@ var makeAllowFunction = (contract, name) => {
|
|
|
2777
2783
|
signature: functionFragment.format("sighash"),
|
|
2778
2784
|
condition: scopings.length > 0 ? c.calldataMatches(scopings, functionInputs)() : void 0
|
|
2779
2785
|
};
|
|
2780
|
-
return applyOptions(
|
|
2786
|
+
return applyOptions(coercePermission(presetFunction), options);
|
|
2781
2787
|
};
|
|
2782
2788
|
};
|
|
2783
2789
|
var applyOptions = (entry, options) => {
|
|
@@ -15565,39 +15571,50 @@ var filterPoolsByTokens2 = (sell, buy, pools) => {
|
|
|
15565
15571
|
// src/protocols/lido/index.ts
|
|
15566
15572
|
import { c as c11 } from "zodiac-roles-sdk";
|
|
15567
15573
|
var eth9 = {
|
|
15568
|
-
deposit: () =>
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
|
|
15585
|
-
|
|
15586
|
-
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
|
|
15596
|
-
|
|
15597
|
-
|
|
15598
|
-
|
|
15599
|
-
|
|
15600
|
-
|
|
15574
|
+
deposit: () => Object.assign(
|
|
15575
|
+
[
|
|
15576
|
+
...allowErc20Approve(
|
|
15577
|
+
[contracts.mainnet.lido.steth],
|
|
15578
|
+
[contracts.mainnet.lido.wsteth]
|
|
15579
|
+
),
|
|
15580
|
+
...allowErc20Approve(
|
|
15581
|
+
[contracts.mainnet.lido.steth, contracts.mainnet.lido.wsteth],
|
|
15582
|
+
[contracts.mainnet.lido.unsteth]
|
|
15583
|
+
),
|
|
15584
|
+
allow.mainnet.lido.wsteth.wrap(),
|
|
15585
|
+
allow.mainnet.lido.wsteth.unwrap(),
|
|
15586
|
+
allow.mainnet.lido.steth.submit(void 0, { send: true }),
|
|
15587
|
+
// Request stETH Withdrawal - Locks your stETH in the queue. In exchange you receive an NFT, that represents your position
|
|
15588
|
+
// in the queue
|
|
15589
|
+
allow.mainnet.lido.unsteth.requestWithdrawals(void 0, c11.avatar),
|
|
15590
|
+
// When the unstETH has no allowance over the owner's stETH
|
|
15591
|
+
allow.mainnet.lido.unsteth.requestWithdrawalsWithPermit(
|
|
15592
|
+
void 0,
|
|
15593
|
+
c11.avatar
|
|
15594
|
+
),
|
|
15595
|
+
// Request wstETH Withdrawal - Transfers the wstETH to the unstETH to be burned in exchange for stETH. Then it locks your stETH
|
|
15596
|
+
// in the queue. In exchange you receive an NFT, that represents your position in the queue
|
|
15597
|
+
allow.mainnet.lido.unsteth.requestWithdrawalsWstETH(
|
|
15598
|
+
void 0,
|
|
15599
|
+
c11.avatar
|
|
15600
|
+
),
|
|
15601
|
+
// When the unstETH has no allowance over the owner's wstETH
|
|
15602
|
+
allow.mainnet.lido.unsteth.requestWithdrawalsWstETHWithPermit(
|
|
15603
|
+
void 0,
|
|
15604
|
+
c11.avatar
|
|
15605
|
+
),
|
|
15606
|
+
// Claim ETH - Once the request is finalized by the oracle report and becomes claimable,
|
|
15607
|
+
// this function claims your ether and burns the NFT
|
|
15608
|
+
allow.mainnet.lido.unsteth.claimWithdrawal(),
|
|
15609
|
+
allow.mainnet.lido.unsteth.claimWithdrawals()
|
|
15610
|
+
],
|
|
15611
|
+
{
|
|
15612
|
+
annotation: {
|
|
15613
|
+
uri: "https://kit.karpatkey.com/permissions/eth/lido/deposit",
|
|
15614
|
+
schema: "https://kit.karpatkey.com/api/v1/openapi.json"
|
|
15615
|
+
}
|
|
15616
|
+
}
|
|
15617
|
+
)
|
|
15601
15618
|
};
|
|
15602
15619
|
|
|
15603
15620
|
// src/protocols/spark/_info.ts
|
|
@@ -15821,23 +15838,60 @@ var eth10 = {
|
|
|
15821
15838
|
// },
|
|
15822
15839
|
};
|
|
15823
15840
|
|
|
15824
|
-
// src/protocols/
|
|
15825
|
-
var
|
|
15826
|
-
|
|
15827
|
-
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15841
|
+
// src/protocols/annotate.ts
|
|
15842
|
+
var annotate = (actionFunction, path) => {
|
|
15843
|
+
const annotated = (params) => {
|
|
15844
|
+
const result = actionFunction(params);
|
|
15845
|
+
const queryString = new URLSearchParams(params).toString();
|
|
15846
|
+
const joinedPath = path.join("/");
|
|
15847
|
+
Object.assign(result, {
|
|
15848
|
+
annotation: {
|
|
15849
|
+
uri: `https://kit.karpatkey.com/permissions/${joinedPath}?${queryString}`,
|
|
15850
|
+
schema: "https://kit.karpatkey.com/api/v1/openapi.json"
|
|
15851
|
+
}
|
|
15852
|
+
});
|
|
15853
|
+
return result;
|
|
15854
|
+
};
|
|
15855
|
+
return annotated;
|
|
15836
15856
|
};
|
|
15837
|
-
var
|
|
15838
|
-
|
|
15857
|
+
var annotateAll = (actions, chainPrefix) => {
|
|
15858
|
+
const annotated = {};
|
|
15859
|
+
for (const [protocolKey, protocolActions] of Object.entries(actions)) {
|
|
15860
|
+
annotated[protocolKey] = {};
|
|
15861
|
+
for (const [actionKey, action] of Object.entries(protocolActions)) {
|
|
15862
|
+
annotated[protocolKey][actionKey] = annotate(action, [
|
|
15863
|
+
chainPrefix,
|
|
15864
|
+
protocolKey,
|
|
15865
|
+
actionKey
|
|
15866
|
+
]);
|
|
15867
|
+
}
|
|
15868
|
+
}
|
|
15869
|
+
return annotated;
|
|
15839
15870
|
};
|
|
15840
15871
|
|
|
15872
|
+
// src/protocols/index.ts
|
|
15873
|
+
var eth11 = annotateAll(
|
|
15874
|
+
{
|
|
15875
|
+
aave_v2: eth,
|
|
15876
|
+
aave_v3: eth2,
|
|
15877
|
+
aura: eth4,
|
|
15878
|
+
balancer: eth3,
|
|
15879
|
+
compound_v2: eth5,
|
|
15880
|
+
compound_v3: eth6,
|
|
15881
|
+
convex: eth7,
|
|
15882
|
+
curve: eth8,
|
|
15883
|
+
lido: eth9,
|
|
15884
|
+
spark: eth10
|
|
15885
|
+
},
|
|
15886
|
+
"eth"
|
|
15887
|
+
);
|
|
15888
|
+
var gor2 = annotateAll(
|
|
15889
|
+
{
|
|
15890
|
+
cowswap: gor
|
|
15891
|
+
},
|
|
15892
|
+
"gor"
|
|
15893
|
+
);
|
|
15894
|
+
|
|
15841
15895
|
// src/protocols/aave/v2/schema.ts
|
|
15842
15896
|
import { z } from "zod";
|
|
15843
15897
|
var zToken = z.enum([
|
|
@@ -16087,40 +16141,54 @@ var gor4 = {
|
|
|
16087
16141
|
|
|
16088
16142
|
// src/apply.ts
|
|
16089
16143
|
import {
|
|
16090
|
-
processPermissions
|
|
16144
|
+
processPermissions,
|
|
16091
16145
|
checkIntegrity,
|
|
16092
|
-
applyTargets
|
|
16146
|
+
applyTargets,
|
|
16147
|
+
applyAnnotations
|
|
16093
16148
|
} from "zodiac-roles-sdk";
|
|
16094
16149
|
var createApply = (chainId) => {
|
|
16095
16150
|
return async function apply(roleKey, permissions, options) {
|
|
16096
|
-
const targets =
|
|
16151
|
+
const { targets, annotations } = processPermissions(permissions);
|
|
16097
16152
|
checkIntegrity(targets);
|
|
16153
|
+
let rolesModCalls = [];
|
|
16154
|
+
let posterCalls = [];
|
|
16098
16155
|
try {
|
|
16099
|
-
|
|
16100
|
-
|
|
16101
|
-
|
|
16102
|
-
|
|
16103
|
-
|
|
16156
|
+
rolesModCalls = await applyTargets(roleKey, targets, {
|
|
16157
|
+
...options,
|
|
16158
|
+
chainId
|
|
16159
|
+
});
|
|
16160
|
+
posterCalls = await applyAnnotations(roleKey, annotations, {
|
|
16161
|
+
...options,
|
|
16162
|
+
chainId
|
|
16163
|
+
});
|
|
16104
16164
|
} catch (e) {
|
|
16105
16165
|
if (e instanceof Error && e.message.indexOf("not found") !== -1) {
|
|
16106
16166
|
throw new NotFoundError(e.message);
|
|
16107
16167
|
}
|
|
16108
16168
|
throw e;
|
|
16109
16169
|
}
|
|
16170
|
+
const value = 0n;
|
|
16171
|
+
return [
|
|
16172
|
+
...rolesModCalls.map((data) => ({
|
|
16173
|
+
to: options.address,
|
|
16174
|
+
data,
|
|
16175
|
+
value
|
|
16176
|
+
})),
|
|
16177
|
+
...posterCalls.map((data) => ({
|
|
16178
|
+
to: POSTER_ADDRESS,
|
|
16179
|
+
data,
|
|
16180
|
+
value
|
|
16181
|
+
}))
|
|
16182
|
+
];
|
|
16110
16183
|
};
|
|
16111
16184
|
};
|
|
16185
|
+
var POSTER_ADDRESS = "0x000000000000cd17345801aa8147b8D3950260FF";
|
|
16112
16186
|
|
|
16113
|
-
// src/
|
|
16187
|
+
// src/export.ts
|
|
16114
16188
|
import { Interface } from "ethers/lib/utils";
|
|
16115
|
-
import { rolesAbi } from "zodiac-roles-sdk";
|
|
16116
|
-
var
|
|
16117
|
-
return function
|
|
16118
|
-
const transactions = calls.map((data) => ({
|
|
16119
|
-
to: address,
|
|
16120
|
-
value: "0",
|
|
16121
|
-
data,
|
|
16122
|
-
...(meta == null ? void 0 : meta.includeAbi) ? getAbiInfo(data) : {}
|
|
16123
|
-
}));
|
|
16189
|
+
import { posterAbi, rolesAbi } from "zodiac-roles-sdk";
|
|
16190
|
+
var createExportToSafeTransactionBuilder = (chainId) => {
|
|
16191
|
+
return function exportToSafeTransactionBuilder(transactions, meta) {
|
|
16124
16192
|
return {
|
|
16125
16193
|
version: "1.0",
|
|
16126
16194
|
chainId: chainId.toString(10),
|
|
@@ -16130,18 +16198,23 @@ var createExportJson = (chainId) => {
|
|
|
16130
16198
|
description: (meta == null ? void 0 : meta.description) || "",
|
|
16131
16199
|
txBuilderVersion: "1.16.2"
|
|
16132
16200
|
},
|
|
16133
|
-
transactions
|
|
16201
|
+
transactions: transactions.map((tx) => ({
|
|
16202
|
+
...tx,
|
|
16203
|
+
value: tx.value.toString(10),
|
|
16204
|
+
...getAbiInfo(tx)
|
|
16205
|
+
}))
|
|
16134
16206
|
};
|
|
16135
16207
|
};
|
|
16136
16208
|
};
|
|
16137
|
-
var
|
|
16138
|
-
|
|
16139
|
-
const
|
|
16140
|
-
const
|
|
16209
|
+
var getAbiInfo = (transaction) => {
|
|
16210
|
+
const abi = transaction.to === POSTER_ADDRESS ? posterAbi : rolesAbi;
|
|
16211
|
+
const iface = new Interface(abi);
|
|
16212
|
+
const selector = transaction.data.slice(0, 10);
|
|
16213
|
+
const functionFragment = iface.getFunction(selector);
|
|
16141
16214
|
if (!functionFragment) {
|
|
16142
|
-
throw new Error(`Could not find a
|
|
16215
|
+
throw new Error(`Could not find a function with selector ${selector}`);
|
|
16143
16216
|
}
|
|
16144
|
-
const contractMethod =
|
|
16217
|
+
const contractMethod = abi.find(
|
|
16145
16218
|
(fragment) => fragment.type === "function" && fragment.name === functionFragment.name
|
|
16146
16219
|
);
|
|
16147
16220
|
if (!contractMethod) {
|
|
@@ -16150,7 +16223,7 @@ var getAbiInfo = (data) => {
|
|
|
16150
16223
|
);
|
|
16151
16224
|
}
|
|
16152
16225
|
const contractInputsValues = asObject(
|
|
16153
|
-
|
|
16226
|
+
iface.decodeFunctionData(functionFragment, transaction.data)
|
|
16154
16227
|
);
|
|
16155
16228
|
return {
|
|
16156
16229
|
contractMethod,
|
|
@@ -16173,6 +16246,6 @@ export {
|
|
|
16173
16246
|
eth23 as eth2,
|
|
16174
16247
|
gor4 as gor2,
|
|
16175
16248
|
createApply,
|
|
16176
|
-
|
|
16249
|
+
createExportToSafeTransactionBuilder
|
|
16177
16250
|
};
|
|
16178
|
-
//# sourceMappingURL=chunk-
|
|
16251
|
+
//# sourceMappingURL=chunk-QGWTWURU.mjs.map
|