Skip to content

Commit 74c695f

Browse files
committed
test safe
1 parent 232682a commit 74c695f

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

src/ecosys/safe.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// import {ethers} from "ethers";
22
import Safe from "@safe-global/protocol-kit";
3+
// import {EthersAdapter} from "@safe-global/protocol-kit";
34
import SafeApiKit from "@safe-global/api-kit";
45

56

@@ -59,6 +60,14 @@ async function initSafe(options) {
5960
safeAddress: safeWalletAddress,
6061
});
6162

63+
// const provider = new ethers.JsonRpcProvider(chain.rpc);
64+
// const wallet = new ethers.Wallet(signer, provider);
65+
// const ethAdapter = new EthersAdapter({
66+
// ethers,
67+
// signerOrProvider: wallet,
68+
// });
69+
// const safeSdk = await Safe.default.create({ethAdapter: ethAdapter, safeAddress: safeWalletAddress});
70+
6271
console.log(`init safe for chain ${chain.id} with ${safeWalletUrl}`);
6372
const safeService = new SafeApiKit.default({
6473
chainId: chain.id,

src/register/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ async function refactorConfig(options) {
102102
}
103103
const includeConfigs = YAML.parse(includeFileContent);
104104
if (!includeConfigs) {
105+
console.log(`not found include file ${include}`);
105106
return [];
106107
}
107108
for (const ic of includeConfigs) {
@@ -115,6 +116,10 @@ async function refactorConfig(options) {
115116

116117
async function handle(options) {
117118
const {register} = options;
119+
if (!register.bridge) {
120+
return;
121+
}
122+
118123
const [sourceChainName, targetChainName] = register.bridge.split('->');
119124

120125
let relayerAddress = register.safeWalletAddress ?? register.sourceSafeWalletAddress;

src/register/lnv2_default.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as safe from "../ecosys/safe.js";
22
import * as arg from "../ecosys/arg.js";
33
import * as tool from '../ecosys/tool.js';
4-
import {isDisableApprove} from "../ecosys/tool.js";
54

65
export async function register(options) {
76
const {register, lifecycle} = options;
@@ -177,6 +176,7 @@ async function registerWithSafe(options, callOptions) {
177176
});
178177
}
179178

179+
console.log(p0Transactions);
180180
if (p0Transactions.length) {
181181
const p0 = await safe.propose({
182182
definition,

src/register/lnv2_opposite.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,21 @@ async function registerWithSafe(options, callOptions) {
107107
} = options;
108108
const {approveFlags, setFeeFlags, withdrawFlags, sourceDeposit, sourceChainId} = callOptions;
109109

110-
const txApprove = await $`cast calldata ${approveFlags}`;
111-
const txSetFee = await $`cast calldata ${setFeeFlags}`;
112110
const _signerAddress = await $`cast wallet address ${signer}`.quiet();
113111
const signerAddress = _signerAddress.stdout.trim();
114112

115113
const p0Transactions = [];
116114

117115
if (!tool.isDisableApprove({definition, symbol: register.symbol, chainId: sourceChainId})) {
116+
const txApprove = await $`cast calldata ${approveFlags}`;
118117
p0Transactions.push({
119118
to: lifecycle.sourceToken.address,
120119
value: '0',
121120
data: txApprove.stdout.trim(),
122121
});
123122
}
123+
124+
const txSetFee = await $`cast calldata ${setFeeFlags}`;
124125
p0Transactions.push({
125126
to: lifecycle.contractAddress,
126127
value: lifecycle.sourceToken.type === 'native'

yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146

147147
"@safe-global/api-kit@^2.4.3":
148148
version "2.4.3"
149-
resolved "https://registry.npmjs.org/@safe-global/api-kit/-/api-kit-2.4.3.tgz"
149+
resolved "https://registry.yarnpkg.com/@safe-global/api-kit/-/api-kit-2.4.3.tgz#5bde12efa15c98e96037880718d86a00d155f7d1"
150150
integrity sha512-kIbRMYWQiVUqIpu65GYTiHQgYDne9CZJ7JREmtrLQh11n3K7+LxNmHT6HW1VfVj/5Es8fAQlwrBukbTy0AQwLw==
151151
dependencies:
152152
"@safe-global/protocol-kit" "^4.0.3"

0 commit comments

Comments
 (0)