Skip to content

Commit

Permalink
update sdk rpc version & add mainnet env (#2735)
Browse files Browse the repository at this point in the history
* support main net

* update rpc version

* updata sdk version

* support main net

* update rpc version

* updata sdk version

* Update openrpc.json

* updata sdk rpc

* fix version

* update sdk version to 0.2.6

* fix version
  • Loading branch information
wow-sven authored Oct 9, 2024
1 parent a180c3a commit 7ea5048
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 11 deletions.
2 changes: 1 addition & 1 deletion sdk/typescript/rooch-sdk-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@roochnetwork/rooch-sdk-kit",
"author": "Rooch.network <opensource@rooch.network>",
"version": "0.2.5",
"version": "0.2.7",
"description": "Rooch SDK Kit",
"license": "Apache-2.0",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion sdk/typescript/rooch-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@roochnetwork/rooch-sdk",
"author": "Rooch.network <opensource@rooch.network>",
"version": "0.2.5",
"version": "0.2.7",
"description": "Rooch SDK",
"license": "Apache-2.0",
"engines": {
Expand Down
4 changes: 3 additions & 1 deletion sdk/typescript/rooch-sdk/src/client/networks.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) RoochNetwork
// SPDX-License-Identifier: Apache-2.0

export function getRoochNodeUrl(network: 'testnet' | 'devnet' | 'localnet') {
export function getRoochNodeUrl(network: 'mainnet' | 'testnet' | 'devnet' | 'localnet') {
switch (network) {
case 'mainnet':
return 'https://main-seed.rooch.network'
case 'testnet':
return 'https://test-seed.rooch.network'
case 'devnet':
Expand Down
65 changes: 62 additions & 3 deletions sdk/typescript/rooch-sdk/src/client/types/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
* /crates/rooch-open-rpc-spec/openrpc.json
*/

export interface AccumulatorInfoView {
accumulator_root: string
frozen_subtree_roots: string[]
num_leaves: string
num_nodes: string
}
export interface AnnotatedFunctionResultView {
return_values?: AnnotatedFunctionReturnValueView[] | null
vm_status: VMStatusView
Expand Down Expand Up @@ -42,13 +48,18 @@ export interface BalanceInfoView {
balance: string
coin_type: string
decimals: number
icon_url?: string | null
name: string
supply: string
symbol: string
}
export interface OutPointView {
txid: string
vout: number
export interface BitcoinStatus {
confirmed_block?: BlockHeightHashView | null
pending_block?: BlockHeightHashView | null
}
export interface BlockHeightHashView {
block_hash: string
block_height: string
}
export interface DisplayFieldsView {
fields: {
Expand Down Expand Up @@ -226,6 +237,7 @@ export interface LedgerTransactionView {
}
export type LedgerTxDataView =
| {
bitcoin_block_hash?: string | null
block_hash: string
block_height: string
chain_id: string
Expand Down Expand Up @@ -368,6 +380,10 @@ export type OpView =
| {
modify: string
}
export interface OutPointView {
txid: string
vout: number
}
/**
* `next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the
* next item after `next_cursor` if `next_cursor` is `Some`, otherwise it will start from the first
Expand Down Expand Up @@ -418,6 +434,16 @@ export interface PaginatedInscriptionStateViews {
has_next_page: boolean
next_cursor?: IndexerStateIDView | null
}
/**
* `next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the
* next item after `next_cursor` if `next_cursor` is `Some`, otherwise it will start from the first
* item.
*/
export interface PaginatedStateChangeSetWithTxOrderViews {
data: StateChangeSetWithTxOrderView[]
has_next_page: boolean
next_cursor?: string | null
}
/**
* `next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the
* next item after `next_cursor` if `next_cursor` is `Some`, otherwise it will start from the first
Expand Down Expand Up @@ -471,6 +497,14 @@ export type RepairIndexerParamsView =
| {
object_id: string
}
export interface RoochStatus {
root_state: RootStateView
sequencer_info: SequencerInfoView
}
export interface RootStateView {
size: string
state_root: string
}
export interface SatPointView {
offset: string
output: OutPointView
Expand All @@ -480,13 +514,22 @@ export interface ScriptCallView {
code: string
ty_args: string[]
}
export interface SequencerInfoView {
last_accumulator_info: AccumulatorInfoView
last_order: string
}
export type ServiceStatus = 'active' | 'maintenance' | 'read-only-mode' | 'date-import-mode'
/** 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: ObjectChangeView[]
global_size: string
state_root: string
}
export interface StateChangeSetWithTxOrderView {
state_change_set: StateChangeSetView
tx_order: string
}
export interface StateKVView {
field_key: string
state: ObjectStateView
Expand All @@ -496,7 +539,23 @@ export interface StateOptions {
decode?: boolean
/** If true, result with display rendered is returned */
showDisplay?: boolean
/** The state root of remote stateDB */
stateRoot?: string | null
}
export interface Status {
/** The status of the Bitcoin chain */
bitcoin_status: BitcoinStatus
/** The status of the Rooch chain */
rooch_status: RoochStatus
/** The status of the rpc service */
service_status: ServiceStatus
}
export type SyncStateFilterView =
/** Sync by object id. */
| {
object_i_d: string
}
| 'all'
export interface TransactionExecutionInfoView {
event_root: string
gas_used: string
Expand Down
9 changes: 9 additions & 0 deletions sdk/typescript/rooch-sdk/src/client/types/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,12 @@ export interface RepairIndexerParams {
export interface SendRawTransactionParams {
txBcsHex: string
}
/** Get the chain and service status */
export interface StatusParams {}
/** Sync state change sets */
export interface SyncStatesParams {
filter: RpcTypes.SyncStateFilterView
cursor?: string | null | undefined
limit?: string | null | undefined
queryOption?: RpcTypes.QueryOptions | null | undefined
}
2 changes: 1 addition & 1 deletion sdk/typescript/rooch-sdk/src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

// This file is generated by genversion.mjs. Do not edit it directly.

export const PACKAGE_VERSION = '0.2.5'
export const PACKAGE_VERSION = '0.2.7'
export const TARGETED_RPC_VERSION = '0.7.3'
4 changes: 1 addition & 3 deletions sdk/typescript/rooch-sdk/test-e2e/case/bitcoin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ describe('Bitcoin Assets API', () => {
})

it('query utxo should be success', async () => {
const addr = testBox.keypair
.getSchnorrPublicKey()
.toAddress().bitcoinAddress.toStr()
const addr = testBox.keypair.getSchnorrPublicKey().toAddress().bitcoinAddress.toStr()

const result = await testBox.bitcoinContainer?.executeRpcCommandRaw([], 'generatetoaddress', [
'50',
Expand Down
2 changes: 1 addition & 1 deletion sdk/typescript/templates/react-counter/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<Theme appearance="dark">
<QueryClientProvider client={queryClient}>
<RoochProvider networks={networkConfig} defaultNetwork='localnet'>
<RoochProvider networks={networkConfig} defaultNetwork='testnet'>
<WalletProvider preferredWallets={['UniSat']} chain={'bitcoin'} autoConnect>
<App/>
</WalletProvider>
Expand Down
6 changes: 6 additions & 0 deletions sdk/typescript/templates/react-counter/src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import { DEVNET_COUNTER_PACKAGE_ID, MAINNET_COUNTER_PACKAGE_ID } from './constan

const { networkConfig, useNetworkVariable, useNetworkVariables } =
createNetworkConfig({
mainnet: {
url: getRoochNodeUrl("mainnet"),
variables: {
counterPackageId: DEVNET_COUNTER_PACKAGE_ID,
},
},
devnet: {
url: getRoochNodeUrl("devnet"),
variables: {
Expand Down

0 comments on commit 7ea5048

Please sign in to comment.