diff --git a/sdk/apps/modal-example/package.json b/sdk/apps/modal-example/package.json index d9d891b0..475e6bd3 100644 --- a/sdk/apps/modal-example/package.json +++ b/sdk/apps/modal-example/package.json @@ -15,14 +15,14 @@ "vite": "^4.1.4" }, "dependencies": { - "@mysten/sui.js": "^0.37.1", - "@mysten/wallet-adapter-wallet-standard": "^0.7.9", - "@nightlylabs/wallet-selector-solana": "0.2.2", + "@mysten/sui.js": "^0.42.0", + "@mysten/wallet-adapter-wallet-standard": "^0.8.0", + "@nightlylabs/wallet-selector-solana": "0.2.3", "@nightlylabs/nightly-connect-solana": "0.0.26", - "@nightlylabs/nightly-connect-sui": "0.0.25", - "@nightlylabs/wallet-selector-sui": "0.2.2", + "@nightlylabs/nightly-connect-sui": "0.0.26", + "@nightlylabs/wallet-selector-sui": "0.2.3", "@nightlylabs/nightly-connect-polkadot": "0.0.6", - "@nightlylabs/wallet-selector-polkadot": "0.1.2", + "@nightlylabs/wallet-selector-polkadot": "0.1.3", "@polkadot/extension-inject": "^0.46.5", "@polkadot/api": "^10.9.1", "@solana/web3.js": "^1.77.2", @@ -38,4 +38,4 @@ "engines": { "node": ">=16.8" } -} +} \ No newline at end of file diff --git a/sdk/apps/modal-example/src/routes/sui.tsx b/sdk/apps/modal-example/src/routes/sui.tsx index 37030f84..36cc73f0 100644 --- a/sdk/apps/modal-example/src/routes/sui.tsx +++ b/sdk/apps/modal-example/src/routes/sui.tsx @@ -1,7 +1,7 @@ import { createEffect, createSignal, onMount, Show } from 'solid-js' import { Title } from 'solid-start' import { NightlyConnectSuiAdapter } from '@nightlylabs/wallet-selector-sui' -import { TransactionBlock } from '@mysten/sui.js' +import { TransactionBlock } from '@mysten/sui.js/transactions' import toast from 'solid-toast' export default function Sui() { @@ -104,7 +104,7 @@ export default function Sui() { onClick={async () => { try { const accounts = await adapter()!.getAccounts() - await adapter()!.signMessage!({ + await adapter()!.signPersonalMessage!({ message: new TextEncoder().encode('I love Nightly'), account: accounts[0] }) diff --git a/sdk/apps/modal-example/src/routes/suiInitOnConnect.tsx b/sdk/apps/modal-example/src/routes/suiInitOnConnect.tsx index 77773836..92c91d7c 100644 --- a/sdk/apps/modal-example/src/routes/suiInitOnConnect.tsx +++ b/sdk/apps/modal-example/src/routes/suiInitOnConnect.tsx @@ -1,7 +1,7 @@ import { createSignal, onMount, Show } from 'solid-js' import { Title } from 'solid-start' import { NightlyConnectSuiAdapter } from '@nightlylabs/wallet-selector-sui' -import { TransactionBlock } from '@mysten/sui.js' +import { TransactionBlock } from '@mysten/sui.js/transactions' import toast from 'solid-toast' export default function Sui() { @@ -82,7 +82,7 @@ export default function Sui() { onClick={async () => { try { const accounts = await adapter()!.getAccounts() - await adapter()!.signMessage!({ + await adapter()!.signPersonalMessage!({ message: new TextEncoder().encode('I love Nightly'), account: accounts[0] }) diff --git a/sdk/apps/nextjs-example/package.json b/sdk/apps/nextjs-example/package.json index e9c2ae57..ed6f7d87 100644 --- a/sdk/apps/nextjs-example/package.json +++ b/sdk/apps/nextjs-example/package.json @@ -9,12 +9,12 @@ "lint": "next lint" }, "dependencies": { - "@nightlylabs/wallet-selector-solana": "0.2.2", - "@nightlylabs/wallet-selector-sui": "0.2.2", - "@mysten/wallet-adapter-wallet-standard": "0.7.12", - "@mysten/wallet-adapter-base": "0.7.12", - "@mysten/sui.js": "0.37.1", - "@mysten/wallet-kit": "0.4.12", + "@nightlylabs/wallet-selector-solana": "0.2.3", + "@nightlylabs/wallet-selector-sui": "0.2.3", + "@mysten/wallet-adapter-wallet-standard": "0.8.0", + "@mysten/wallet-adapter-base": "0.9.0", + "@mysten/sui.js": "0.42.0", + "@mysten/wallet-kit": "0.7.3", "@solana/web3.js": "^1.77.2", "@types/node": "20.4.2", "@types/react": "18.2.15", diff --git a/sdk/apps/sui/package.json b/sdk/apps/sui/package.json index f230c87b..5efcbb6a 100644 --- a/sdk/apps/sui/package.json +++ b/sdk/apps/sui/package.json @@ -1,6 +1,6 @@ { "name": "@nightlylabs/nightly-connect-sui", - "version": "0.0.25", + "version": "0.0.26", "type": "module", "exports": { ".": { @@ -31,7 +31,7 @@ }, "devDependencies": { "@rollup/plugin-commonjs": "^25.0.0", - "@rollup/plugin-node-resolve": "^15.1.0", + "@rollup/plugin-node-resolve": "^15.2.1", "@rollup/plugin-terser": "^0.4.3", "@rollup/plugin-typescript": "^11.1.1", "@types/node": "^20.3.0", @@ -46,11 +46,11 @@ "typescript": "^5.1.3" }, "dependencies": { - "@mysten/sui.js": "^0.37.1", - "@mysten/wallet-standard": "^0.5.12", + "@mysten/sui.js": "^0.42.0", + "@mysten/wallet-standard": "^0.8.0", "@nightlylabs/nightly-connect-base": "0.0.25", "@noble/hashes": "^1.3.0", "eventemitter3": "^5.0.1", "uuid": "^9.0.0" } -} +} \ No newline at end of file diff --git a/sdk/apps/sui/rollup.config.js b/sdk/apps/sui/rollup.config.js index 96dabf80..00405c9f 100644 --- a/sdk/apps/sui/rollup.config.js +++ b/sdk/apps/sui/rollup.config.js @@ -23,6 +23,7 @@ export default [ plugins: [typescript(), nodeResolve(), commonjs(), terser()], external: [ '@mysten/sui.js', + '@mysten/sui.js/client', '@mysten/wallet-standard', '@noble/hashes', '@nightlylabs/nightly-connect-base', @@ -55,6 +56,7 @@ export default [ ], external: [ '@mysten/sui.js', + '@mysten/sui.js/client', '@mysten/wallet-standard', '@noble/hashes', '@nightlylabs/nightly-connect-base', diff --git a/sdk/apps/sui/src/app.ts b/sdk/apps/sui/src/app.ts index 619bf8ab..01b258cd 100644 --- a/sdk/apps/sui/src/app.ts +++ b/sdk/apps/sui/src/app.ts @@ -1,9 +1,10 @@ import { UserConnectedEvent } from '../../../bindings/UserConnectedEvent' -import { SignedMessage, SignedTransaction } from '@mysten/sui.js' +// import { SignedMessage, SignedTransaction } from '@mysten/sui.js/dist/esm/signers/types' +import type { SignedMessage, SignedTransaction } from '@mysten/sui.js/src/signers/types' import { SuiSignAndExecuteTransactionBlockInput, SuiSignAndExecuteTransactionBlockOutput, - SuiSignMessageInput, + SuiSignPersonalMessageInput, SuiSignTransactionBlockInput } from '@mysten/wallet-standard' import { @@ -98,7 +99,7 @@ export class AppSui extends EventEmitter { return JSON.parse(signedTx[0].transaction) } - signMessage = async (input: SuiSignMessageInput, encoding?: string) => { + signMessage = async (input: SuiSignPersonalMessageInput, encoding?: string) => { const request: MessageToSign = { message: new TextDecoder().decode(input.message), metadata: JSON.stringify({ encoding: encoding || 'hex', account: input.account }) diff --git a/sdk/apps/sui/src/client.ts b/sdk/apps/sui/src/client.ts index 9f624506..04c57aad 100644 --- a/sdk/apps/sui/src/client.ts +++ b/sdk/apps/sui/src/client.ts @@ -1,5 +1,6 @@ import { AppDisconnectedEvent } from '../../../bindings/AppDisconnectedEvent' -import { SignedMessage, SignedTransaction, SuiTransactionBlockResponse } from '@mysten/sui.js' +import type { SuiTransactionBlockResponse } from '@mysten/sui.js/client' +import type { SignedMessage, SignedTransaction } from '@mysten/sui.js/src/signers/types' import { BaseClient, ClientBaseInitialize, diff --git a/sdk/apps/sui/src/e2e.test.ts b/sdk/apps/sui/src/e2e.test.ts index 55c8f943..17c7eee2 100644 --- a/sdk/apps/sui/src/e2e.test.ts +++ b/sdk/apps/sui/src/e2e.test.ts @@ -3,17 +3,16 @@ import { assert, beforeAll, beforeEach, describe, expect, test, vi } from 'vites import { AppSui } from './app' import { ClientSui } from './client' import { signTransactionBlock, SUI_NETWORK, TEST_APP_INITIALIZE } from './utils' - +import { fromB64, toB64 } from '@mysten/sui.js/utils' +import { TransactionBlock } from '@mysten/sui.js/transactions' +import { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519' +import { verifyPersonalMessage, verifyTransactionBlock } from '@mysten/sui.js/verify' import { - Ed25519Keypair, - fromB64, IntentScope, messageWithIntent, - toB64, - toSerializedSignature, - TransactionBlock, - verifyMessage -} from '@mysten/sui.js' + parseSerializedSignature, + toSerializedSignature +} from '@mysten/sui.js/cryptography' import { blake2b } from '@noble/hashes/blake2b' import { fetch } from 'cross-fetch' import { WalletAccount } from '@mysten/wallet-standard' @@ -95,25 +94,24 @@ describe('SUI client tests', () => { chain: 'sui:testnet' }) - const isValid = await verifyMessage( - signedTx.transactionBlockBytes, - signedTx.signature, - IntentScope.TransactionData - ) - expect(isValid).toBeTruthy() + try { + // Will throw if invalid + await verifyTransactionBlock(fromB64(signedTx.transactionBlockBytes), signedTx.signature) + } catch (error) { + assert(false, 'Transaction block is invalid') + } }) test('#on("signMessages")', async () => { - const msgToSign = 'Hello World' + const msgToSign = 'I love Nightly' client.on('signMessages', async (e) => { const msg = e.messages[0].message - const msgTo64 = toB64(new TextEncoder().encode(msg)) - const intentMessage = messageWithIntent(IntentScope.PersonalMessage, fromB64(msgTo64)) - const digest = blake2b(intentMessage, { dkLen: 32 }) - const signature = alice_keypair.signData(digest) + const msgTo64 = new TextEncoder().encode(msg) + const { signature } = await alice_keypair.signPersonalMessage(msgTo64) + await verifyPersonalMessage(msgTo64, signature) const signedMessage = { messageBytes: msg, signature: toSerializedSignature({ - signature, + signature: fromB64(signature), signatureScheme: 'ED25519', pubKey: alice_keypair.getPublicKey() }) @@ -129,13 +127,17 @@ describe('SUI client tests', () => { message: new TextEncoder().encode(msgToSign), account: aliceWalletAccount }) - const signData = new TextEncoder().encode(msgToSign) - const isValid = await verifyMessage( - signData, - signedMessage.signature, - IntentScope.PersonalMessage - ) - expect(isValid).toBe(true) + try { + // We need to deserialize the signature + const parsedSignature = parseSerializedSignature(signedMessage.signature) + // Will throw if invalid + await verifyPersonalMessage( + new TextEncoder().encode(msgToSign), + toB64(parsedSignature.signature!) + ) + } catch (error) { + assert(false, 'Message is invalid') + } }) test('#on("signAndExecuteSignTransaction")', async () => { const tx = new TransactionBlock() diff --git a/sdk/apps/sui/src/http-client.test.ts b/sdk/apps/sui/src/http-client.test.ts index 23deedbe..19f49f5f 100644 --- a/sdk/apps/sui/src/http-client.test.ts +++ b/sdk/apps/sui/src/http-client.test.ts @@ -9,8 +9,10 @@ import { smartDelay } from '@nightlylabs/nightly-connect-base' import { HttpClientSui } from './http-client' - -import { Ed25519Keypair, IntentScope, toB64, TransactionBlock, verifyMessage } from '@mysten/sui.js' +import { fromB64, toB64 } from '@mysten/sui.js/utils' +import { TransactionBlock } from '@mysten/sui.js/transactions' +import { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519' +import { verifyPersonalMessage, verifyTransactionBlock } from '@mysten/sui.js/verify' import { hexToBytes } from '@noble/hashes/utils' import { WalletAccount } from '@mysten/wallet-standard' @@ -93,11 +95,11 @@ describe('SUI http-client tests', () => { await smartDelay() const signedTx = await promiseSignTransaction - const isValid = await verifyMessage( - signedTx.transactionBlockBytes, - signedTx.signature, - IntentScope.TransactionData - ) - expect(isValid).toBeTruthy() + try { + // Will throw if invalid + await verifyTransactionBlock(fromB64(signedTx.transactionBlockBytes), signedTx.signature) + } catch (error) { + assert(false, 'Transaction block is invalid') + } }) }) diff --git a/sdk/apps/sui/src/http-client.ts b/sdk/apps/sui/src/http-client.ts index 28b722d4..70fa81e5 100644 --- a/sdk/apps/sui/src/http-client.ts +++ b/sdk/apps/sui/src/http-client.ts @@ -3,7 +3,7 @@ import { SUI_NETWORK, parseRequest } from './utils' import { HttpConnectSessionRequest } from '../../../bindings/HttpConnectSessionRequest' import { HttpGetPendingRequestsRequest } from '../../../bindings/HttpGetPendingRequestsRequest' import { HttpGetPendingRequestRequest } from '../../../bindings/HttpGetPendingRequestRequest' -import { SignedTransaction } from '@mysten/sui.js' +import { type SignedTransaction } from '@mysten/sui.js/src/signers/types' import { HttpGetSessionInfoResponse } from '../../../bindings/HttpGetSessionInfoResponse' export class HttpClientSui { diff --git a/sdk/apps/sui/src/utils.ts b/sdk/apps/sui/src/utils.ts index 3a38fea7..bd728441 100644 --- a/sdk/apps/sui/src/utils.ts +++ b/sdk/apps/sui/src/utils.ts @@ -1,15 +1,20 @@ -import { - JsonRpcProvider, - Connection, - TransactionBlock, - messageWithIntent, - IntentScope, - toSerializedSignature, - Ed25519Keypair -} from '@mysten/sui.js' +import { type TransactionBlock } from '@mysten/sui.js/transactions' +import { type Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519' +import { IntentScope, messageWithIntent, toSerializedSignature } from '@mysten/sui.js/cryptography' import { blake2b } from '@noble/hashes/blake2b' -import { AppBaseInitialize, ContentType, RELAY_ENDPOINT, RequestContent } from '@nightlylabs/nightly-connect-base' -import { CustomSuiRequest, SignMessagesSuiRequest, SignTransactionsSuiRequest, SuiRequest } from './requestTypes' +import { + AppBaseInitialize, + ContentType, + RELAY_ENDPOINT, + RequestContent +} from '@nightlylabs/nightly-connect-base' +import { + CustomSuiRequest, + SignMessagesSuiRequest, + SignTransactionsSuiRequest, + SuiRequest +} from './requestTypes' +import { SuiClient } from '@mysten/sui.js/client' export type AppSuiInitialize = Omit @@ -31,9 +36,7 @@ export function sleep(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)) } -const suiConnection = new JsonRpcProvider( - new Connection({ fullnode: 'https://fullnode.testnet.sui.io/' }) -) +const suiConnection = new SuiClient({ url: 'https://fullnode.testnet.sui.io/' }) export const signTransactionBlock = async (tx: TransactionBlock, account: Ed25519Keypair) => { const transactionBlockBytes = await tx.build({ provider: suiConnection, @@ -81,4 +84,4 @@ export const parseRequest = (request: RequestContent, sessionId: string): SuiReq return customRequest } } -} \ No newline at end of file +} diff --git a/sdk/apps/sui/tsconfig.json b/sdk/apps/sui/tsconfig.json index 75a9ae75..1f183297 100644 --- a/sdk/apps/sui/tsconfig.json +++ b/sdk/apps/sui/tsconfig.json @@ -26,5 +26,6 @@ "ts-node": { "require": ["tsconfig-paths/register"] }, - "include": ["../../bindings/*", "src/*"] + "include": ["../../bindings/*", "src/*"], + "exclude": ["node_modules", "dist"] } diff --git a/sdk/packages/selector-polkadot/package.json b/sdk/packages/selector-polkadot/package.json index bca283e9..5de2ac65 100644 --- a/sdk/packages/selector-polkadot/package.json +++ b/sdk/packages/selector-polkadot/package.json @@ -1,6 +1,6 @@ { "name": "@nightlylabs/wallet-selector-polkadot", - "version": "0.1.2", + "version": "0.1.3", "description": "", "type": "module", "exports": { diff --git a/sdk/packages/selector-polkadot/src/adapter.ts b/sdk/packages/selector-polkadot/src/adapter.ts index 1f6ff099..316beeca 100644 --- a/sdk/packages/selector-polkadot/src/adapter.ts +++ b/sdk/packages/selector-polkadot/src/adapter.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-empty-function */ import { AppPolkadot, AppPolkadotInitialize } from '@nightlylabs/nightly-connect-polkadot' import { - MetadataWallet, + type MetadataWallet, NightlyConnectSelectorModal, XMLOptions, clearRecentStandardWalletForNetwork, @@ -114,6 +114,42 @@ export class NightlyConnectAdapter implements Injected { this._modal.walletsList = list } } + + public static initApp = async ( + appInitData: AppSelectorInitialize + ): Promise<[AppPolkadot, MetadataWallet[]]> => { + try { + return await Promise.all([ + AppPolkadot.build(appInitData), + AppPolkadot.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') + .then((list) => + list.map((wallet) => ({ + name: wallet.name, + icon: wallet.image.default, + deeplink: wallet.mobile, + link: wallet.homepage + })) + ) + .catch(() => [] as MetadataWallet[]) + ]) + } catch { + clearSessionIdForNetwork(appInitData.network) + return await Promise.all([ + AppPolkadot.build(appInitData), + AppPolkadot.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') + .then((list) => + list.map((wallet) => ({ + name: wallet.name, + icon: wallet.image.default, + deeplink: wallet.mobile, + link: wallet.homepage + })) + ) + .catch(() => [] as MetadataWallet[]) + ]) + } + } + public static build = async ( appInitData: AppSelectorInitialize, useEagerConnect?: boolean, @@ -144,19 +180,7 @@ export class NightlyConnectAdapter implements Injected { uiOverrides?.qrConfigOverride ) - const [app, metadataWallets] = await Promise.all([ - AppPolkadot.build(appInitData), - AppPolkadot.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') - .then((list) => - list.map((wallet) => ({ - name: wallet.name, - icon: wallet.image.default, - deeplink: wallet.mobile, - link: wallet.homepage - })) - ) - .catch(() => [] as MetadataWallet[]) - ]) + const [app, metadataWallets] = await NightlyConnectAdapter.initApp(appInitData) adapter._app = app adapter._metadataWallets = metadataWallets @@ -201,19 +225,7 @@ export class NightlyConnectAdapter implements Injected { adapter._loading = true - Promise.all([ - AppPolkadot.build(appInitData), - AppPolkadot.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') - .then((list) => - list.map((wallet) => ({ - name: wallet.name, - icon: wallet.image.default, - deeplink: wallet.mobile, - link: wallet.homepage - })) - ) - .catch(() => [] as MetadataWallet[]) - ]).then(([app, metadataWallets]) => { + NightlyConnectAdapter.initApp(appInitData).then(([app, metadataWallets]) => { adapter._app = app adapter._metadataWallets = metadataWallets adapter.walletsList = getPolkadotWalletsList( @@ -429,19 +441,9 @@ export class NightlyConnectAdapter implements Injected { if (!this._app) { try { - const [app, metadataWallets] = await Promise.all([ - AppPolkadot.build(this._appInitData), - AppPolkadot.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') - .then((list) => - list.map((wallet) => ({ - name: wallet.name, - icon: wallet.image.default, - deeplink: wallet.mobile, - link: wallet.homepage - })) - ) - .catch(() => [] as MetadataWallet[]) - ]) + const [app, metadataWallets] = await NightlyConnectAdapter.initApp( + this._appInitData + ) this._app = app this._metadataWallets = metadataWallets @@ -503,16 +505,20 @@ export class NightlyConnectAdapter implements Injected { } this._app.on('userConnected', () => { - if (this._chosenMobileWalletName) { - persistRecentStandardWalletForNetwork(this._chosenMobileWalletName, this.network) - } else { - clearRecentStandardWalletForNetwork(this.network) + try { + if (this._chosenMobileWalletName) { + persistRecentStandardWalletForNetwork(this._chosenMobileWalletName, this.network) + } else { + clearRecentStandardWalletForNetwork(this.network) + } + this._connected = true + this._connecting = false + this._appSessionActive = true + this._modal?.closeModal() + resolve() + } catch { + this.disconnect() } - this._connected = true - this._connecting = false - this._appSessionActive = true - this._modal?.closeModal() - resolve() }) if (this._modal) { diff --git a/sdk/packages/selector-solana/package.json b/sdk/packages/selector-solana/package.json index 71487986..bce3b93d 100644 --- a/sdk/packages/selector-solana/package.json +++ b/sdk/packages/selector-solana/package.json @@ -1,6 +1,6 @@ { "name": "@nightlylabs/wallet-selector-solana", - "version": "0.2.2", + "version": "0.2.3", "description": "", "type": "module", "exports": { diff --git a/sdk/packages/selector-solana/src/adapter.ts b/sdk/packages/selector-solana/src/adapter.ts index ac9da46b..18bb5799 100644 --- a/sdk/packages/selector-solana/src/adapter.ts +++ b/sdk/packages/selector-solana/src/adapter.ts @@ -109,6 +109,41 @@ export class NightlyConnectAdapter extends BaseMessageSignerWalletAdapter { } } + public static initApp = async ( + appInitData: AppInitData + ): Promise<[AppSolana, MetadataWallet[]]> => { + try { + return await Promise.all([ + AppSolana.build(appInitData), + AppSolana.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') + .then((list) => + list.map((wallet) => ({ + name: wallet.name, + icon: wallet.image.default, + deeplink: wallet.mobile, + link: wallet.homepage + })) + ) + .catch(() => [] as MetadataWallet[]) + ]) + } catch { + clearSessionIdForNetwork(SOLANA_NETWORK) + return await Promise.all([ + AppSolana.build(appInitData), + AppSolana.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') + .then((list) => + list.map((wallet) => ({ + name: wallet.name, + icon: wallet.image.default, + deeplink: wallet.mobile, + link: wallet.homepage + })) + ) + .catch(() => [] as MetadataWallet[]) + ]) + } + } + public static build = async ( appInitData: AppInitData, eagerConnectForStandardWallets?: boolean, @@ -144,19 +179,7 @@ export class NightlyConnectAdapter extends BaseMessageSignerWalletAdapter { uiOverrides?.qrConfigOverride ) - const [app, metadataWallets] = await Promise.all([ - AppSolana.build(appInitData), - AppSolana.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') - .then((list) => - list.map((wallet) => ({ - name: wallet.name, - icon: wallet.image.default, - deeplink: wallet.mobile, - link: wallet.homepage - })) - ) - .catch(() => [] as MetadataWallet[]) - ]) + const [app, metadataWallets] = await NightlyConnectAdapter.initApp(appInitData) adapter._app = app adapter._metadataWallets = metadataWallets @@ -207,19 +230,7 @@ export class NightlyConnectAdapter extends BaseMessageSignerWalletAdapter { adapter._loading = true - Promise.all([ - AppSolana.build(appInitData), - AppSolana.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') - .then((list) => - list.map((wallet) => ({ - name: wallet.name, - icon: wallet.image.default, - deeplink: wallet.mobile, - link: wallet.homepage - })) - ) - .catch(() => [] as MetadataWallet[]) - ]).then(([app, metadataWallets]) => { + NightlyConnectAdapter.initApp(appInitData).then(([app, metadataWallets]) => { adapter._app = app adapter._metadataWallets = metadataWallets @@ -429,19 +440,9 @@ export class NightlyConnectAdapter extends BaseMessageSignerWalletAdapter { if (!this._app) { try { - const [app, metadataWallets] = await Promise.all([ - AppSolana.build(this._appInitData), - AppSolana.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') - .then((list) => - list.map((wallet) => ({ - name: wallet.name, - icon: wallet.image.default, - deeplink: wallet.mobile, - link: wallet.homepage - })) - ) - .catch(() => [] as MetadataWallet[]) - ]) + const [app, metadataWallets] = await NightlyConnectAdapter.initApp( + this._appInitData + ) this._app = app this._metadataWallets = metadataWallets @@ -506,18 +507,22 @@ export class NightlyConnectAdapter extends BaseMessageSignerWalletAdapter { } this._app.on('userConnected', (e) => { - if (this._chosenMobileWalletName) { - persistRecentStandardWalletForNetwork(this._chosenMobileWalletName, SOLANA_NETWORK) - } else { - clearRecentStandardWalletForNetwork(SOLANA_NETWORK) + try { + if (this._chosenMobileWalletName) { + persistRecentStandardWalletForNetwork(this._chosenMobileWalletName, SOLANA_NETWORK) + } else { + clearRecentStandardWalletForNetwork(SOLANA_NETWORK) + } + this._publicKey = new PublicKey(e.publicKeys[0]) + this._connected = true + this._connecting = false + this._appSessionActive = true + this.emit('connect', this._publicKey) + this._modal?.closeModal() + resolve() + } catch { + this.disconnect() } - this._publicKey = new PublicKey(e.publicKeys[0]) - this._connected = true - this._connecting = false - this._appSessionActive = true - this.emit('connect', this._publicKey) - this._modal?.closeModal() - resolve() }) if (this._modal) { this._modal.onClose = () => { diff --git a/sdk/packages/selector-sui/package.json b/sdk/packages/selector-sui/package.json index 4664a9be..1abb94de 100644 --- a/sdk/packages/selector-sui/package.json +++ b/sdk/packages/selector-sui/package.json @@ -1,6 +1,6 @@ { "name": "@nightlylabs/wallet-selector-sui", - "version": "0.2.2", + "version": "0.2.3", "description": "", "type": "module", "exports": { @@ -24,11 +24,11 @@ "author": "", "license": "ISC", "dependencies": { - "@mysten/sui.js": "^0.37.1", - "@mysten/wallet-adapter-wallet-standard": "^0.7.12", - "@mysten/wallet-standard": "^0.5.12", - "@mysten/wallet-adapter-base": "^0.7.12", - "@nightlylabs/nightly-connect-sui": "0.0.25", + "@mysten/sui.js": "^0.42.0", + "@mysten/wallet-adapter-wallet-standard": "^0.8.0", + "@mysten/wallet-standard": "^0.8.0", + "@mysten/wallet-adapter-base": "^0.9.0", + "@nightlylabs/nightly-connect-sui": "0.0.26", "@nightlylabs/wallet-selector-base": "0.2.2", "@wallet-standard/core": "^1.0.3", "bs58": "^4.0.1", @@ -45,4 +45,4 @@ "tslib": "^2.5.3", "typescript": "^5.1.3" } -} +} \ No newline at end of file diff --git a/sdk/packages/selector-sui/src/adapter.ts b/sdk/packages/selector-sui/src/adapter.ts index 81c289e8..a0123c78 100644 --- a/sdk/packages/selector-sui/src/adapter.ts +++ b/sdk/packages/selector-sui/src/adapter.ts @@ -1,18 +1,13 @@ /* eslint-disable @typescript-eslint/no-empty-function */ -import { - SignedMessage, - SignedTransaction, - SuiTransactionBlockResponse, - publicKeyFromSerialized -} from '@mysten/sui.js' -import { WalletAdapter } from '@mysten/wallet-adapter-base' +import { publicKeyFromRawBytes } from '@mysten/sui.js/verify' import { StandardWalletAdapter } from '@mysten/wallet-adapter-wallet-standard' import type { - StandardWalletAdapterWallet, - SuiSignAndExecuteTransactionBlockInput, - SuiSignMessageInput, - SuiSignTransactionBlockInput + SuiSignAndExecuteTransactionBlockMethod, + SuiSignPersonalMessageMethod, + SuiSignTransactionBlockMethod } from '@mysten/wallet-standard' + +import { type StandardWalletAdapterConfig } from '@mysten/wallet-adapter-wallet-standard/dist/StandardWalletAdapter' import { SUI_CHAINS } from '@mysten/wallet-standard' import { AppSui, SUI_NETWORK } from '@nightlylabs/nightly-connect-sui' import { @@ -38,11 +33,13 @@ import { import type { StandardEventsOnMethod, WalletAccount } from '@wallet-standard/core' import bs58 from 'bs58' import { suiWalletsFilter } from './detection' + export const convertBase58toBase64 = (base58: string) => { const buffer = bs58.decode(base58) return buffer.toString('base64') } -export class NightlyConnectSuiAdapter implements WalletAdapter { +export class NightlyConnectSuiAdapter { + // TODO: add later "implements WalletAdapter" name = 'Nightly Connect' as const icon = logoBase64 connected = false @@ -96,6 +93,39 @@ export class NightlyConnectSuiAdapter implements WalletAdapter { return this._innerStandardAdapter.on(event, listener) } + public static initApp = async (appInitData: AppInitData): Promise<[AppSui, MetadataWallet[]]> => { + try { + return await Promise.all([ + AppSui.build(appInitData), + AppSui.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') + .then((list) => + list.map((wallet) => ({ + name: wallet.name, + icon: wallet.image.default, + deeplink: wallet.mobile, + link: wallet.homepage + })) + ) + .catch(() => [] as MetadataWallet[]) + ]) + } catch { + clearSessionIdForNetwork(SUI_NETWORK) + return await Promise.all([ + AppSui.build(appInitData), + AppSui.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') + .then((list) => + list.map((wallet) => ({ + name: wallet.name, + icon: wallet.image.default, + deeplink: wallet.mobile, + link: wallet.homepage + })) + ) + .catch(() => [] as MetadataWallet[]) + ]) + } + } + public static build = async ( appInitData: AppInitData, eagerConnectForStandardWallets?: boolean, @@ -126,19 +156,7 @@ export class NightlyConnectSuiAdapter implements WalletAdapter { uiOverrides?.qrConfigOverride ) - const [app, metadataWallets] = await Promise.all([ - AppSui.build(appInitData), - AppSui.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') - .then((list) => - list.map((wallet) => ({ - name: wallet.name, - icon: wallet.image.default, - deeplink: wallet.mobile, - link: wallet.homepage - })) - ) - .catch(() => [] as MetadataWallet[]) - ]) + const [app, metadataWallets] = await NightlyConnectSuiAdapter.initApp(appInitData) adapter._app = app adapter._metadataWallets = metadataWallets @@ -183,19 +201,7 @@ export class NightlyConnectSuiAdapter implements WalletAdapter { adapter._loading = true - Promise.all([ - AppSui.build(appInitData), - AppSui.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') - .then((list) => - list.map((wallet) => ({ - name: wallet.name, - icon: wallet.image.default, - deeplink: wallet.mobile, - link: wallet.homepage - })) - ) - .catch(() => [] as MetadataWallet[]) - ]).then(([app, metadataWallets]) => { + NightlyConnectSuiAdapter.initApp(appInitData).then(([app, metadataWallets]) => { adapter._app = app adapter._metadataWallets = metadataWallets adapter.walletsList = getWalletsList( @@ -256,19 +262,9 @@ export class NightlyConnectSuiAdapter implements WalletAdapter { if (!this._app) { try { - const [app, metadataWallets] = await Promise.all([ - AppSui.build(this._appInitData), - AppSui.getWalletsMetadata('https://nc2.nightly.app/get_wallets_metadata') - .then((list) => - list.map((wallet) => ({ - name: wallet.name, - icon: wallet.image.default, - deeplink: wallet.mobile, - link: wallet.homepage - })) - ) - .catch(() => [] as MetadataWallet[]) - ]) + const [app, metadataWallets] = await NightlyConnectSuiAdapter.initApp( + this._appInitData + ) this._app = app this._metadataWallets = metadataWallets @@ -347,8 +343,7 @@ export class NightlyConnectSuiAdapter implements WalletAdapter { this._modal?.closeModal() resolve() } catch (e) { - this._connecting = false - this.connecting = false + this.disconnect() this._modal?.closeModal() reject(e) } @@ -429,45 +424,50 @@ export class NightlyConnectSuiAdapter implements WalletAdapter { this.connecting = false } - signMessage = async (messageInput: SuiSignMessageInput): Promise => { + signPersonalMessage: SuiSignPersonalMessageMethod = async (messageInput) => { if (!this._app || !this._connectionType) { throw new Error('Wallet not ready') } switch (this._connectionType) { case ConnectionType.Nightly: { - return await this._app.signMessage(messageInput) + const message = await this._app.signMessage(messageInput) + return { + bytes: message.messageBytes, + signature: message.signature + } } case ConnectionType.WalletStandard: { if (!this._innerStandardAdapter) { throw new Error('Wallet not ready') } - return await this._innerStandardAdapter.signMessage(messageInput) + return await this._innerStandardAdapter.signPersonalMessage(messageInput) } } } - signTransactionBlock = async ( - transactionInput: SuiSignTransactionBlockInput - ): Promise => { + // + signTransactionBlock: SuiSignTransactionBlockMethod = async (transactionInput) => { if (!this._app || !this._connectionType) { throw new Error('Wallet not ready') } switch (this._connectionType) { case ConnectionType.Nightly: { return await this._app.signTransactionBlock(transactionInput) + // return { bytes: res.transactionBlockBytes, signature: res.signature } } case ConnectionType.WalletStandard: { if (!this._innerStandardAdapter) { throw new Error('Wallet not ready') } + // @ts-expect-error(remove after standard will use 0.42) return await this._innerStandardAdapter.signTransactionBlock(transactionInput) } } } - signAndExecuteTransactionBlock = async ( - transactionInput: SuiSignAndExecuteTransactionBlockInput - ): Promise => { + signAndExecuteTransactionBlock: SuiSignAndExecuteTransactionBlockMethod = async ( + transactionInput + ) => { if (!this._app || !this._connectionType) { throw new Error('Wallet not ready') } @@ -479,6 +479,7 @@ export class NightlyConnectSuiAdapter implements WalletAdapter { if (!this._innerStandardAdapter) { throw new Error('Wallet not ready') } + // @ts-expect-error(remove after standard will use 0.42) return await this._innerStandardAdapter.signAndExecuteTransactionBlock(transactionInput) } } @@ -607,8 +608,8 @@ export class NightlyConnectSuiAdapter implements WalletAdapter { } const adapter = new StandardWalletAdapter({ - wallet: wallet.standardWallet as StandardWalletAdapterWallet - }) + wallet: wallet.standardWallet + } as StandardWalletAdapterConfig) try { await adapter.connect() @@ -636,7 +637,7 @@ export class NightlyConnectSuiAdapter implements WalletAdapter { } } export const createSuiWalletAccountFromString = (publicKey: string): WalletAccount => { - const suiPk = publicKeyFromSerialized('ED25519', convertBase58toBase64(publicKey)) + const suiPk = publicKeyFromRawBytes('ED25519', bs58.decode(publicKey)) return { address: suiPk.toSuiAddress(), publicKey: suiPk.toBytes(), diff --git a/sdk/packages/selector-sui/src/detection.ts b/sdk/packages/selector-sui/src/detection.ts index 3f854813..7d456076 100644 --- a/sdk/packages/selector-sui/src/detection.ts +++ b/sdk/packages/selector-sui/src/detection.ts @@ -1,13 +1,11 @@ import { Wallet } from '@wallet-standard/core' -import { isStandardWalletAdapterCompatibleWallet } from '@mysten/wallet-standard' +import { isWalletWithRequiredFeatureSet } from '@mysten/wallet-standard' export const suiWalletsFilter = (wallet: Wallet) => { - const is = isStandardWalletAdapterCompatibleWallet(wallet, [ + const is = isWalletWithRequiredFeatureSet(wallet, [ 'sui:signAndExecuteTransactionBlock', 'sui:signTransactionBlock' ]) - console.log(wallet) - console.log(is) return is } diff --git a/sdk/pnpm-lock.yaml b/sdk/pnpm-lock.yaml index 339e7b09..979c23c2 100644 --- a/sdk/pnpm-lock.yaml +++ b/sdk/pnpm-lock.yaml @@ -123,11 +123,11 @@ importers: apps/modal-example: dependencies: '@mysten/sui.js': - specifier: ^0.37.1 - version: 0.37.1 + specifier: ^0.42.0 + version: 0.42.0 '@mysten/wallet-adapter-wallet-standard': - specifier: ^0.7.9 - version: 0.7.9 + specifier: ^0.8.0 + version: 0.8.0 '@nightlylabs/nightly-connect-polkadot': specifier: 0.0.6 version: link:../polkadot @@ -135,16 +135,16 @@ importers: specifier: 0.0.26 version: link:../solana '@nightlylabs/nightly-connect-sui': - specifier: 0.0.25 + specifier: 0.0.26 version: link:../sui '@nightlylabs/wallet-selector-polkadot': - specifier: 0.1.2 + specifier: 0.1.3 version: link:../../packages/selector-polkadot '@nightlylabs/wallet-selector-solana': - specifier: 0.2.2 + specifier: 0.2.3 version: link:../../packages/selector-solana '@nightlylabs/wallet-selector-sui': - specifier: 0.2.2 + specifier: 0.2.3 version: link:../../packages/selector-sui '@polkadot/api': specifier: ^10.9.1 @@ -202,22 +202,22 @@ importers: apps/nextjs-example: dependencies: '@mysten/sui.js': - specifier: 0.37.1 - version: 0.37.1 + specifier: 0.42.0 + version: 0.42.0 '@mysten/wallet-adapter-base': - specifier: 0.7.12 - version: 0.7.12 + specifier: 0.9.0 + version: 0.9.0 '@mysten/wallet-adapter-wallet-standard': - specifier: 0.7.12 - version: 0.7.12 + specifier: 0.8.0 + version: 0.8.0 '@mysten/wallet-kit': - specifier: 0.4.12 - version: 0.4.12(react-dom@18.2.0)(react@18.2.0) + specifier: 0.7.3 + version: 0.7.3(react-dom@18.2.0)(react@18.2.0) '@nightlylabs/wallet-selector-solana': - specifier: 0.2.2 + specifier: 0.2.3 version: link:../../packages/selector-solana '@nightlylabs/wallet-selector-sui': - specifier: 0.2.2 + specifier: 0.2.3 version: link:../../packages/selector-sui '@solana/web3.js': specifier: ^1.77.2 @@ -331,7 +331,7 @@ importers: version: 5.1.3 vite: specifier: ^4.3.9 - version: 4.3.9(@types/node@20.4.2) + version: 4.3.9(@types/node@18.11.18) apps/solana: dependencies: @@ -391,11 +391,11 @@ importers: apps/sui: dependencies: '@mysten/sui.js': - specifier: ^0.37.1 - version: 0.37.1 + specifier: ^0.42.0 + version: 0.42.0 '@mysten/wallet-standard': - specifier: ^0.5.12 - version: 0.5.12 + specifier: ^0.8.0 + version: 0.8.0 '@nightlylabs/nightly-connect-base': specifier: 0.0.25 version: link:../base @@ -413,8 +413,8 @@ importers: specifier: ^25.0.0 version: 25.0.0(rollup@3.23.1) '@rollup/plugin-node-resolve': - specifier: ^15.1.0 - version: 15.1.0(rollup@3.23.1) + specifier: ^15.2.1 + version: 15.2.1(rollup@3.23.1) '@rollup/plugin-terser': specifier: ^0.4.3 version: 0.4.3(rollup@3.23.1) @@ -550,7 +550,7 @@ importers: version: 5.0.2 vite: specifier: ^4.3.9 - version: 4.3.9(@types/node@20.4.2) + version: 4.3.9(@types/node@18.11.18) packages/qr-codes: dependencies: @@ -715,19 +715,19 @@ importers: packages/selector-sui: dependencies: '@mysten/sui.js': - specifier: ^0.37.1 - version: 0.37.1 + specifier: ^0.42.0 + version: 0.42.0 '@mysten/wallet-adapter-base': - specifier: ^0.7.12 - version: 0.7.12 + specifier: ^0.9.0 + version: 0.9.0 '@mysten/wallet-adapter-wallet-standard': - specifier: ^0.7.12 - version: 0.7.12 + specifier: ^0.8.0 + version: 0.8.0 '@mysten/wallet-standard': - specifier: ^0.5.12 - version: 0.5.12 + specifier: ^0.8.0 + version: 0.8.0 '@nightlylabs/nightly-connect-sui': - specifier: 0.0.25 + specifier: 0.0.26 version: link:../../apps/sui '@nightlylabs/wallet-selector-base': specifier: 0.2.2 @@ -4825,29 +4825,30 @@ packages: resolution: {integrity: sha512-H1rQc1ZOHANWBvPcW+JpGwr+juXSxM8Q8YCkm3GhZd8REu1fHR3z99CErO1p9pkcfcxZnMdIZdIsXkOHY0NilA==} dev: false - /@mysten/bcs@0.7.1: - resolution: {integrity: sha512-wFPb8bkhwrbiStfZMV5rFM7J+umpke59/dNjDp+UYJKykNlW23LCk2ePyEUvGdb62HGJM1jyOJ8g4egE3OmdKA==} + /@mysten/bcs@0.7.3: + resolution: {integrity: sha512-fbusBfsyc2MpTACi72H5edWJ670T84va+qn9jSPpb5BzZ+pzUM1Q0ApPrF5OT+mB1o5Ng+mxPQpBCZQkfiV2TA==} dependencies: bs58: 5.0.0 dev: false - /@mysten/bcs@0.7.3: - resolution: {integrity: sha512-fbusBfsyc2MpTACi72H5edWJ670T84va+qn9jSPpb5BzZ+pzUM1Q0ApPrF5OT+mB1o5Ng+mxPQpBCZQkfiV2TA==} + /@mysten/bcs@0.7.4: + resolution: {integrity: sha512-6DKzM4L10Au3Og5EJRBqJZmXWZ7hS/clVjbVUH4sA0aFtS3AZo2xc+r5fUFfdJbaWZUxVaDiQ8BNiEZWkAnEOw==} dependencies: bs58: 5.0.0 dev: false - /@mysten/sui.js@0.35.1: - resolution: {integrity: sha512-1UQ65oJhO+G5Bt+EWYqMs5y3eqY1ZZxEdB2y4K+XJVeRZBOy32GjSLiYmZufUAR9o53gAlwAvvNRIzMzuiNQzw==} + /@mysten/sui.js@0.40.0: + resolution: {integrity: sha512-PEGdMe+QgpIdDIpyO4/yb+CK4x3Hki+kYPbQ5n3DVsWyb2ztFwB+5oYdc7qG3QkniO1lnCrlSHqZ5mN+x3RzrQ==} engines: {node: '>=16'} dependencies: - '@mysten/bcs': 0.7.1 - '@noble/curves': 1.0.0 - '@noble/hashes': 1.3.0 + '@mysten/bcs': 0.7.3 + '@noble/curves': 1.1.0 + '@noble/hashes': 1.3.1 '@open-rpc/client-js': 1.8.1 - '@scure/bip32': 1.3.0 - '@scure/bip39': 1.2.0 + '@scure/bip32': 1.3.2 + '@scure/bip39': 1.2.1 '@suchipi/femver': 1.0.0 + events: 3.3.0 superstruct: 1.0.3 tweetnacl: 1.0.3 transitivePeerDependencies: @@ -4856,16 +4857,16 @@ packages: - utf-8-validate dev: false - /@mysten/sui.js@0.37.1: - resolution: {integrity: sha512-nEOqnjUqb/VJcVk23LgZOX1FmBib/mBCwAWaJhtsCHLwv2jIAfCPY/fpB9lJ62QHrM8UFclpWxsLkqcUkKyPgA==} + /@mysten/sui.js@0.42.0: + resolution: {integrity: sha512-khYpfrWTRNk7WTuDWJx/KCbleqY1B40gVRt1DttqlNkD2lvg134xZn7F/r94jxgnUETbK+hVoQvBY7F36MsfRw==} engines: {node: '>=16'} dependencies: - '@mysten/bcs': 0.7.3 - '@noble/curves': 1.0.0 - '@noble/hashes': 1.3.0 + '@mysten/bcs': 0.7.4 + '@noble/curves': 1.1.0 + '@noble/hashes': 1.3.1 '@open-rpc/client-js': 1.8.1 - '@scure/bip32': 1.3.0 - '@scure/bip39': 1.2.0 + '@scure/bip32': 1.3.2 + '@scure/bip39': 1.2.1 '@suchipi/femver': 1.0.0 events: 3.3.0 superstruct: 1.0.3 @@ -4876,91 +4877,53 @@ packages: - utf-8-validate dev: false - /@mysten/wallet-adapter-base@0.7.12: - resolution: {integrity: sha512-5xDLaZ11+Sw65I9VSzmsHlue8jV0Kq/HiBJYmQes5TU2clwV0ClNBlw7CCipkMPi6IfhBSaaLXWZ9ftX0KG1TQ==} + /@mysten/wallet-adapter-base@0.9.0: + resolution: {integrity: sha512-Obcfd30AC0Tcyvqc9+h0vvjrRB6Td2PNWhxRlTq/hSxDY66M3XqTLgoO8wDBtz+91oga4obAYvM02m7xV7X0Zw==} + deprecated: Wallet adapters have been deprecated in favor of the Wallet Standard. Please upgrade to the latest Wallet Kit versions. dependencies: - '@mysten/sui.js': 0.37.1 - '@mysten/wallet-standard': 0.5.12 + '@mysten/sui.js': 0.40.0 + '@mysten/wallet-standard': 0.6.0 transitivePeerDependencies: - bufferutil - encoding - utf-8-validate dev: false - /@mysten/wallet-adapter-base@0.7.9: - resolution: {integrity: sha512-5ukbi59E/OObv0UPbgqQEh4L4wnFfuXnNt22oe9M/5EKwlQ/y82mtWRpPqEqfazPI2gVvtUyKLCf5uelA0aJIw==} + /@mysten/wallet-adapter-wallet-standard@0.8.0: + resolution: {integrity: sha512-WPQSQTUvQCX2PPuVU8NHEzXg+mMCzIKqMG6llt0tLxc4enTtFHw9Do4i298NyZ00zWWzHdx9MXjBOl1OuybURg==} + deprecated: Wallet adapters have been deprecated in favor of the Wallet Standard. Please upgrade to the latest Wallet Kit versions. dependencies: - '@mysten/sui.js': 0.35.1 - '@mysten/wallet-standard': 0.5.9 + '@mysten/sui.js': 0.40.0 + '@mysten/wallet-adapter-base': 0.9.0 + '@mysten/wallet-standard': 0.6.0 + mitt: 3.0.1 transitivePeerDependencies: - bufferutil - encoding - utf-8-validate dev: false - /@mysten/wallet-adapter-unsafe-burner@0.8.12: - resolution: {integrity: sha512-s0ek8KIc483jK954INNguDtsCgMsA5L/Zow8gQ15gPQKCIzwSbFnv5JOhrBgHTqDrv5jkjPAfp4AeesXXQHOqg==} + /@mysten/wallet-kit-core@0.6.3: + resolution: {integrity: sha512-Crm18bHFecxqDI6ZGhHCAOB8CpLQ84NB3RFpvYnyk0yDGzNcYahjaG37ns+M7cHp0jbg64ySRV/ETzOaGPfRIw==} dependencies: - '@mysten/sui.js': 0.37.1 - '@mysten/wallet-adapter-base': 0.7.12 - '@mysten/wallet-standard': 0.5.12 + '@mysten/sui.js': 0.42.0 + '@mysten/wallet-standard': 0.8.0 transitivePeerDependencies: - bufferutil - encoding - utf-8-validate dev: false - /@mysten/wallet-adapter-wallet-standard@0.7.12: - resolution: {integrity: sha512-3Km3nsbggIHoaefsPEX2rNFD7+bamk6JBs4jhtOfTFYzXWK3FjWisMEDZFwx+EvoQTH/9lhxgwVRJqPHCv4/yA==} - dependencies: - '@mysten/sui.js': 0.37.1 - '@mysten/wallet-adapter-base': 0.7.12 - '@mysten/wallet-standard': 0.5.12 - mitt: 3.0.0 - transitivePeerDependencies: - - bufferutil - - encoding - - utf-8-validate - dev: false - - /@mysten/wallet-adapter-wallet-standard@0.7.9: - resolution: {integrity: sha512-+wTBzIr6mT9G2KvXDLr0yg1EsZ8PvAKM0nZFAwRf5htGILIITPR3UEX+2ugxc+Ec4Gx/+NQxYd/TfMSA+iHBNg==} - dependencies: - '@mysten/sui.js': 0.35.1 - '@mysten/wallet-adapter-base': 0.7.9 - '@mysten/wallet-standard': 0.5.9 - mitt: 3.0.0 - transitivePeerDependencies: - - bufferutil - - encoding - - utf-8-validate - dev: false - - /@mysten/wallet-kit-core@0.4.12: - resolution: {integrity: sha512-h2NXFiUdB3NpBpcHW8SkFCGFyqDkaj3WyML8IgT6otlYgc9v2hl7Wjm7Uc7V4kSf0pM/vwZnG8hh7vMCts7MFA==} - dependencies: - '@mysten/sui.js': 0.37.1 - '@mysten/wallet-adapter-base': 0.7.12 - '@mysten/wallet-standard': 0.5.12 - transitivePeerDependencies: - - bufferutil - - encoding - - utf-8-validate - dev: false - - /@mysten/wallet-kit@0.4.12(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-D/Uh0m8HAVnL0mSdqoE5UsmJhtioqhVHVXDqPrnzbclUZWaq9+e16C8LiP/Bc5mf3/C/24boBTLf9kl/Zd0FiQ==} + /@mysten/wallet-kit@0.7.3(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-wkmVny9Cqu2AiLf7FW3wq11+XNOoCi/gQ6ZiKcMsRmTWT8uoP7BG89lsIkP98lOARUa/GaWjTItESiHBNYXcZw==} peerDependencies: react: '*' react-dom: '*' dependencies: '@headlessui/react': 1.7.15(react-dom@18.2.0)(react@18.2.0) - '@mysten/sui.js': 0.37.1 - '@mysten/wallet-adapter-base': 0.7.12 - '@mysten/wallet-adapter-unsafe-burner': 0.8.12 - '@mysten/wallet-adapter-wallet-standard': 0.7.12 - '@mysten/wallet-kit-core': 0.4.12 - '@mysten/wallet-standard': 0.5.12 + '@mysten/sui.js': 0.42.0 + '@mysten/wallet-kit-core': 0.6.3 + '@mysten/wallet-standard': 0.8.0 '@stitches/react': 1.2.8(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) @@ -4970,10 +4933,10 @@ packages: - utf-8-validate dev: false - /@mysten/wallet-standard@0.5.12: - resolution: {integrity: sha512-RDKEhBf8aNbCXgTGsDAA7uzpkll24O9M/C48wHFjeb9edIxhaDkiSeGty6flhg9G5ShAHP76dEbz5z6z3ODmCA==} + /@mysten/wallet-standard@0.6.0: + resolution: {integrity: sha512-xE/OijN9zIPoTjTWuxlYMHtp7kXPcAR8dDAbxOIH5h7EZCTk+G6p+SzDp8jV5magf50VcYP0cVjS4CQLx1wQuQ==} dependencies: - '@mysten/sui.js': 0.37.1 + '@mysten/sui.js': 0.40.0 '@wallet-standard/core': 1.0.3 transitivePeerDependencies: - bufferutil @@ -4981,10 +4944,10 @@ packages: - utf-8-validate dev: false - /@mysten/wallet-standard@0.5.9: - resolution: {integrity: sha512-il7pgizfhSrCEX4yVEZu/8f4rs6/FUTP72oX34jtNjAHbRtYaI+aFSuLg8G2D0BbPqPumAjOSfluQ6OVyJGLfQ==} + /@mysten/wallet-standard@0.8.0: + resolution: {integrity: sha512-kFh1iybKxaY+lchN+rtVBT5+UL1IHorZ81Ktg9200tcLeUqLB3V/K1PRqkj2dk0eUGDaLEH+yWjBF9hnyH4rgQ==} dependencies: - '@mysten/sui.js': 0.35.1 + '@mysten/sui.js': 0.42.0 '@wallet-standard/core': 1.0.3 transitivePeerDependencies: - bufferutil @@ -5102,6 +5065,12 @@ packages: dependencies: '@noble/hashes': 1.3.1 + /@noble/curves@1.2.0: + resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==} + dependencies: + '@noble/hashes': 1.3.2 + dev: false + /@noble/hashes@1.3.0: resolution: {integrity: sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==} dev: false @@ -5110,6 +5079,11 @@ packages: resolution: {integrity: sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==} engines: {node: '>= 16'} + /@noble/hashes@1.3.2: + resolution: {integrity: sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==} + engines: {node: '>= 16'} + dev: false + /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -5650,6 +5624,24 @@ packages: resolve: 1.22.2 rollup: 3.23.1 + /@rollup/plugin-node-resolve@15.2.1(rollup@3.23.1): + resolution: {integrity: sha512-nsbUg588+GDSu8/NS8T4UAshO6xeaOfINNuXeVHcKV02LJtoRaM1SiOacClw4kws1SFiNhdLGxlbMY9ga/zs/w==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^2.78.0||^3.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.0.2(rollup@3.23.1) + '@types/resolve': 1.20.2 + deepmerge: 4.3.1 + is-builtin-module: 3.2.1 + is-module: 1.0.0 + resolve: 1.22.2 + rollup: 3.23.1 + dev: true + /@rollup/plugin-terser@0.4.3(rollup@3.23.1): resolution: {integrity: sha512-EF0oejTMtkyhrkwCdg0HJ0IpkcaVg1MMSf2olHb2Jp+1mnLM04OhjpJWGma4HobiDTF0WCyViWuvadyE9ch2XA==} engines: {node: '>=14.0.0'} @@ -5764,18 +5756,22 @@ packages: /@scure/base@1.1.1: resolution: {integrity: sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==} - /@scure/bip32@1.3.0: - resolution: {integrity: sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q==} + /@scure/base@1.1.3: + resolution: {integrity: sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q==} + dev: false + + /@scure/bip32@1.3.2: + resolution: {integrity: sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==} dependencies: - '@noble/curves': 1.0.0 - '@noble/hashes': 1.3.0 - '@scure/base': 1.1.1 + '@noble/curves': 1.2.0 + '@noble/hashes': 1.3.2 + '@scure/base': 1.1.3 dev: false - /@scure/bip39@1.2.0: - resolution: {integrity: sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg==} + /@scure/bip39@1.2.1: + resolution: {integrity: sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==} dependencies: - '@noble/hashes': 1.3.0 + '@noble/hashes': 1.3.1 '@scure/base': 1.1.1 dev: false @@ -6327,7 +6323,7 @@ packages: remark-slug: 6.1.0 rollup: 3.23.1 typescript: 5.0.2 - vite: 4.3.9(@types/node@20.4.2) + vite: 4.3.9(@types/node@18.11.18) transitivePeerDependencies: - supports-color dev: true @@ -12951,8 +12947,8 @@ packages: minipass: 3.3.6 yallist: 4.0.0 - /mitt@3.0.0: - resolution: {integrity: sha512-7dX2/10ITVyqh4aOSVI9gdape+t9l2/8QxHrFmUXu4EEUpdlxl6RudZUPZoc+zuY2hk1j7XxVroIVIan/pD/SQ==} + /mitt@3.0.1: + resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==} dev: false /mkdirp-classic@0.5.3: