Skip to content

Commit 06af4b3

Browse files
committed
fix(evm): allow passing 0 as reset value without replacing with max
1 parent 3f31940 commit 06af4b3

File tree

6 files changed

+47
-28
lines changed

6 files changed

+47
-28
lines changed

.changeset/whole-ghosts-win.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@swapkit/toolboxes": patch
3+
---
4+
5+
fix(evm): allow passing 0 as reset value without replacing with max

.github/workflows/pr-test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: PR Test
2+
env:
3+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4+
TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request_target:
9+
branches:
10+
- develop
11+
12+
jobs:
13+
build-lint-test:
14+
if: contains(github.event.pull_request.title, ':tada:') == false
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Repo
20+
uses: ./tools/github/setup-repo
21+
22+
- run: bun build:ci
23+
- run: bun lint
24+
- run: bun type-check:ci
25+
26+
- name: Test
27+
run: bun test:ci
Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
name: Run build, test & publish
1+
name: Release
22
env:
33
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
55
TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
66

77
on:
88
workflow_dispatch:
9-
pull_request_target:
10-
branches:
11-
- develop
12-
- v4
139
push:
1410
branches:
1511
- develop
@@ -18,12 +14,9 @@ on:
1814

1915
jobs:
2016
build-lint-test:
21-
if: contains(github.event.pull_request.title, ':tada:') == false
2217
runs-on: ubuntu-latest
2318
steps:
2419
- uses: actions/checkout@v4
25-
with:
26-
fetch-depth: 0
2720

2821
- name: Setup Repo
2922
uses: ./tools/github/setup-repo
@@ -33,17 +26,14 @@ jobs:
3326
- run: bun type-check:ci
3427

3528
- name: Test
36-
if: contains(github.ref_name, 'nightly') == false
29+
if: github.ref_name == 'nightly'
3730
run: bun test:ci
3831

3932
publish:
40-
if: contains(github.ref_name, 'develop') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'nightly')
4133
needs: [build-lint-test]
4234
runs-on: ubuntu-latest
4335
steps:
4436
- uses: actions/checkout@v4
45-
with:
46-
fetch-depth: 0
4737

4838
- name: Setup Repo
4939
uses: ./tools/github/setup-repo
@@ -58,29 +48,28 @@ jobs:
5848
shell: bash
5949
id: deployment-params
6050
run: |
61-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
62-
git config --global user.name "github-actions[bot]"
51+
git config --global user.email "swapkit[bot]@users.noreply.github.com"
52+
git config --global user.name "swapkit[bot]"
6353
echo "publishName=${{ github.ref_name == 'develop' && 'Release' || github.ref_name }}" >> $GITHUB_OUTPUT
6454
6555
- name: Exit pre changeset
66-
if: contains(github.ref_name, 'nightly')
56+
if: github.ref_name == 'nightly'
6757
continue-on-error: true
6858
run: bun changeset pre exit
6959

7060
- name: Change nightly changeset
71-
if: contains(github.ref_name, 'nightly')
61+
if: github.ref_name == 'nightly'
7262
run: bun changeset version --snapshot nightly
7363

7464
- name: Change beta changeset
75-
if: contains(github.ref_name, 'beta')
65+
if: github.ref_name == 'beta'
7666
continue-on-error: true
7767
run: bun changeset pre enter beta
7868

79-
8069
- name: Create Pull Request or Publish to npm
8170
id: changesets
71+
if: github.ref_name == 'develop'
8272
uses: changesets/action@v1.4.10
83-
if: contains(github.ref_name, 'develop')
8473
with:
8574
title: ":tada: Publish ${{ steps.deployment-params.outputs.publishName }}"
8675
version: bun version-bump
@@ -89,8 +78,8 @@ jobs:
8978
createGithubReleases: false
9079

9180
- name: Publish Beta to npm
81+
if: github.ref_name == 'beta'
9282
uses: changesets/action@v1.4.10
93-
if: contains(github.ref_name, 'beta')
9483
with:
9584
title: ":tada: Publish Beta"
9685
version: bun version-bump
@@ -99,8 +88,8 @@ jobs:
9988
createGithubReleases: false
10089

10190
- name: Publish Nightly to npm
91+
if: github.ref_name == 'nightly'
10292
uses: changesets/action@v1.4.10
103-
if: contains(github.ref_name, 'nightly')
10493
with:
10594
title: ":tada: Publish Nightly"
10695
version: bun version-bump
@@ -110,7 +99,6 @@ jobs:
11099

111100
build-docs:
112101
runs-on: ubuntu-latest
113-
if: contains(github.ref_name, 'develop') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'nightly')
114102
needs: [build-lint-test]
115103
permissions:
116104
contents: read
@@ -119,8 +107,6 @@ jobs:
119107

120108
steps:
121109
- uses: actions/checkout@v4
122-
with:
123-
fetch-depth: 0
124110

125111
- name: Setup Repo
126112
uses: ./tools/github/setup-repo

packages/toolboxes/src/evm/toolbox/baseEVMToolbox.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,13 +745,15 @@ function getCreateApprovalTx({ provider, signer, chain }: ToolboxWrapParams) {
745745
const from = (await signer?.getAddress()) || fromParam;
746746

747747
const createTx = getCreateContractTxObject({ provider, chain });
748-
const funcParams = [spenderAddress, BigInt(amount || MAX_APPROVAL)];
748+
const approvalAmount = ["bigint", "number"].includes(typeof amount)
749+
? (amount as bigint | number)
750+
: amount || MAX_APPROVAL;
749751

750752
const txObject = await createTx({
751753
contractAddress: assetAddress,
752754
abi: erc20ABI,
753755
funcName: "approve",
754-
funcParams,
756+
funcParams: [spenderAddress, BigInt(approvalAmount)],
755757
txOverrides: { from },
756758
});
757759

packages/wallets/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export type Callback = (
4040

4141
export type VultisigCosmosProvider = {
4242
request(
43-
request: { method: string; params?: Array<any> | Record<string, any> },
43+
request: { method: string; params?: any[] | Record<string, any> },
4444
callback?: Callback,
4545
): Promise<any>;
4646
};

packages/wallets/src/vultisig/walletHelpers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ async function transaction({
109109
});
110110
}
111111

112-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
113112
export async function getVultisigAddress(chain: Chain) {
114113
try {
115114
const eipProvider = (await getVultisigProvider(chain)) as Eip1193Provider;

0 commit comments

Comments
 (0)