Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: command wallet #2

Merged
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
057f376
chore: init repo
gentlementlegen Jun 24, 2024
70fb75e
feat: parsing arguments and executing run
gentlementlegen Jun 24, 2024
1188e02
chore: updated cspell rules
gentlementlegen Jun 24, 2024
fd761fc
chore: typed Supabase instance
gentlementlegen Jun 24, 2024
767610a
chore: removed migration step from database.yml
gentlementlegen Jun 24, 2024
6eb27b9
chore: added wrangler deploy workflow
gentlementlegen Jun 24, 2024
559bdcc
chore: removed unused files
gentlementlegen Jun 24, 2024
4d79efe
Merge pull request #2 from Meniole/development
gentlementlegen Jun 24, 2024
f5dc9e9
chore: fixed database workflow
gentlementlegen Jun 24, 2024
edf8f99
Merge pull request #3 from Meniole/development
gentlementlegen Jun 24, 2024
bb73e4a
chore: fixed worker name
gentlementlegen Jun 24, 2024
e8519cb
Merge pull request #4 from Meniole/development
gentlementlegen Jun 24, 2024
c728812
chore: fixed request and payload JSON parsing
gentlementlegen Jun 24, 2024
4fe7e02
Merge branch 'refs/heads/meniole-development'
gentlementlegen Jun 24, 2024
2a56d91
chore: fixed wallet address argument
gentlementlegen Jun 24, 2024
6a8ba29
chore: test then
gentlementlegen Jun 24, 2024
0a05f27
chore: test await
gentlementlegen Jun 24, 2024
eb14ae0
chore: added pretty diff
gentlementlegen Jun 24, 2024
20da052
chore: added error log on ENS fail
gentlementlegen Jun 24, 2024
a89370a
chore: async await on logs
gentlementlegen Jun 25, 2024
15f3996
chore: fixed error message
gentlementlegen Jun 25, 2024
e997968
chore: added fastest rpc check
gentlementlegen Jun 25, 2024
5b04deb
chore: added fastest rpc check
gentlementlegen Jun 25, 2024
33e9d3f
chore: test rpc
gentlementlegen Jun 25, 2024
8ecca13
chore: test rpc
gentlementlegen Jun 25, 2024
e059e13
feat: added test for wallet link
gentlementlegen Jun 25, 2024
ac5c70b
chore: fixed test env
gentlementlegen Jun 25, 2024
bb2a93c
chore: fixed error posting for invalid command payload
gentlementlegen Jun 25, 2024
a6b6270
chore: fixed error posting for invalid command payload
gentlementlegen Jun 25, 2024
10a02a9
chore: updated package description
gentlementlegen Jun 25, 2024
90512f5
chore: fixed deploy node version
gentlementlegen Jun 25, 2024
db235e2
chore: log handlers
gentlementlegen Jun 25, 2024
00d80c4
chore: fixed env for tests
gentlementlegen Jun 25, 2024
8b2dd6a
chore: removed .env file to avoid duplicate env
gentlementlegen Jun 25, 2024
07c17fd
docs: update README.md
rndquu Jun 25, 2024
73d63d4
ci: fix knip
rndquu Jun 25, 2024
3a4f180
Merge pull request #1 from rndquu/ci/fix-knip
gentlementlegen Jun 25, 2024
433a6a7
fix: fixed crash when user does not exist
gentlementlegen Jun 26, 2024
fdc2cc7
chore: checksum for address
gentlementlegen Jul 1, 2024
a5e245b
chore: changed description
gentlementlegen Jul 2, 2024
3a8269a
Update src/handlers/command-parser.ts
gentlementlegen Jul 2, 2024
d83a054
chore: added ok log level
gentlementlegen Jul 3, 2024
1ec82e7
chore: fixed jest test for wallet link
gentlementlegen Jul 3, 2024
13d33b1
chore: fixed jest test for wallet link
gentlementlegen Jul 3, 2024
27c7ab1
chore: object destructuring for conciseness
gentlementlegen Jul 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: checksum for address
gentlementlegen committed Jul 1, 2024
commit fdc2cc70444431d5f5bcbb111dc55ce8cdde50a7
2 changes: 1 addition & 1 deletion src/adapters/supabase/helpers/wallet.ts
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ export class Wallet extends Super {
// Register the new user with the location ID
const { data: userData, error: userError } = await this.supabase
.from("users")
.insert([{ id: user.id, location_id: locationId /* other fields if necessary */ }])
.insert([{ id: user.id, location_id: locationId }])
.select()
.single();

3 changes: 3 additions & 0 deletions src/handlers/query-wallet.ts
Original file line number Diff line number Diff line change
@@ -44,6 +44,9 @@ export async function registerWallet(context: Context, body: string) {
return logger.error("Skipping to register a wallet address because user is trying to set their address to null address");
}

// Makes sure that the address is check-summed
address = ethers.getAddress(address);

if (payload.comment) {
const { wallet } = adapters.supabase;
await wallet.upsertWalletAddress(context, address);
2 changes: 2 additions & 0 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, jest } from "@jest/globals";
import { ethers } from "ethers";
import { plugin } from "../src/plugin";
import { PluginInputs } from "../src/types";
import { db } from "./__mocks__/db";
@@ -15,6 +16,7 @@ jest.mock("ethers", () => ({
JsonRpcProvider: jest.fn(() => ({
resolveName: jest.fn(async () => "0x0000000000000000000000000000000000000001"),
})),
getAddress: (jest.requireActual("ethers") as typeof ethers).getAddress,
},
}));