From c080c33c3719ca934c4ccff6c66cb3bad91ef40e Mon Sep 17 00:00:00 2001 From: sven Tan Date: Sun, 14 Jul 2024 23:03:31 +0800 Subject: [PATCH] update sdk gen & fix bitcoin auth length (#2177) --- pnpm-lock.yaml | 11 ++ sdk/typescript/rooch-sdk/package.json | 3 +- sdk/typescript/rooch-sdk/src/client/client.ts | 14 +- .../rooch-sdk/src/client/types/generated.ts | 158 +++++++++++------- .../rooch-sdk/src/client/types/params.ts | 15 +- .../src/crypto/authenticator.test.ts | 9 - .../rooch-sdk/src/crypto/authenticator.ts | 15 +- .../src/keypairs/secp256k1/keypair.ts | 5 +- .../rooch-sdk/src/session/session.ts | 9 +- sdk/typescript/rooch-sdk/src/utils/bytes.ts | 73 +++++++- .../rooch-sdk/test-e2e/case/session.test.ts | 20 ++- .../templates/react-counter/src/main.tsx | 2 +- 12 files changed, 227 insertions(+), 107 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 32233ebc4e..4ed58ef587 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -399,6 +399,9 @@ importers: bech32: specifier: ^2.0.0 version: 2.0.0 + buffer: + specifier: 6.0.0 + version: 6.0.0 tweetnacl: specifier: ^1.0.3 version: 1.0.3 @@ -4069,6 +4072,9 @@ packages: buffer@5.7.1: resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} + buffer@6.0.0: + resolution: {integrity: sha512-Sxdxq98A+Y9kRjO/3+mc2IAxIyTAKqzBiYKpeo5EluWnw9535rI4fN8DeMGsiQqpqqaWtFtTdxQgHnku6IEjCA==} + buffer@6.0.3: resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} @@ -13226,6 +13232,11 @@ snapshots: base64-js: 1.5.1 ieee754: 1.2.1 + buffer@6.0.0: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + buffer@6.0.3: dependencies: base64-js: 1.5.1 diff --git a/sdk/typescript/rooch-sdk/package.json b/sdk/typescript/rooch-sdk/package.json index 9221225452..4a9f12e431 100644 --- a/sdk/typescript/rooch-sdk/package.json +++ b/sdk/typescript/rooch-sdk/package.json @@ -65,7 +65,8 @@ "tweetnacl": "^1.0.3", "bech32": "^2.0.0", "@mysten/bcs": "1.0.2", - "valibot": "^0.25.0" + "valibot": "^0.25.0", + "buffer": "6.0.0" }, "publishConfig": { "access": "public", diff --git a/sdk/typescript/rooch-sdk/src/client/client.ts b/sdk/typescript/rooch-sdk/src/client/client.ts index c7e7923992..9ec3801b40 100644 --- a/sdk/typescript/rooch-sdk/src/client/client.ts +++ b/sdk/typescript/rooch-sdk/src/client/client.ts @@ -27,7 +27,7 @@ import { PaginationArguments, PaginationResult, SessionInfoView, - StateView, + ObjectStateView, QueryUTXOsParams, PaginatedUTXOStateViews, PaginatedInscriptionStateViews, @@ -148,13 +148,13 @@ export class RoochClient { } // Get the states by access_path - async getStates(params: GetStatesParams): Promise { + async getStates(params: GetStatesParams): Promise { const result = await this.transport.request({ method: 'rooch_getStates', params: [params.accessPath, params.stateOption], }) - const typedResult = result as unknown as StateView[] + const typedResult = result as unknown as ObjectStateView[] return typedResult[0] === null ? [] : typedResult } @@ -364,9 +364,11 @@ export class RoochClient { // Maybe we should define the type? const tableId = ( ( - ((states[0].decoded_value as AnnotatedMoveStructView).value['value'] as AnnotatedMoveStructView).value[ - 'keys' - ] as AnnotatedMoveStructView + ( + (states[0].decoded_value as AnnotatedMoveStructView).value[ + 'value' + ] as AnnotatedMoveStructView + ).value['keys'] as AnnotatedMoveStructView ).value['handle'] as AnnotatedMoveStructView ).value['id'] as string diff --git a/sdk/typescript/rooch-sdk/src/client/types/generated.ts b/sdk/typescript/rooch-sdk/src/client/types/generated.ts index 76ed8ad902..f236a5367d 100644 --- a/sdk/typescript/rooch-sdk/src/client/types/generated.ts +++ b/sdk/typescript/rooch-sdk/src/client/types/generated.ts @@ -78,12 +78,7 @@ export type EventFilterView = to_order: string } } -/** - * A struct that represents a globally unique id for an Event stream that a user can listen to. the - * Unique ID is a combination of event handle id and event seq number. the ID is local to this - * particular fullnode and will be different from other fullnode. - */ -export interface EventID { +export interface EventIDView { /** each event handle corresponds to a unique event handle id. event handler id equal to guid. */ event_handle_id: string /** For expansion: The number of messages that have been emitted to the path previously */ @@ -96,7 +91,7 @@ export interface EventOptions { export interface EventView { decoded_event_data?: AnnotatedMoveStructView | null event_data: string - event_id: EventID + event_id: EventIDView event_index: string event_type: string } @@ -105,20 +100,6 @@ export interface ExecuteTransactionResponseView { output?: TransactionOutputView | null sequence_info: TransactionSequenceInfoView } -export type FieldChangeView = - | { - fields: FieldChangeView[] - key: string - key_state: string - op?: OpView_for_StateView | null - type: 'object' - } - | { - key: string - key_state: string - op: OpView_for_StateView - type: 'normal' - } export interface FunctionCallView { args: string[] function_id: string @@ -128,7 +109,7 @@ export interface FunctionReturnValueView { type_tag: string value: string } -export interface IndexerEventID { +export interface IndexerEventIDView { event_index: string tx_order: string } @@ -136,9 +117,9 @@ export interface IndexerEventView { created_at: string decoded_event_data?: AnnotatedMoveStructView | null event_data: string - event_id: EventID + event_id: EventIDView event_type: string - indexer_event_id: IndexerEventID + indexer_event_id: IndexerEventIDView sender: string tx_hash: string } @@ -153,18 +134,18 @@ export interface IndexerObjectStateView { owner_bitcoin_address?: string | null size: string state_index: string - state_root: string | null + state_root?: string | null tx_order: string updated_at: string /** bcs bytes of the Object. */ value: string } -export interface IndexerStateID { +export interface IndexerStateIDView { state_index: string tx_order: string } export type InscriptionFilterView = - /** Query by owner, represent by bitcoin address */ + /** Query by owner, support rooch address and bitcoin address */ | { owner: string } /** Query by inscription id, represent by bitcoin txid and index */ @@ -181,11 +162,13 @@ export type InscriptionFilterView = export interface InscriptionStateView { created_at: string flag: number - object_id: string + id: string object_type: string owner: string owner_bitcoin_address?: string | null + size: string state_index: string + state_root?: string | null tx_order: string updated_at: string value: InscriptionView @@ -253,6 +236,17 @@ export type LedgerTxDataView = sequence_number: string type: 'l2_tx' } +/** A Move module ABI */ +export interface ModuleABIView { + address: string + /** Friends of the module */ + friends: string[] + /** Public or entry functions of the module */ + functions: MoveFunctionView[] + name: string + /** Structs of the module */ + structs: MoveStructView[] +} export type MoveActionTypeView = 'scriptcall' | 'functioncall' | 'modulebundle' export interface MoveActionView { function_call?: FunctionCallView | null @@ -262,12 +256,65 @@ export interface MoveActionView { export interface MoveAsciiString { bytes: number[] } +/** Move function generic type param */ +export interface MoveFunctionTypeParamView { + /** Move abilities tied to the generic type param and associated with the function that uses it */ + constraints: string[] +} +/** Move function */ +export interface MoveFunctionView { + /** Whether the function can be called as an entry function directly in a transaction */ + is_entry: boolean + name: string + /** Parameters associated with the move function */ + params: string[] + /** Return type of the function */ + return: string[] + /** Generic type params associated with the Move function */ + type_params: MoveFunctionTypeParamView[] +} export interface MoveString { bytes: number[] } +/** Move struct field */ +export interface MoveStructFieldView { + name: string + type: string +} +/** Move generic type param */ +export interface MoveStructTypeParamView { + /** Move abilities tied to the generic type param and associated with the type that uses it */ + constraints: string[] + /** Whether the type is a phantom type */ + is_phantom: boolean +} +/** A move struct */ +export interface MoveStructView { + /** Abilities associated with the struct */ + abilities: string[] + /** Fields associated with the struct */ + fields: MoveStructFieldView[] + /** Whether the struct is a native struct of Move */ + is_native: boolean + name: string + /** Generic types associated with the struct */ + type_params: MoveStructTypeParamView[] +} export interface ObjectChangeView { - fields: FieldChangeView[] - op?: OpView_for_StateView | null + fields: ObjectChangeView[] + metadata: ObjectMetaView + value?: OpView | null +} +export interface ObjectMetaView { + created_at: string + flag: number + id: string + object_type: string + owner: string + owner_bitcoin_address?: string | null + size: string + state_root?: string | null + updated_at: string } export type ObjectStateFilterView = /** Query by object value type and owner. */ @@ -297,27 +344,17 @@ export interface ObjectStateView { owner: string owner_bitcoin_address?: string | null size: string - state_root: string | null + state_root?: string | null updated_at: string value: string } -export type OpView_for_StateView = +export type OpView = + | 'delete' | { - decoded_value?: AnnotatedMoveValueView | null - display_fields?: DisplayFieldsView | null - type: 'new' - value: string - value_type: string + new: string } | { - decoded_value?: AnnotatedMoveValueView | null - display_fields?: DisplayFieldsView | null - type: 'modify' - value: string - value_type: string - } - | { - type: 'delete' + modify: string } /** * `next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the @@ -327,7 +364,7 @@ export type OpView_for_StateView = export interface PaginatedBalanceInfoViews { data: BalanceInfoView[] has_next_page: boolean - next_cursor?: IndexerStateID | null + next_cursor?: IndexerStateIDView | null } /** * `next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the @@ -347,7 +384,7 @@ export interface PaginatedEventViews { export interface PaginatedIndexerEventViews { data: IndexerEventView[] has_next_page: boolean - next_cursor?: IndexerEventID | null + next_cursor?: IndexerEventIDView | null } /** * `next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the @@ -357,7 +394,7 @@ export interface PaginatedIndexerEventViews { export interface PaginatedIndexerObjectStateViews { data: IndexerObjectStateView[] has_next_page: boolean - next_cursor?: IndexerStateID | null + next_cursor?: IndexerStateIDView | null } /** * `next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the @@ -367,7 +404,7 @@ export interface PaginatedIndexerObjectStateViews { export interface PaginatedInscriptionStateViews { data: InscriptionStateView[] has_next_page: boolean - next_cursor?: IndexerStateID | null + next_cursor?: IndexerStateIDView | null } /** * `next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the @@ -397,7 +434,7 @@ export interface PaginatedTransactionWithInfoViews { export interface PaginatedUTXOStateViews { data: UTXOStateView[] has_next_page: boolean - next_cursor?: IndexerStateID | null + next_cursor?: IndexerStateIDView | null } export interface QueryOptions { /** If true, the state is decoded and the decoded value is returned in the response. */ @@ -415,14 +452,13 @@ export interface ScriptCallView { /** Some specific struct that we want to display in a special way for better readability */ export type SpecificStructView = MoveString | MoveAsciiString | string export interface StateChangeSetView { - changes: { - [key: string]: ObjectChangeView - } + changes: ObjectChangeView[] global_size: string + state_root: string } export interface StateKVView { field_key: string - state: StateView + state: ObjectStateView } export interface StateOptions { /** If true, the state is decoded and the decoded value is returned in the response. */ @@ -430,12 +466,6 @@ export interface StateOptions { /** If true, result with display rendered is returned */ showDisplay?: boolean } -export interface StateView { - decoded_value?: AnnotatedMoveValueView | null - display_fields?: DisplayFieldsView | null - value: string - value_type: string -} export interface TransactionExecutionInfoView { event_root: string gas_used: string @@ -492,7 +522,7 @@ export interface TxOptions { withOutput?: boolean } export type UTXOFilterView = - /** Query by owner, represent by bitcoin address */ + /** Query by owner, support rooch address and bitcoin address */ | { owner: string } /** Query by bitcoin outpoint, represent by bitcoin txid and vout */ @@ -509,14 +539,16 @@ export type UTXOFilterView = export interface UTXOStateView { created_at: string flag: number - object_id: string + id: string object_type: string owner: string owner_bitcoin_address?: string | null + size: string state_index: string + state_root?: string | null tx_order: string updated_at: string - value?: UTXOView | null + value: UTXOView } export interface UTXOView { /** The txid of the UTXO */ diff --git a/sdk/typescript/rooch-sdk/src/client/types/params.ts b/sdk/typescript/rooch-sdk/src/client/types/params.ts index 0afc308d40..eaf07bf5e3 100644 --- a/sdk/typescript/rooch-sdk/src/client/types/params.ts +++ b/sdk/typescript/rooch-sdk/src/client/types/params.ts @@ -14,14 +14,14 @@ import type * as RpcTypes from './generated.js' /** Query the Inscription via global index by Inscription filter */ export interface QueryInscriptionsParams { filter: RpcTypes.InscriptionFilterView - cursor?: RpcTypes.IndexerStateID | null | undefined + cursor?: RpcTypes.IndexerStateIDView | null | undefined limit?: string | null | undefined descendingOrder?: boolean | null | undefined } /** Query the UTXO via global index by UTXO filter */ export interface QueryUTXOsParams { filter: RpcTypes.UTXOFilterView - cursor?: RpcTypes.IndexerStateID | null | undefined + cursor?: RpcTypes.IndexerStateIDView | null | undefined limit?: string | null | undefined descendingOrder?: boolean | null | undefined } @@ -45,7 +45,7 @@ export interface GetBalanceParams { /** get account balances by RoochAddress */ export interface GetBalancesParams { owner: string - cursor?: RpcTypes.IndexerStateID | null | undefined + cursor?: RpcTypes.IndexerStateIDView | null | undefined limit?: string | null | undefined } export interface GetChainIDParams {} @@ -63,6 +63,11 @@ export interface GetFieldStatesParams { fieldKey: string[] stateOption?: RpcTypes.StateOptions | null | undefined } +/** get module ABI by module id */ +export interface GetModuleABIParams { + moduleAddr: string + moduleName: string +} /** Get object states by object id */ export interface GetObjectStatesParams { objectIds: string @@ -104,14 +109,14 @@ export interface ListStatesParams { /** Query the events indexer by event filter */ export interface QueryEventsParams { filter: RpcTypes.EventFilterView - cursor?: RpcTypes.IndexerEventID | null | undefined + cursor?: RpcTypes.IndexerEventIDView | null | undefined limit?: string | null | undefined queryOption?: RpcTypes.QueryOptions | null | undefined } /** Query the object states indexer by state filter */ export interface QueryObjectStatesParams { filter: RpcTypes.ObjectStateFilterView - cursor?: RpcTypes.IndexerStateID | null | undefined + cursor?: RpcTypes.IndexerStateIDView | null | undefined limit?: string | null | undefined queryOption?: RpcTypes.QueryOptions | null | undefined } diff --git a/sdk/typescript/rooch-sdk/src/crypto/authenticator.test.ts b/sdk/typescript/rooch-sdk/src/crypto/authenticator.test.ts index ce28fe11b9..acc74a981c 100644 --- a/sdk/typescript/rooch-sdk/src/crypto/authenticator.test.ts +++ b/sdk/typescript/rooch-sdk/src/crypto/authenticator.test.ts @@ -41,13 +41,4 @@ describe('BitcoinSignMessage', () => { expect(encodedData).toBeInstanceOf(Uint8Array) expect(encodedData.length).toBeLessThanOrEqual(255) }) - - it('should throw error when messageInfo length causes total length to exceed 255 bytes', () => { - const txData = new Uint8Array([0x01, 0x02, 0x03, 0x04]) - const longMessageInfo = 'A'.repeat(256) - const bitcoinSignMessage = new BitcoinSignMessage(txData, longMessageInfo) - expect(() => bitcoinSignMessage.encode()).toThrowError( - 'message info length cannot be greater than > 302', - ) - }) }) diff --git a/sdk/typescript/rooch-sdk/src/crypto/authenticator.ts b/sdk/typescript/rooch-sdk/src/crypto/authenticator.ts index 1c39780643..f8a91c13e8 100644 --- a/sdk/typescript/rooch-sdk/src/crypto/authenticator.ts +++ b/sdk/typescript/rooch-sdk/src/crypto/authenticator.ts @@ -3,7 +3,7 @@ import { bcs } from '../bcs/index.js' import { Bytes } from '../types/index.js' -import { bytes, sha256, toHEX, concatBytes } from '../utils/index.js' +import { bytes, sha256, toHEX, concatBytes, varintByteNum } from '../utils/index.js' import { Signer } from './signer.js' import { SIGNATURE_SCHEME_TO_FLAG } from './signatureScheme.js' @@ -39,7 +39,7 @@ export class BitcoinSignMessage { const infoBytes = bytes('utf8', this.messageInfo) const prefixBytes = concatBytes( bytes('utf8', this.messagePrefix), - new Uint8Array([infoBytes.length + msgHex.length]), + varintByteNum(infoBytes.length + msgHex.length), ) // Calculate the total length @@ -56,11 +56,6 @@ export class BitcoinSignMessage { offset += infoBytes.length data.set(msgHex, offset) - // Avoid the 255 length limit - if (data.length > 255) { - throw Error(`message info length cannot be greater than > ${data.length - msgHex.length}`) - } - return data } @@ -111,14 +106,12 @@ export class Authenticator { throw Error('invalid message info') } + const messageLength = bytes('utf8', input.messageInfo).length + toHEX(input.txHash).length const sign = await signer.sign(signWith === 'hash' ? input.hash() : bytes('utf8', input.raw())) const payload = bcs.BitcoinAuthPayload.serialize({ signature: sign, - messagePrefix: concatBytes( - bytes('utf8', input.messagePrefix), - new Uint8Array([bytes('utf8', input.messageInfo).length + toHEX(input.txHash).length]), - ), + messagePrefix: concatBytes(bytes('utf8', input.messagePrefix), varintByteNum(messageLength)), messageInfo: bytes('utf8', input.messageInfo), publicKey: signer.getPublicKey().toBytes(), fromAddress: bytes('utf8', signer.getBitcoinAddress().toStr()), diff --git a/sdk/typescript/rooch-sdk/src/keypairs/secp256k1/keypair.ts b/sdk/typescript/rooch-sdk/src/keypairs/secp256k1/keypair.ts index 09e39b6ca8..59999792de 100644 --- a/sdk/typescript/rooch-sdk/src/keypairs/secp256k1/keypair.ts +++ b/sdk/typescript/rooch-sdk/src/keypairs/secp256k1/keypair.ts @@ -155,7 +155,10 @@ export class Secp256k1Keypair extends Keypair { } async signTransaction(input: Transaction): Promise { - return await Authenticator.bitcoin(new BitcoinSignMessage(input.hashData(), 'sdk'), this) + return await Authenticator.bitcoin( + new BitcoinSignMessage(input.hashData(), input.getInfo() ?? 'sdk'), + this, + ) } /** diff --git a/sdk/typescript/rooch-sdk/src/session/session.ts b/sdk/typescript/rooch-sdk/src/session/session.ts index e2c7756324..6004e49bab 100644 --- a/sdk/typescript/rooch-sdk/src/session/session.ts +++ b/sdk/typescript/rooch-sdk/src/session/session.ts @@ -170,14 +170,7 @@ export class Session extends Signer { Args.u64(BigInt(this.maxInactiveInterval)), ], info: `Welcome to ${this.appName}\nYou will authorize session:\n${ - 'Scope:\n' + - this.scopes - .filter((v) => !v.startsWith('0x1') && !v.startsWith('0x3')) - .map((v) => { - return v - }) + - '\nTimeOut:' + - this.maxInactiveInterval.toString() + 'Scope:\n' + this.scopes.join('\n') + '\nTimeOut:' + this.maxInactiveInterval.toString() }`, }) diff --git a/sdk/typescript/rooch-sdk/src/utils/bytes.ts b/sdk/typescript/rooch-sdk/src/utils/bytes.ts index 9b4e7405ab..17de97a114 100644 --- a/sdk/typescript/rooch-sdk/src/utils/bytes.ts +++ b/sdk/typescript/rooch-sdk/src/utils/bytes.ts @@ -1,8 +1,8 @@ // Copyright (c) RoochNetwork // SPDX-License-Identifier: Apache-2.0 +import { Buffer } from 'buffer' import { base16, base32, base58, base58xmr, base64, base64url, hex, utf8 } from '@scure/base' - import { Bytes } from '../types/bytes.js' const CODERS = { @@ -70,4 +70,75 @@ export function concatBytes(...arrays: Uint8Array[]): Uint8Array { return res } +export function varintByteNum(input: number): Bytes { + if (input < 253) { + let buf = Buffer.alloc(1) + buf.writeUInt8(input) + return buf + } else if (input < 0x10000) { + let buf = Buffer.alloc(1 + 2) + buf.writeUInt8(253) + buf.writeUInt16LE(input, 1) + return buf + } else if (input < 0x100000000) { + let buf = Buffer.alloc(1 + 4) + buf.writeUInt8(254) + buf.writeUInt32LE(input, 1) + return buf + } else { + let buf = Buffer.alloc(1 + 8) + buf.writeUInt8(255) + buf.writeInt32LE(input & -1, 1) + buf.writeUInt32LE(Math.floor(input / 0x100000000), 5) + return buf + } +} + +// export class ByteWriter { +// value: Bytes +// +// constructor(value: Bytes) { +// this.value = value +// } +// +// public writeUInt8(input: number) { +// if (input < 0) { +// input = input >>> 0 +// } +// let buf = Buffer.from(this.value) +// buf.writeUInt8(input, this.value.length) +// +// this.value = buf +// } +// +// public writeUInt16BE(input: number) { +// if (input < 0) { +// input = input >>> 0 +// } +// +// let buf = Buffer.from(this.value) +// buf.writeUInt16BE(input, this.value.length) +// this.value = buf +// } +// +// public varintBufNum(input: number) { +// let buf = Buffer.from([]) +// if (input < 253) { +// buf.writeUInt8(input) +// } else if (input < 0x10000) { +// buf.writeUInt8(253) +// buf.writeUInt16LE(input, 1) +// } else if (input < 0x100000000) { +// buf.writeUInt8(254) +// buf.writeUInt32LE(input, 1) +// } else { +// buf.writeUInt8(255) +// buf.writeInt32LE(input & -1, 1) +// buf.writeUInt32LE(Math.floor(input / 0x100000000), 5) +// } +// +// this.value = concatBytes(this.value, buf) +// } +// } + export const bytes = stringToBytes diff --git a/sdk/typescript/rooch-sdk/test-e2e/case/session.test.ts b/sdk/typescript/rooch-sdk/test-e2e/case/session.test.ts index 756e11a8e9..291f67ca0e 100644 --- a/sdk/typescript/rooch-sdk/test-e2e/case/session.test.ts +++ b/sdk/typescript/rooch-sdk/test-e2e/case/session.test.ts @@ -3,6 +3,7 @@ import { beforeAll, describe, expect, it } from 'vitest' import { setup, TestBox } from '../setup.js' +import {bytes} from '../../src/utils/bytes.js' import { Transaction } from '../../src/transactions/index.js' describe('Checkpoints Session API', () => { @@ -12,12 +13,29 @@ describe('Checkpoints Session API', () => { testBox = await setup() }) + it ('',() => { + const aa = '18426974636f696e205369676e6564204d6573736167653a0a353631' + console.log(bytes('hex', aa)) + } + ) + it('Create session should be success', async () => { const session = await testBox.client.createSession({ sessionArgs: { appName: 'sdk-e2e-test', appUrl: 'https://sdk-e2e.com', - scopes: ['0x3::empty::empty_with_signer'], + scopes: ['0x3::empty::empty_with_signer', + '0xf9b10e6c760f1cadce95c664b3a3ead3c985bbe9d63bd51a9bf1760785d26a1b::*::*', + '0xf9b10e6c760f1cadce95c664b3a3ead3c985bbe9d63bd51a9bf1760785d26a1c::*::*', + '0xf9b10e6c760f1cadce95c664b3a3ead3c985bbe9d63bd51a9bf1760785d26a11::*::*', + '0xf9b10e6c760f1cadce95c664b3a3ead3c985bbe9d63bd51a9bf1760785d26a1a::*::*', + '0xf9b10e6c760f1cadce95c664b3a3ead3c985bbe9d63bd51a9bf1760785d26aaa::*::*', + '0xf9b10e6c760f1cadce95c664b3a3ead3c985bbe9d63bd51a9bf1760785d26aba::*::*', + '0xf9b10e6c760f1cadce95c664b3a3ead3c985bbe9d63bd51a9bf1760785d26a6a::*::*', + '0xf9b10e6c760f1cadce95c664b3a3ead3c985bbe9d63bd51a9bf1760785d26a2a::*::*', + '0xf9b10e6c760f1cadce95c664b3a3ead3c985bbe9d63bd51a9bf1760785d26a3a::*::*', + '0xf9b10e6c760f1cadce95c664b3a3ead3c985bbe9d63bd51a9bf1760785d26a4a::*::*', + ], }, signer: testBox.keypair, }) diff --git a/sdk/typescript/templates/react-counter/src/main.tsx b/sdk/typescript/templates/react-counter/src/main.tsx index b203711db0..2c1b78a9e5 100644 --- a/sdk/typescript/templates/react-counter/src/main.tsx +++ b/sdk/typescript/templates/react-counter/src/main.tsx @@ -15,7 +15,7 @@ ReactDOM.createRoot(document.getElementById("root")!).render( - +