Skip to content

Commit 7b4c696

Browse files
committed
Release v0.26.1
Origin-SHA: b13933c720499bce7d8c6725e4c4f533c3548d1c
1 parent 786c2bb commit 7b4c696

5 files changed

Lines changed: 64 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @opensea/tool-sdk
22

3+
## 0.26.1
4+
5+
### Patch Changes
6+
7+
- 158f38f: Fix `createBankrAccount` reading the wrong shape from Bankr's `/wallet/me`. The endpoint returns `{ wallets: [{ chain, address }, ...] }` (no top-level `address`), so the account was created with an undefined address. Now resolve the EVM entry from `wallets[]`.
8+
- Updated dependencies [158f38f]
9+
- @opensea/wallet-adapters@0.3.2
10+
311
## 0.26.0
412

513
### Minor Changes

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opensea/tool-sdk",
3-
"version": "0.26.0",
3+
"version": "0.26.1",
44
"type": "module",
55
"description": "SDK and CLI for building ERC-8257 compliant AI agent tools",
66
"repository": {
@@ -40,7 +40,7 @@
4040
},
4141
"dependencies": {
4242
"@clack/prompts": "0.10.1",
43-
"@opensea/wallet-adapters": "^0.3.1",
43+
"@opensea/wallet-adapters": "^0.3.2",
4444
"@x402/core": "2.15.0",
4545
"@x402/fetch": "2.15.0",
4646
"canonicalize": "2.1.0",

src/__tests__/auth.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,13 @@ describe("auth command", () => {
221221
function stubBankrFetch() {
222222
return vi.fn(async (url: string, init?: RequestInit) => {
223223
if (typeof url === "string" && url.includes("/wallet/me")) {
224-
return new Response(JSON.stringify({ address: BANKR_ADDRESS }), {
225-
status: 200,
226-
})
224+
return new Response(
225+
JSON.stringify({
226+
success: true,
227+
wallets: [{ chain: "evm", address: BANKR_ADDRESS }],
228+
}),
229+
{ status: 200 },
230+
)
227231
}
228232
if (typeof url === "string" && url.includes("/wallet/sign")) {
229233
return new Response(JSON.stringify({ signature: "0xdeadbeef" }), {

src/__tests__/external-signer.test.ts

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,16 @@ describe("createBankrAccount", () => {
221221
it("fetches address from /wallet/me and creates a signing account", async () => {
222222
const fetchMock = vi.fn(async (url: string, _init?: RequestInit) => {
223223
if (url.includes("/wallet/me")) {
224-
return new Response(JSON.stringify({ address: BANKR_ADDRESS }), {
225-
status: 200,
226-
})
224+
return new Response(
225+
JSON.stringify({
226+
success: true,
227+
wallets: [
228+
{ chain: "evm", address: BANKR_ADDRESS },
229+
{ chain: "solana", address: "5DcKsomeSolanaAddress" },
230+
],
231+
}),
232+
{ status: 200 },
233+
)
227234
}
228235
if (url.includes("/wallet/sign")) {
229236
return new Response(JSON.stringify({ signature: "0xdeadbeef" }), {
@@ -267,14 +274,38 @@ describe("createBankrAccount", () => {
267274
)
268275
})
269276

277+
it("throws when /wallet/me returns no EVM wallet", async () => {
278+
vi.stubGlobal(
279+
"fetch",
280+
vi.fn(
281+
async () =>
282+
new Response(
283+
JSON.stringify({
284+
success: true,
285+
wallets: [{ chain: "solana", address: "5DcKsomeSolanaAddress" }],
286+
}),
287+
{ status: 200 },
288+
),
289+
),
290+
)
291+
292+
await expect(createBankrAccount("test-key")).rejects.toThrow(
293+
"Bankr /wallet/me returned no EVM wallet address",
294+
)
295+
})
296+
270297
it("throws when /wallet/sign returns an error", async () => {
271298
vi.stubGlobal(
272299
"fetch",
273300
vi.fn(async (url: string) => {
274301
if (typeof url === "string" && url.includes("/wallet/me")) {
275-
return new Response(JSON.stringify({ address: BANKR_ADDRESS }), {
276-
status: 200,
277-
})
302+
return new Response(
303+
JSON.stringify({
304+
success: true,
305+
wallets: [{ chain: "evm", address: BANKR_ADDRESS }],
306+
}),
307+
{ status: 200 },
308+
)
278309
}
279310
return new Response("Rate limited", { status: 429 })
280311
}),

src/lib/client/external-signer.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,16 @@ export async function createBankrAccount(apiKey: string): Promise<Account> {
5656
`Bankr /wallet/me failed (${infoRes.status}): ${text}`,
5757
)
5858
}
59-
const info = (await infoRes.json()) as { address: string }
60-
const address = getAddress(info.address)
59+
// `/wallet/me` returns `{ wallets: [{ chain, address }, ...] }` — one entry
60+
// per chain (e.g. "evm", "solana"). There is no top-level `address` field.
61+
const info = (await infoRes.json()) as {
62+
wallets?: Array<{ chain: string; address: string }>
63+
}
64+
const evmWallet = info.wallets?.find((w) => w.chain === "evm")
65+
if (!evmWallet) {
66+
throw new Error("Bankr /wallet/me returned no EVM wallet address")
67+
}
68+
const address = getAddress(evmWallet.address)
6169

6270
return createExternalSignerAccount({
6371
address,

0 commit comments

Comments
 (0)