Skip to content

Commit f640ced

Browse files
committed
update ViemAccount to work with custom rpc of supported chains
1 parent 40a3728 commit f640ced

File tree

7 files changed

+25
-22
lines changed

7 files changed

+25
-22
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"check-exports": "attw --pack .",
2121
"lint": "tsc",
2222
"test": "jest",
23+
"add-change": "npx changeset",
2324
"local-release": "changeset version && changeset publish",
2425
"link": "pnpm link --global",
2526
"prepublishOnly": "npm run ci"

src/adapters/providers/debridge/functions/prepareTransaction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function determineTransaction(
105105
dstChainId: DLNInternalId[args.fromChain],
106106
dstChainTokenOut: args.fromToken,
107107
srcChainTokenInAmount: parseUnits(args.amount, args.fromTokenDecimal),
108-
}
108+
};
109109
} else {
110110
return {
111111
srcChainId: DLNInternalId[args.fromChain],

src/adapters/transformers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './toResult';
1+
export * from "./toResult";
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { toResult } from './toResult';
1+
import { toResult } from "./toResult";
22

3-
describe('toResult', () => {
4-
it('should return success true when error is false', () => {
5-
const result = toResult('data', false);
6-
expect(result.success).toBe(true);
7-
expect(result.data).toBe('data');
8-
});
3+
describe("toResult", () => {
4+
it("should return success true when error is false", () => {
5+
const result = toResult("data", false);
6+
expect(result.success).toBe(true);
7+
expect(result.data).toBe("data");
8+
});
99

10-
it('should return success false when error is true', () => {
11-
const result = toResult('data', true);
12-
expect(result.success).toBe(false);
13-
expect(result.data).toBe('ERROR: data');
14-
});
10+
it("should return success false when error is true", () => {
11+
const result = toResult("data", true);
12+
expect(result.success).toBe(false);
13+
expect(result.data).toBe("ERROR: data");
14+
});
1515
});
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { FunctionReturn } from '../type';
1+
import { FunctionReturn } from "../type";
22

3-
export function toResult(data = '', error = false): FunctionReturn {
4-
return {
5-
success: !error,
6-
data: error ? `ERROR: ${data}` : data,
7-
};
3+
export function toResult(data = "", error = false): FunctionReturn {
4+
return {
5+
success: !error,
6+
data: error ? `ERROR: ${data}` : data,
7+
};
88
}

src/networks/constant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ export const getChainMap = (chainId: number) => {
6464

6565
export const getRpc = (rpcUrls: string[]) => {
6666
return rpcUrls[Math.floor(Math.random() * rpcUrls.length)];
67-
};
67+
};

src/wallio.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { z } from "zod";
22
import { AdapterProvider, UseFunction } from "./adapters";
33
import { BaseAccount } from "./accounts";
44
import { Wallio } from "./wallio";
5+
import { formatUnits } from "viem";
56

67
class MockAccount extends BaseAccount {
78
getAddress() {
@@ -14,7 +15,8 @@ class MockAccount extends BaseAccount {
1415
return "MockAccount";
1516
}
1617
async getBalance() {
17-
return BigInt(1000);
18+
const balance = BigInt(1000);
19+
return formatUnits(balance, 18);
1820
}
1921
async nativeTransfer(to, value) {
2022
return "0xMockTxHash";

0 commit comments

Comments
 (0)