@defisaver/ethena-sdk 0.0.5 → 0.0.6
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/cjs/config/contracts.d.ts +181 -0
- package/cjs/config/contracts.js +72 -0
- package/cjs/constants/index.d.ts +3 -0
- package/cjs/constants/index.js +4 -1
- package/cjs/contracts.d.ts +696 -0
- package/cjs/contracts.js +80 -0
- package/cjs/execution/index.d.ts +2 -0
- package/cjs/execution/index.js +15 -0
- package/cjs/execution/morpho.d.ts +2 -0
- package/cjs/execution/morpho.js +56 -0
- package/cjs/index.d.ts +3 -1
- package/cjs/index.js +5 -1
- package/cjs/safe/index.d.ts +6 -0
- package/cjs/safe/index.js +80 -0
- package/cjs/services/viem.d.ts +31 -31
- package/cjs/types/execution.d.ts +9 -0
- package/cjs/types/execution.js +8 -0
- package/cjs/types/index.d.ts +2 -0
- package/cjs/types/index.js +2 -0
- package/cjs/types/safe.d.ts +5 -0
- package/cjs/types/safe.js +2 -0
- package/esm/config/contracts.d.ts +181 -0
- package/esm/config/contracts.js +69 -0
- package/esm/constants/index.d.ts +3 -0
- package/esm/constants/index.js +3 -0
- package/esm/contracts.d.ts +696 -0
- package/esm/contracts.js +37 -0
- package/esm/execution/index.d.ts +2 -0
- package/esm/execution/index.js +11 -0
- package/esm/execution/morpho.d.ts +2 -0
- package/esm/execution/morpho.js +52 -0
- package/esm/index.d.ts +3 -1
- package/esm/index.js +3 -1
- package/esm/safe/index.d.ts +6 -0
- package/esm/safe/index.js +75 -0
- package/esm/services/viem.d.ts +31 -31
- package/esm/types/execution.d.ts +9 -0
- package/esm/types/execution.js +5 -0
- package/esm/types/index.d.ts +2 -0
- package/esm/types/index.js +2 -0
- package/esm/types/safe.d.ts +5 -0
- package/esm/types/safe.js +1 -0
- package/package.json +2 -1
- package/src/config/contracts.ts +72 -0
- package/src/constants/index.ts +4 -1
- package/src/contracts.ts +57 -0
- package/src/execution/index.ts +12 -0
- package/src/execution/morpho.ts +47 -0
- package/src/index.ts +4 -0
- package/src/safe/index.ts +99 -0
- package/src/types/execution.ts +11 -0
- package/src/types/index.ts +3 -1
- package/src/types/safe.ts +5 -0
package/cjs/contracts.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getSafeFallbackHandlerAddress = exports.getSafeFactoryAddress = exports.getSafeWalletSingletonAddress = exports.getSafeWalletContract = exports.MorphoManagerContract = exports.SafeFactoryContract = exports.Safe130Contract = exports.createContractFromConfigFunc = exports.getConfigContractAbi = exports.getConfigContractAddress = void 0;
|
|
37
|
+
const viem_1 = require("viem");
|
|
38
|
+
const positions_sdk_1 = require("@defisaver/positions-sdk");
|
|
39
|
+
const configRaw = __importStar(require("./config/contracts"));
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
const contractConfig = configRaw;
|
|
42
|
+
const getConfigContractAddress = (name, network) => {
|
|
43
|
+
const networkData = contractConfig[name].networks[network];
|
|
44
|
+
const latestAddress = (networkData === null || networkData === void 0 ? void 0 : networkData.address) || '';
|
|
45
|
+
return latestAddress;
|
|
46
|
+
};
|
|
47
|
+
exports.getConfigContractAddress = getConfigContractAddress;
|
|
48
|
+
const getConfigContractAbi = (name) => {
|
|
49
|
+
const latestAbi = contractConfig[name].abi;
|
|
50
|
+
return latestAbi;
|
|
51
|
+
};
|
|
52
|
+
exports.getConfigContractAbi = getConfigContractAbi;
|
|
53
|
+
const createContractFromConfigFunc = (name, _address) => (client, network) => {
|
|
54
|
+
const address = (_address || (0, exports.getConfigContractAddress)(name, network));
|
|
55
|
+
const abi = (0, exports.getConfigContractAbi)(name);
|
|
56
|
+
return (0, viem_1.getContract)({
|
|
57
|
+
address,
|
|
58
|
+
abi,
|
|
59
|
+
client,
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
exports.createContractFromConfigFunc = createContractFromConfigFunc;
|
|
63
|
+
exports.Safe130Contract = (0, exports.createContractFromConfigFunc)('Safe130');
|
|
64
|
+
exports.SafeFactoryContract = (0, exports.createContractFromConfigFunc)('SafeProxyFactory130');
|
|
65
|
+
exports.MorphoManagerContract = (0, exports.createContractFromConfigFunc)('MorphoManager');
|
|
66
|
+
const getSafeWalletContract = (client, address) => {
|
|
67
|
+
const abi = (0, exports.getConfigContractAbi)('Safe130');
|
|
68
|
+
return (0, viem_1.getContract)({
|
|
69
|
+
address,
|
|
70
|
+
abi,
|
|
71
|
+
client,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
exports.getSafeWalletContract = getSafeWalletContract;
|
|
75
|
+
const getSafeWalletSingletonAddress = (network) => (0, exports.getConfigContractAddress)('Safe130', network || positions_sdk_1.NetworkNumber.Eth);
|
|
76
|
+
exports.getSafeWalletSingletonAddress = getSafeWalletSingletonAddress;
|
|
77
|
+
const getSafeFactoryAddress = (network) => (0, exports.getConfigContractAddress)('SafeProxyFactory130', network || positions_sdk_1.NetworkNumber.Eth);
|
|
78
|
+
exports.getSafeFactoryAddress = getSafeFactoryAddress;
|
|
79
|
+
const getSafeFallbackHandlerAddress = (network) => (0, exports.getConfigContractAddress)('SafeFallbackHandler130', network || positions_sdk_1.NetworkNumber.Eth);
|
|
80
|
+
exports.getSafeFallbackHandlerAddress = getSafeFallbackHandlerAddress;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRequests = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const morpho_1 = require("./morpho");
|
|
6
|
+
const getRequests = (market) => {
|
|
7
|
+
switch (market) {
|
|
8
|
+
case types_1.SupportedMarkets.MorphoBlueSUSDeUSDtb_915: {
|
|
9
|
+
return (0, morpho_1.getMorphoRequests)();
|
|
10
|
+
}
|
|
11
|
+
default:
|
|
12
|
+
throw new Error(`Unsupported market: ${market}`);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.getRequests = getRequests;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getMorphoRequests = void 0;
|
|
13
|
+
const contracts_1 = require("../contracts");
|
|
14
|
+
const viem_1 = require("../services/viem");
|
|
15
|
+
const types_1 = require("../types");
|
|
16
|
+
const safe_1 = require("../safe");
|
|
17
|
+
const morphoAuthSignature = {
|
|
18
|
+
type: types_1.RequestType.Signature,
|
|
19
|
+
getParams: (rpcUrl, network, userAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
const provider = (0, viem_1.getViemProvider)(rpcUrl, network);
|
|
21
|
+
const managerContract = (0, contracts_1.MorphoManagerContract)(provider, network);
|
|
22
|
+
const nonce = yield managerContract.read.nonce([userAddress]);
|
|
23
|
+
const tenMinutes = 1000 * 60 * 10;
|
|
24
|
+
const deadline = Date.now() + tenMinutes;
|
|
25
|
+
const safeAddress = yield (0, safe_1.predictSafeAddress)(userAddress, rpcUrl, network);
|
|
26
|
+
return {
|
|
27
|
+
types: {
|
|
28
|
+
EIP712Domain: [
|
|
29
|
+
{ name: 'verifyingContract', type: 'address' },
|
|
30
|
+
{ name: 'chainId', type: 'uint256' },
|
|
31
|
+
],
|
|
32
|
+
Authorization: [
|
|
33
|
+
{ name: 'authorizer', type: 'address' },
|
|
34
|
+
{ name: 'authorized', type: 'address' },
|
|
35
|
+
{ name: 'isAuthorized', type: 'bool' },
|
|
36
|
+
{ name: 'nonce', type: 'uint256' },
|
|
37
|
+
{ name: 'deadline', type: 'uint256' },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
domain: {
|
|
41
|
+
chainId: network,
|
|
42
|
+
verifyingContract: managerContract.address,
|
|
43
|
+
},
|
|
44
|
+
primaryType: 'Authorization',
|
|
45
|
+
message: {
|
|
46
|
+
authorizer: userAddress,
|
|
47
|
+
authorized: safeAddress,
|
|
48
|
+
isAuthorized: true,
|
|
49
|
+
nonce: +nonce.toString(),
|
|
50
|
+
deadline,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}),
|
|
54
|
+
};
|
|
55
|
+
const getMorphoRequests = () => [morphoAuthSignature];
|
|
56
|
+
exports.getMorphoRequests = getMorphoRequests;
|
package/cjs/index.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ import * as positionData from './positionData';
|
|
|
3
3
|
import * as marketData from './marketData';
|
|
4
4
|
import * as exchange from './exchange';
|
|
5
5
|
import * as constants from './constants';
|
|
6
|
+
import * as safe from './safe';
|
|
7
|
+
import * as execution from './execution';
|
|
6
8
|
export * from './types';
|
|
7
|
-
export { positionData, marketData, exchange, constants, };
|
|
9
|
+
export { positionData, marketData, exchange, constants, safe, execution, };
|
package/cjs/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.constants = exports.exchange = exports.marketData = exports.positionData = void 0;
|
|
39
|
+
exports.execution = exports.safe = exports.constants = exports.exchange = exports.marketData = exports.positionData = void 0;
|
|
40
40
|
require("./setup");
|
|
41
41
|
const positionData = __importStar(require("./positionData"));
|
|
42
42
|
exports.positionData = positionData;
|
|
@@ -46,4 +46,8 @@ const exchange = __importStar(require("./exchange"));
|
|
|
46
46
|
exports.exchange = exchange;
|
|
47
47
|
const constants = __importStar(require("./constants"));
|
|
48
48
|
exports.constants = constants;
|
|
49
|
+
const safe = __importStar(require("./safe"));
|
|
50
|
+
exports.safe = safe;
|
|
51
|
+
const execution = __importStar(require("./execution"));
|
|
52
|
+
exports.execution = execution;
|
|
49
53
|
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NetworkNumber } from '@defisaver/positions-sdk';
|
|
2
|
+
export declare const getSafeWallets: (userAddress: string, network: NetworkNumber) => Promise<{
|
|
3
|
+
success: boolean;
|
|
4
|
+
wallets: string[];
|
|
5
|
+
}>;
|
|
6
|
+
export declare const predictSafeAddress: (owner: string, rpcUrl: string, network: NetworkNumber) => Promise<string>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.predictSafeAddress = exports.getSafeWallets = void 0;
|
|
13
|
+
const viem_1 = require("viem");
|
|
14
|
+
const constants_1 = require("../constants");
|
|
15
|
+
const contracts_1 = require("../contracts");
|
|
16
|
+
const viem_2 = require("../services/viem");
|
|
17
|
+
const getSafeWallets = (userAddress, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
try {
|
|
19
|
+
const res = yield fetch(`${constants_1.SAFE_API_URL}/safe/all-wallets?network=${network}&account=${userAddress}`);
|
|
20
|
+
const wallets = yield res.json();
|
|
21
|
+
const oneOneWallets = wallets
|
|
22
|
+
.filter((wallet) => wallet.type === 'Safe' && (wallet.owners || []).length === 1)
|
|
23
|
+
.map((wallet) => wallet.address);
|
|
24
|
+
return { success: true, wallets: oneOneWallets };
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
return { success: false, wallets: [] };
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
exports.getSafeWallets = getSafeWallets;
|
|
31
|
+
const getSafeSetupParams = (owners, threshold, network) => [
|
|
32
|
+
owners,
|
|
33
|
+
BigInt(threshold),
|
|
34
|
+
constants_1.ZERO_ADDRESS,
|
|
35
|
+
'0x',
|
|
36
|
+
(0, contracts_1.getSafeFallbackHandlerAddress)(network),
|
|
37
|
+
constants_1.ZERO_ADDRESS,
|
|
38
|
+
BigInt(0),
|
|
39
|
+
constants_1.SAFE_REFUND_RECEIVER,
|
|
40
|
+
];
|
|
41
|
+
const _predictSafeAddress = (rpcUrl, network, setupArgs, saltNonce) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
const provider = (0, viem_2.getViemProvider)(rpcUrl, network);
|
|
43
|
+
const safeProxyFactoryAddress = (0, contracts_1.getSafeFactoryAddress)(network);
|
|
44
|
+
const safeProxyFactoryContract = (0, contracts_1.SafeFactoryContract)(provider, network);
|
|
45
|
+
const masterCopyAddress = (0, contracts_1.getSafeWalletSingletonAddress)(network);
|
|
46
|
+
const proxyCreationCode = yield safeProxyFactoryContract.read.proxyCreationCode();
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
const initCodeHash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(['bytes', 'bytes'], [proxyCreationCode, masterCopyAddress.slice(2).padStart(64, '0')]), 'bytes');
|
|
49
|
+
const salt = (0, viem_1.keccak256)((0, viem_1.encodePacked)(['bytes', 'uint256'], [(0, viem_1.keccak256)(setupArgs), BigInt(saltNonce)]));
|
|
50
|
+
return (0, viem_1.getCreate2Address)({
|
|
51
|
+
bytecodeHash: initCodeHash,
|
|
52
|
+
from: safeProxyFactoryAddress,
|
|
53
|
+
salt,
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
const predictSafeAddress = (owner, rpcUrl, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
+
const provider = (0, viem_2.getViemProvider)(rpcUrl, network);
|
|
58
|
+
const threshold = 1;
|
|
59
|
+
const owners = [owner];
|
|
60
|
+
const setupParams = getSafeSetupParams(owners, threshold, network);
|
|
61
|
+
const setupParamsEncoded = (0, viem_1.encodeFunctionData)({
|
|
62
|
+
abi: (0, contracts_1.getConfigContractAbi)('Safe130'),
|
|
63
|
+
functionName: 'setup',
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
args: setupParams,
|
|
66
|
+
});
|
|
67
|
+
const oneOfOneWalletsCount = (yield (0, exports.getSafeWallets)(owner, network)).wallets.length;
|
|
68
|
+
const failAfter = 10;
|
|
69
|
+
for (let nonce = oneOfOneWalletsCount + 1; nonce < oneOfOneWalletsCount + failAfter + 1; nonce += 1) {
|
|
70
|
+
const salt = `${constants_1.SALT_PREFIX}${nonce}`;
|
|
71
|
+
const predictedAddr = yield _predictSafeAddress(rpcUrl, network, setupParamsEncoded, salt);
|
|
72
|
+
const bytecode = yield provider.getCode({ address: predictedAddr });
|
|
73
|
+
if (!bytecode) {
|
|
74
|
+
// safe does not exist
|
|
75
|
+
return predictedAddr;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return '';
|
|
79
|
+
});
|
|
80
|
+
exports.predictSafeAddress = predictSafeAddress;
|
package/cjs/services/viem.d.ts
CHANGED
|
@@ -826,12 +826,12 @@ export declare const getViemProvider: (rpcUrl: string, network: NetworkNumber, o
|
|
|
826
826
|
withdrawals?: import("viem").Withdrawal[] | undefined | undefined;
|
|
827
827
|
withdrawalsRoot?: `0x${string}` | undefined;
|
|
828
828
|
transactions: includeTransactions extends true ? ({
|
|
829
|
-
type: "legacy";
|
|
830
829
|
to: import("viem").Address | null;
|
|
830
|
+
value: bigint;
|
|
831
|
+
nonce: number;
|
|
832
|
+
type: "legacy";
|
|
831
833
|
from: import("viem").Address;
|
|
832
834
|
gas: bigint;
|
|
833
|
-
nonce: number;
|
|
834
|
-
value: bigint;
|
|
835
835
|
maxFeePerBlobGas?: undefined | undefined;
|
|
836
836
|
gasPrice: bigint;
|
|
837
837
|
maxFeePerGas?: undefined | undefined;
|
|
@@ -851,12 +851,12 @@ export declare const getViemProvider: (rpcUrl: string, network: NetworkNumber, o
|
|
|
851
851
|
blockHash: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : `0x${string}` : never : never;
|
|
852
852
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
|
|
853
853
|
} | {
|
|
854
|
-
type: "eip2930";
|
|
855
854
|
to: import("viem").Address | null;
|
|
855
|
+
value: bigint;
|
|
856
|
+
nonce: number;
|
|
857
|
+
type: "eip2930";
|
|
856
858
|
from: import("viem").Address;
|
|
857
859
|
gas: bigint;
|
|
858
|
-
nonce: number;
|
|
859
|
-
value: bigint;
|
|
860
860
|
maxFeePerBlobGas?: undefined | undefined;
|
|
861
861
|
gasPrice: bigint;
|
|
862
862
|
maxFeePerGas?: undefined | undefined;
|
|
@@ -876,12 +876,12 @@ export declare const getViemProvider: (rpcUrl: string, network: NetworkNumber, o
|
|
|
876
876
|
blockHash: (blockTag extends "pending" ? true : false) extends infer T_4 ? T_4 extends (blockTag extends "pending" ? true : false) ? T_4 extends true ? null : `0x${string}` : never : never;
|
|
877
877
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_5 ? T_5 extends (blockTag extends "pending" ? true : false) ? T_5 extends true ? null : number : never : never;
|
|
878
878
|
} | {
|
|
879
|
-
type: "eip1559";
|
|
880
879
|
to: import("viem").Address | null;
|
|
880
|
+
value: bigint;
|
|
881
|
+
nonce: number;
|
|
882
|
+
type: "eip1559";
|
|
881
883
|
from: import("viem").Address;
|
|
882
884
|
gas: bigint;
|
|
883
|
-
nonce: number;
|
|
884
|
-
value: bigint;
|
|
885
885
|
maxFeePerBlobGas?: undefined | undefined;
|
|
886
886
|
gasPrice?: undefined | undefined;
|
|
887
887
|
maxFeePerGas: bigint;
|
|
@@ -901,12 +901,12 @@ export declare const getViemProvider: (rpcUrl: string, network: NetworkNumber, o
|
|
|
901
901
|
blockHash: (blockTag extends "pending" ? true : false) extends infer T_7 ? T_7 extends (blockTag extends "pending" ? true : false) ? T_7 extends true ? null : `0x${string}` : never : never;
|
|
902
902
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_8 ? T_8 extends (blockTag extends "pending" ? true : false) ? T_8 extends true ? null : number : never : never;
|
|
903
903
|
} | {
|
|
904
|
-
type: "eip4844";
|
|
905
904
|
to: import("viem").Address | null;
|
|
905
|
+
value: bigint;
|
|
906
|
+
nonce: number;
|
|
907
|
+
type: "eip4844";
|
|
906
908
|
from: import("viem").Address;
|
|
907
909
|
gas: bigint;
|
|
908
|
-
nonce: number;
|
|
909
|
-
value: bigint;
|
|
910
910
|
maxFeePerBlobGas: bigint;
|
|
911
911
|
gasPrice?: undefined | undefined;
|
|
912
912
|
maxFeePerGas: bigint;
|
|
@@ -926,12 +926,12 @@ export declare const getViemProvider: (rpcUrl: string, network: NetworkNumber, o
|
|
|
926
926
|
blockHash: (blockTag extends "pending" ? true : false) extends infer T_10 ? T_10 extends (blockTag extends "pending" ? true : false) ? T_10 extends true ? null : `0x${string}` : never : never;
|
|
927
927
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_11 ? T_11 extends (blockTag extends "pending" ? true : false) ? T_11 extends true ? null : number : never : never;
|
|
928
928
|
} | {
|
|
929
|
-
type: "eip7702";
|
|
930
929
|
to: import("viem").Address | null;
|
|
930
|
+
value: bigint;
|
|
931
|
+
nonce: number;
|
|
932
|
+
type: "eip7702";
|
|
931
933
|
from: import("viem").Address;
|
|
932
934
|
gas: bigint;
|
|
933
|
-
nonce: number;
|
|
934
|
-
value: bigint;
|
|
935
935
|
maxFeePerBlobGas?: undefined | undefined;
|
|
936
936
|
gasPrice?: undefined | undefined;
|
|
937
937
|
maxFeePerGas: bigint;
|
|
@@ -976,12 +976,12 @@ export declare const getViemProvider: (rpcUrl: string, network: NetworkNumber, o
|
|
|
976
976
|
} | undefined) => Promise<import("viem").EstimateMaxPriorityFeePerGasReturnType>;
|
|
977
977
|
getStorageAt: (args: import("viem").GetStorageAtParameters) => Promise<import("viem").GetStorageAtReturnType>;
|
|
978
978
|
getTransaction: <blockTag extends import("viem").BlockTag = "latest">(args: import("viem").GetTransactionParameters<blockTag>) => Promise<{
|
|
979
|
-
type: "legacy";
|
|
980
979
|
to: import("viem").Address | null;
|
|
980
|
+
value: bigint;
|
|
981
|
+
nonce: number;
|
|
982
|
+
type: "legacy";
|
|
981
983
|
from: import("viem").Address;
|
|
982
984
|
gas: bigint;
|
|
983
|
-
nonce: number;
|
|
984
|
-
value: bigint;
|
|
985
985
|
maxFeePerBlobGas?: undefined | undefined;
|
|
986
986
|
gasPrice: bigint;
|
|
987
987
|
maxFeePerGas?: undefined | undefined;
|
|
@@ -1001,12 +1001,12 @@ export declare const getViemProvider: (rpcUrl: string, network: NetworkNumber, o
|
|
|
1001
1001
|
blockHash: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : `0x${string}` : never : never;
|
|
1002
1002
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
|
|
1003
1003
|
} | {
|
|
1004
|
-
type: "eip2930";
|
|
1005
1004
|
to: import("viem").Address | null;
|
|
1005
|
+
value: bigint;
|
|
1006
|
+
nonce: number;
|
|
1007
|
+
type: "eip2930";
|
|
1006
1008
|
from: import("viem").Address;
|
|
1007
1009
|
gas: bigint;
|
|
1008
|
-
nonce: number;
|
|
1009
|
-
value: bigint;
|
|
1010
1010
|
maxFeePerBlobGas?: undefined | undefined;
|
|
1011
1011
|
gasPrice: bigint;
|
|
1012
1012
|
maxFeePerGas?: undefined | undefined;
|
|
@@ -1026,12 +1026,12 @@ export declare const getViemProvider: (rpcUrl: string, network: NetworkNumber, o
|
|
|
1026
1026
|
blockHash: (blockTag extends "pending" ? true : false) extends infer T_4 ? T_4 extends (blockTag extends "pending" ? true : false) ? T_4 extends true ? null : `0x${string}` : never : never;
|
|
1027
1027
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_5 ? T_5 extends (blockTag extends "pending" ? true : false) ? T_5 extends true ? null : number : never : never;
|
|
1028
1028
|
} | {
|
|
1029
|
-
type: "eip1559";
|
|
1030
1029
|
to: import("viem").Address | null;
|
|
1030
|
+
value: bigint;
|
|
1031
|
+
nonce: number;
|
|
1032
|
+
type: "eip1559";
|
|
1031
1033
|
from: import("viem").Address;
|
|
1032
1034
|
gas: bigint;
|
|
1033
|
-
nonce: number;
|
|
1034
|
-
value: bigint;
|
|
1035
1035
|
maxFeePerBlobGas?: undefined | undefined;
|
|
1036
1036
|
gasPrice?: undefined | undefined;
|
|
1037
1037
|
maxFeePerGas: bigint;
|
|
@@ -1051,12 +1051,12 @@ export declare const getViemProvider: (rpcUrl: string, network: NetworkNumber, o
|
|
|
1051
1051
|
blockHash: (blockTag extends "pending" ? true : false) extends infer T_7 ? T_7 extends (blockTag extends "pending" ? true : false) ? T_7 extends true ? null : `0x${string}` : never : never;
|
|
1052
1052
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_8 ? T_8 extends (blockTag extends "pending" ? true : false) ? T_8 extends true ? null : number : never : never;
|
|
1053
1053
|
} | {
|
|
1054
|
-
type: "eip4844";
|
|
1055
1054
|
to: import("viem").Address | null;
|
|
1055
|
+
value: bigint;
|
|
1056
|
+
nonce: number;
|
|
1057
|
+
type: "eip4844";
|
|
1056
1058
|
from: import("viem").Address;
|
|
1057
1059
|
gas: bigint;
|
|
1058
|
-
nonce: number;
|
|
1059
|
-
value: bigint;
|
|
1060
1060
|
maxFeePerBlobGas: bigint;
|
|
1061
1061
|
gasPrice?: undefined | undefined;
|
|
1062
1062
|
maxFeePerGas: bigint;
|
|
@@ -1076,12 +1076,12 @@ export declare const getViemProvider: (rpcUrl: string, network: NetworkNumber, o
|
|
|
1076
1076
|
blockHash: (blockTag extends "pending" ? true : false) extends infer T_10 ? T_10 extends (blockTag extends "pending" ? true : false) ? T_10 extends true ? null : `0x${string}` : never : never;
|
|
1077
1077
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_11 ? T_11 extends (blockTag extends "pending" ? true : false) ? T_11 extends true ? null : number : never : never;
|
|
1078
1078
|
} | {
|
|
1079
|
-
type: "eip7702";
|
|
1080
1079
|
to: import("viem").Address | null;
|
|
1080
|
+
value: bigint;
|
|
1081
|
+
nonce: number;
|
|
1082
|
+
type: "eip7702";
|
|
1081
1083
|
from: import("viem").Address;
|
|
1082
1084
|
gas: bigint;
|
|
1083
|
-
nonce: number;
|
|
1084
|
-
value: bigint;
|
|
1085
1085
|
maxFeePerBlobGas?: undefined | undefined;
|
|
1086
1086
|
gasPrice?: undefined | undefined;
|
|
1087
1087
|
maxFeePerGas: bigint;
|
|
@@ -4357,7 +4357,7 @@ export declare const getViemProvider: (rpcUrl: string, network: NetworkNumber, o
|
|
|
4357
4357
|
authorizationList: import("viem").TransactionSerializableEIP7702["authorizationList"];
|
|
4358
4358
|
} ? "eip7702" : never) | (request["type"] extends string | undefined ? Extract<request["type"], string> : never)>) ? T_12 extends "eip7702" ? import("viem").TransactionRequestEIP7702 : never : never : never)>> & {
|
|
4359
4359
|
chainId?: number | undefined;
|
|
4360
|
-
}, (request["parameters"] extends readonly import("viem").PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "
|
|
4360
|
+
}, (request["parameters"] extends readonly import("viem").PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "nonce" | "type" | "gas" | "blobVersionedHashes" | "fees" | "chainId") extends infer T_13 ? T_13 extends (request["parameters"] extends readonly import("viem").PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "nonce" | "type" | "gas" | "blobVersionedHashes" | "fees" | "chainId") ? T_13 extends "fees" ? "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" : T_13 : never : never> & (unknown extends request["kzg"] ? {} : Pick<request, "kzg">) extends infer T ? { [K in keyof T]: T[K]; } : never>;
|
|
4361
4361
|
readContract: <const abi extends import("viem").Abi | readonly unknown[], functionName extends import("viem").ContractFunctionName<abi, "pure" | "view">, const args extends import("viem").ContractFunctionArgs<abi, "pure" | "view", functionName>>(args: import("viem").ReadContractParameters<abi, functionName, args>) => Promise<import("viem").ReadContractReturnType<abi, functionName, args>>;
|
|
4362
4362
|
sendRawTransaction: (args: import("viem").SendRawTransactionParameters) => Promise<import("viem").SendRawTransactionReturnType>;
|
|
4363
4363
|
simulate: <const calls extends readonly unknown[]>(args: import("viem").SimulateBlocksParameters<calls>) => Promise<import("viem").SimulateBlocksReturnType<calls>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NetworkNumber } from '@defisaver/positions-sdk';
|
|
2
|
+
export declare enum RequestType {
|
|
3
|
+
Signature = "Signature",
|
|
4
|
+
EthCall = "EthCall"
|
|
5
|
+
}
|
|
6
|
+
export interface Request {
|
|
7
|
+
type: RequestType;
|
|
8
|
+
getParams: (rpcUrl: string, network: NetworkNumber, userAddress: string) => Promise<any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequestType = void 0;
|
|
4
|
+
var RequestType;
|
|
5
|
+
(function (RequestType) {
|
|
6
|
+
RequestType["Signature"] = "Signature";
|
|
7
|
+
RequestType["EthCall"] = "EthCall";
|
|
8
|
+
})(RequestType || (exports.RequestType = RequestType = {}));
|
package/cjs/types/index.d.ts
CHANGED
package/cjs/types/index.js
CHANGED
|
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./common"), exports);
|
|
18
18
|
__exportStar(require("./markets"), exports);
|
|
19
19
|
__exportStar(require("./exchange"), exports);
|
|
20
|
+
__exportStar(require("./safe"), exports);
|
|
21
|
+
__exportStar(require("./execution"), exports);
|