mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-16 08:08:56 -05:00
bump frame-sdk version
This commit is contained in:
parent
0196931aed
commit
e5a55c463b
@ -9,7 +9,7 @@
|
|||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@farcaster/frame-sdk": "^0.0.6",
|
"@farcaster/frame-sdk": "^0.0.8",
|
||||||
"@tanstack/react-query": "^5.61.0",
|
"@tanstack/react-query": "^5.61.0",
|
||||||
"next": "15.0.3",
|
"next": "15.0.3",
|
||||||
"react": "19.0.0-rc-66855b96-20241106",
|
"react": "19.0.0-rc-66855b96-20241106",
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
import sdk from "@farcaster/frame-sdk";
|
import sdk from "@farcaster/frame-sdk";
|
||||||
import { SwitchChainError, fromHex, getAddress, numberToHex } from "viem";
|
import { SwitchChainError, fromHex, getAddress, numberToHex } from "viem";
|
||||||
import { ChainNotConfiguredError, createConnector } from "wagmi";
|
import { ChainNotConfiguredError, Connector, createConnector } from "wagmi";
|
||||||
|
|
||||||
frameConnector.type = "frameConnector" as const;
|
frameConnector.type = "frameConnector" as const;
|
||||||
|
|
||||||
|
let accountsChanged: Connector['onAccountsChanged'] | undefined
|
||||||
|
let chainChanged: Connector['onChainChanged'] | undefined
|
||||||
|
let disconnect: Connector['onDisconnect'] | undefined
|
||||||
|
|
||||||
export function frameConnector() {
|
export function frameConnector() {
|
||||||
let connected = true;
|
let connected = true;
|
||||||
|
|
||||||
@ -21,6 +25,20 @@ export function frameConnector() {
|
|||||||
method: "eth_requestAccounts",
|
method: "eth_requestAccounts",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!accountsChanged) {
|
||||||
|
accountsChanged = this.onAccountsChanged.bind(this)
|
||||||
|
// @ts-expect-error - provider type is stricter
|
||||||
|
provider.on('accountsChanged', accountsChanged)
|
||||||
|
}
|
||||||
|
if (!chainChanged) {
|
||||||
|
chainChanged = this.onChainChanged.bind(this)
|
||||||
|
provider.on('chainChanged', chainChanged)
|
||||||
|
}
|
||||||
|
if (!disconnect) {
|
||||||
|
disconnect = this.onDisconnect.bind(this)
|
||||||
|
provider.on('disconnect', disconnect)
|
||||||
|
}
|
||||||
|
|
||||||
let currentChainId = await this.getChainId();
|
let currentChainId = await this.getChainId();
|
||||||
if (chainId && currentChainId !== chainId) {
|
if (chainId && currentChainId !== chainId) {
|
||||||
const chain = await this.switchChain!({ chainId });
|
const chain = await this.switchChain!({ chainId });
|
||||||
@ -35,6 +53,24 @@ export function frameConnector() {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
async disconnect() {
|
async disconnect() {
|
||||||
|
const provider = await this.getProvider()
|
||||||
|
|
||||||
|
if (accountsChanged) {
|
||||||
|
// @ts-expect-error - provider type is stricter
|
||||||
|
provider.removeListener('accountsChanged', accountsChanged)
|
||||||
|
accountsChanged = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chainChanged) {
|
||||||
|
provider.removeListener('chainChanged', chainChanged)
|
||||||
|
chainChanged = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disconnect) {
|
||||||
|
provider.removeListener('disconnect', disconnect)
|
||||||
|
disconnect = undefined
|
||||||
|
}
|
||||||
|
|
||||||
connected = false;
|
connected = false;
|
||||||
},
|
},
|
||||||
async getAccounts() {
|
async getAccounts() {
|
||||||
@ -68,6 +104,8 @@ export function frameConnector() {
|
|||||||
params: [{ chainId: numberToHex(chainId) }],
|
params: [{ chainId: numberToHex(chainId) }],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// providers should start emitting these events - remove when hosts have upgraded
|
||||||
|
//
|
||||||
// explicitly emit this event as a workaround for ethereum provider not
|
// explicitly emit this event as a workaround for ethereum provider not
|
||||||
// emitting events, can remove once events are flowing
|
// emitting events, can remove once events are flowing
|
||||||
config.emitter.emit("change", { chainId });
|
config.emitter.emit("change", { chainId });
|
||||||
|
|||||||
64
yarn.lock
64
yarn.lock
@ -105,23 +105,23 @@
|
|||||||
ethereum-cryptography "^2.0.0"
|
ethereum-cryptography "^2.0.0"
|
||||||
micro-ftch "^0.3.1"
|
micro-ftch "^0.3.1"
|
||||||
|
|
||||||
"@farcaster/frame-core@^0.0.5":
|
"@farcaster/frame-core@^0.0.7":
|
||||||
version "0.0.5"
|
version "0.0.7"
|
||||||
resolved "https://registry.yarnpkg.com/@farcaster/frame-core/-/frame-core-0.0.5.tgz#e3d8afc6d6acf3596221b0207e39da8e5a111aac"
|
resolved "https://registry.yarnpkg.com/@farcaster/frame-core/-/frame-core-0.0.7.tgz#e113291525898df21c183935d145d95123e0f4e1"
|
||||||
integrity sha512-xQFKzQjSS7gF6EjozCBBeFBp8Ndq4QWKXh0HUQ66gjGYUfg6GmFY0x7HjlZ7jR/tngmW7W7CXKOCuz6u7hMCqQ==
|
integrity sha512-hN5YVoFKVy2erc8HeYmKfsJM+7yCvNU9HjTWlf9BLf9bQ1aGAIYSk5ozjsk62ob3qeQrgAyaXBPKTGarOt1Qew==
|
||||||
dependencies:
|
dependencies:
|
||||||
ox "^0.1.6"
|
ox "^0.4.0"
|
||||||
zod "^3.23.8"
|
zod "^3.23.8"
|
||||||
|
|
||||||
"@farcaster/frame-sdk@^0.0.6":
|
"@farcaster/frame-sdk@^0.0.8":
|
||||||
version "0.0.6"
|
version "0.0.8"
|
||||||
resolved "https://registry.yarnpkg.com/@farcaster/frame-sdk/-/frame-sdk-0.0.6.tgz#559788838cb5e3d17482521baa05094b494926a1"
|
resolved "https://registry.yarnpkg.com/@farcaster/frame-sdk/-/frame-sdk-0.0.8.tgz#854f7ea55b30f5cff54fc6dc9992caf2c4bc052e"
|
||||||
integrity sha512-SqEnrbzVLDIKkAEv+K++0X/R8FxqLR7V4QGx6njHnD9pFZrxaP0VHfRxBBEDd3n4CVIKz+3A0rugI/CUF9p0zQ==
|
integrity sha512-KSEGbXAbmv03pkNARHiChSHr/NSaZUIr2P5kB6+x6Qlr38Oufyj1cULfXOQHDAuQTXKQGK3E2T+wupvx1FvRnA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@farcaster/frame-core" "^0.0.5"
|
"@farcaster/frame-core" "^0.0.7"
|
||||||
comlink "^4.4.2"
|
comlink "^4.4.2"
|
||||||
eventemitter3 "^5.0.1"
|
eventemitter3 "^5.0.1"
|
||||||
ox "^0.2.2"
|
ox "^0.4.0"
|
||||||
|
|
||||||
"@humanwhocodes/config-array@^0.13.0":
|
"@humanwhocodes/config-array@^0.13.0":
|
||||||
version "0.13.0"
|
version "0.13.0"
|
||||||
@ -3846,23 +3846,10 @@ ox@0.1.2:
|
|||||||
abitype "^1.0.6"
|
abitype "^1.0.6"
|
||||||
eventemitter3 "5.0.1"
|
eventemitter3 "5.0.1"
|
||||||
|
|
||||||
ox@^0.1.6:
|
ox@^0.4.0:
|
||||||
version "0.1.8"
|
version "0.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/ox/-/ox-0.1.8.tgz#0ba58eb6f2471c607959c40fa39b2fa5c4f4f7e5"
|
resolved "https://registry.yarnpkg.com/ox/-/ox-0.4.0.tgz#6c73b27a9f45912888917304d7a81c894856a980"
|
||||||
integrity sha512-GJl6uKXxhPq/XgyvAnIokGuGU/pt9CU8reRJjzi4a02HOpLc2CEXXD4bRCITFFAzdRqHj3DQ6GDS7PlCytPM/A==
|
integrity sha512-F+Q8R/7SZ8AvBcejIV6QUcACLjRuFtSShCkwTuCFWLAN5DoS8dSwiFsDBltvQplEXXNGmAEZCV4HDe7orEDSxA==
|
||||||
dependencies:
|
|
||||||
"@adraffy/ens-normalize" "^1.10.1"
|
|
||||||
"@noble/curves" "^1.6.0"
|
|
||||||
"@noble/hashes" "^1.5.0"
|
|
||||||
"@scure/bip32" "^1.5.0"
|
|
||||||
"@scure/bip39" "^1.4.0"
|
|
||||||
abitype "^1.0.6"
|
|
||||||
eventemitter3 "5.0.1"
|
|
||||||
|
|
||||||
ox@^0.2.2:
|
|
||||||
version "0.2.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/ox/-/ox-0.2.2.tgz#b177912d2fd9853e52c2db8570ac29c09330cec1"
|
|
||||||
integrity sha512-QWCyFfVk5hFOhg13SGqRKih5B7EBucrf+Z1dfmN9jJQ8MZdrRx9mbD78JQL5ogSzDT7fcHgyMCaXd/3AWn6xHQ==
|
|
||||||
dependencies:
|
dependencies:
|
||||||
"@adraffy/ens-normalize" "^1.10.1"
|
"@adraffy/ens-normalize" "^1.10.1"
|
||||||
"@noble/curves" "^1.6.0"
|
"@noble/curves" "^1.6.0"
|
||||||
@ -4574,7 +4561,16 @@ strict-uri-encode@^2.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"
|
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"
|
||||||
integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==
|
integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==
|
||||||
|
|
||||||
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0:
|
"string-width-cjs@npm:string-width@^4.2.0":
|
||||||
|
version "4.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||||
|
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||||
|
dependencies:
|
||||||
|
emoji-regex "^8.0.0"
|
||||||
|
is-fullwidth-code-point "^3.0.0"
|
||||||
|
strip-ansi "^6.0.1"
|
||||||
|
|
||||||
|
string-width@^4.1.0, string-width@^4.2.0:
|
||||||
version "4.2.3"
|
version "4.2.3"
|
||||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||||
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||||
@ -4669,8 +4665,14 @@ string_decoder@~1.1.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
safe-buffer "~5.1.0"
|
safe-buffer "~5.1.0"
|
||||||
|
|
||||||
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
|
||||||
name strip-ansi-cjs
|
version "6.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||||
|
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^5.0.1"
|
||||||
|
|
||||||
|
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||||
version "6.0.1"
|
version "6.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||||
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user