Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev upgrade package #2622

Merged
merged 16 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
legacy-peer-deps = false
auto-install-peers=true
strict-peer-dependencies=false
loglevel=error
2 changes: 1 addition & 1 deletion infra/rooch-portal-v2/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
8 changes: 8 additions & 0 deletions infra/rooch-portal-v2/src/components/table/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ function descendingComparator<T>(a: T, b: T, orderBy: keyof T) {
if (b[orderBy] === null) {
return -1;
}

if (a[orderBy] === undefined) {
return 1;
}
if (b[orderBy] === undefined) {
return -1;
}

if (b[orderBy] < a[orderBy]) {
return -1;
}
Expand Down
20 changes: 14 additions & 6 deletions infra/rooch-portal-v2/src/sections/mint/utils/get-token-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export type TokenInfo = {

function extractCoinInfoContent(input: string): string | null {
const regex = /CoinInfo<([^>]+)>/;
const match = input.match(regex);
let match;

if (input) {
match = input.match(regex);
}

if (match && match[1]) {
return match[1];
Expand All @@ -38,11 +42,15 @@ export async function getTokenInfo(
showDisplay: true,
},
});
const decode = (((data[0].decoded_value as any).value as any).value as any).value as any;
const coinInfo = decode.coin_info as AnnotatedMoveStructView;
const coinId = coinInfo.value.id as string;
const decode = (((data?.[0]?.decoded_value as any)?.value as any)?.value as any)?.value as any;
const coinInfo = decode?.coin_info as AnnotatedMoveStructView;
const coinId = coinInfo?.value?.id as string;

const coinType = extractCoinInfoContent(coinInfo.type)!;
const coinType = extractCoinInfoContent(coinInfo?.type)!;

if (!coinId) {
return undefined;
}

return client
.getStates({
Expand All @@ -53,7 +61,7 @@ export async function getTokenInfo(
},
})
.then((sv) => {
const coinView = (sv[0].decoded_value as any).value as any;
const coinView = (sv?.[0]?.decoded_value as any)?.value as any;
const starTime = decode.start_time as number;
const endTime = decode.end_time as number;
const now = Date.now() / 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function RedEnvelopeDetail({ redEnvelopeId }: { redEnvelopeId: st
console.log('🚀 ~ file: view.tsx:21 ~ RedEnvelopeDetail ~ data:', redEnvelopeObject);

const redEnvelopeInfo = useMemo(() => {
const info = redEnvelopeObject?.data[0].decoded_value?.value as unknown as
const info = redEnvelopeObject?.data?.[0]?.decoded_value?.value as unknown as
| RedEnvelopeItem
| undefined;
return info;
Expand Down
10,564 changes: 5,060 additions & 5,504 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions sdk/typescript/bitseed-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"engines": {
"node": ">=18.0.0"
},
"packageManager": "pnpm@8.6.6",
"packageManager": "pnpm@9.10.0",
"scripts": {
"playwright-deps": "pnpm playwright install --with-deps",
"build": "build-package",
Expand Down Expand Up @@ -48,51 +48,51 @@
"@mempool/mempool.js": "^2.3.0",
"@radix-ui/colors": "^3.0.0",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/themes": "^2.0.0",
"@radix-ui/themes": "^3.1.3",
"@roochnetwork/rooch-sdk": "workspace:*",
"@roochnetwork/rooch-sdk-kit": "workspace:*",
"@sadoprotocol/ordit-sdk": "./libs/sadoprotocol-ordit-sdk-v2.4.9.tgz",
"@tanstack/react-query": "^5.0.0",
"@tanstack/react-query": "^5.56.2",
"@types/debug": "^4.1.12",
"@types/randomstring": "^1.1.11",
"@types/randomstring": "^1.3.0",
"bip39": "^3.1.0",
"bitcoinjs-lib": "^6.1.5",
"buffer": "5.7.1",
"bitcoinjs-lib": "^6.1.6",
"buffer": "6.0.3",
"cbor": "^9.0.2",
"commander": "^10.0.0",
"debug": "^4.3.6",
"commander": "^12.1.0",
"debug": "^4.3.7",
"decimal.js": "^10.4.3",
"js-sha3": "^0.9.3",
"randomstring": "^1.2.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"randomstring": "^1.3.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@playwright/experimental-ct-react": "^1.41.2",
"@playwright/test": "^1.41.2",
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.4",
"@playwright/experimental-ct-react": "^1.47.0",
"@playwright/test": "^1.47.0",
"@roochnetwork/build-scripts": "workspace:*",
"@roochnetwork/test-suite": "workspace:*",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.19",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"@types/jest": "^29.5.13",
"@types/node": "^22.5.4",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.5.0",
"@typescript-eslint/parser": "^8.5.0",
"@vitejs/plugin-react": "^4.3.1",
"@vitejs/plugin-react-swc": "^3.3.2",
"@vitejs/plugin-react-swc": "^3.7.0",
"babel-jest": "^29.7.0",
"jest": "^29.7.0",
"node-fetch": "^3.3.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"testcontainers": "^10.11.0",
"ts-jest": "^29.1.2",
"typescript": "5.1.6",
"vite": "5.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"testcontainers": "^10.13.1",
"ts-jest": "^29.2.5",
"typescript": "5.6.2",
"vite": "5.4.4",
"vite-plugin-node-polyfills": "^0.22.0",
"vite-plugin-wasm": "^3.3.0",
"vitest": "^1.6.0"
"vitest": "^2.1.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export class RoochDataSource implements IDatasource {
throw new Error(`Transaction with id ${txId} not found`)
}

const btcTxOption = txResult.return_values[0].decoded_value.value.vec[0]
const btcTxOption = txResult.return_values?.[0]?.decoded_value?.value?.vec?.[0]
if (!btcTxOption) {
throw new Error(`Transaction with id ${txId} not found`)
}
Expand Down
52 changes: 25 additions & 27 deletions sdk/typescript/rooch-sdk-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"engines": {
"node": ">=18.0.0"
},
"packageManager": "pnpm@9.4.0",
"packageManager": "pnpm@9.10.0",
"scripts": {
"build": "build-rooch-sdk-kit",
"build:clean": "rimraf dist",
Expand Down Expand Up @@ -55,33 +55,31 @@
],
"devDependencies": {
"@roochnetwork/build-scripts": "workspace:*",
"@size-limit/preset-small-lib": "^8.2.6",
"@tanstack/react-query": "^5.0.0",
"@testing-library/dom": "^9.3.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/react": "^18.2.15",
"@types/testing-library__jest-dom": "^5.14.9",
"@vanilla-extract/esbuild-plugin": "^2.3.0",
"@vanilla-extract/vite-plugin": "^3.9.0",
"jsdom": "^23.0.0",
"react": "^18.2.0",
"happy-dom": "^14.12.0",
"react-dom": "^18.2.0",
"size-limit": "^8.2.6",
"typescript": "^5.3.3",
"vite": "^4.4.4",
"vitest": "^1.6.0",
"sats-connect": "2.7.0"
"@size-limit/preset-small-lib": "^11.1.5",
"@tanstack/react-query": "^5.56.2",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.3.5",
"@vanilla-extract/esbuild-plugin": "^2.3.10",
"@vanilla-extract/vite-plugin": "^4.0.15",
"happy-dom": "^15.7.4",
"jsdom": "^25.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"size-limit": "^11.1.5",
"typescript": "^5.6.2",
"vite": "^5.4.4",
"vitest": "^2.1.0"
},
"dependencies": {
"clsx": "^2.0.0",
"zustand": "^4.4.1",
"@vanilla-extract/css": "^1.13.0",
"@vanilla-extract/dynamic": "^2.0.3",
"@vanilla-extract/recipes": "^0.5.0",
"@roochnetwork/rooch-sdk": "workspace:*"
"@roochnetwork/rooch-sdk": "workspace:*",
"@vanilla-extract/css": "^1.15.5",
"@vanilla-extract/dynamic": "^2.1.2",
"@vanilla-extract/recipes": "^0.5.5",
"clsx": "^2.1.1",
"zustand": "^4.5.5"
},
"peerDependencies": {
"@tanstack/react-query": "^5.0.0",
Expand All @@ -91,4 +89,4 @@
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
}
1 change: 0 additions & 1 deletion sdk/typescript/rooch-sdk-kit/src/wellet/xverse.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) RoochNetwork
// SPDX-License-Identifier: Apache-2.0

// import Wallet from 'sats-connect'
import { BitcoinAddress, Bytes, ThirdPartyAddress, str, bytes } from '@roochnetwork/rooch-sdk'
import { BitcoinWallet } from '../wellet/index.js'

Expand Down
51 changes: 29 additions & 22 deletions sdk/typescript/rooch-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"engines": {
"node": ">=18.0.0"
},
"packageManager": "pnpm@8.6.6",
"packageManager": "pnpm@9.10.0",
"scripts": {
"clean": "rimraf tsconfig.tsbuildinfo rimraf dist",
"codegen:version": "node genversion.mjs",
Expand Down Expand Up @@ -39,40 +39,47 @@
"bugs": {
"url": "https://github.com/rooch-network/rooch/issues"
},
"files": ["dist", "src"],
"files": [
"dist",
"src"
],
"type": "module",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/cjs/index.d.ts",
"keywords": ["Rooch", "Rooch Network", "Move"],
"keywords": [
"Rooch",
"Rooch Network",
"Move"
],
"devDependencies": {
"@iarna/toml": "^2.2.5",
"@roochnetwork/build-scripts": "workspace:*",
"@roochnetwork/test-suite": "workspace:*",
"@iarna/toml": "^2.2.5",
"@types/node": "^20.14.10",
"@types/tmp": "^0.2.1",
"ts-retry-promise": "^0.7.0",
"typescript": "^5.3.3",
"vite": "^4.4.4",
"vitest": "^1.6.0",
"wait-on": "^7.0.1",
"tmp": "^0.2.1",
"@types/bs58check": "2.1.2",
"testcontainers": "10.11.0"
"@types/node": "^20.14.10",
"@types/tmp": "^0.2.6",
"testcontainers": "10.13.1",
"tmp": "^0.2.3",
"ts-retry-promise": "^0.8.1",
"typescript": "^5.4.4",
"vite": "^5.4.4",
"vitest": "^2.0.5",
"wait-on": "^8.0.1"
},
"dependencies": {
"@noble/hashes": "~1.4.0",
"@noble/curves": "~1.4.0",
"@mysten/bcs": "1.0.4",
"@noble/curves": "~1.6.0",
"@noble/hashes": "~1.5.0",
"@scure/base": "~1.1.6",
"@scure/bip32": "^1.3.1",
"@scure/bip39": "^1.2.1",
"@scure/bip32": "^1.5.0",
"@scure/bip39": "^1.4.0",
"@suchipi/femver": "^1.0.0",
"tweetnacl": "^1.0.3",
"bech32": "^2.0.0",
"@mysten/bcs": "1.0.2",
"valibot": "^0.25.0",
"bs58check": "2.1.2",
"buffer": "6.0.3"
"bs58check": "4.0.0",
"buffer": "6.0.3",
"tweetnacl": "^1.0.3",
"valibot": "^0.41.0"
},
"publishConfig": {
"access": "public",
Expand Down
11 changes: 6 additions & 5 deletions sdk/typescript/rooch-sdk/src/address/bitcoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ export class BitcoinNetwork {

static fromBech32Prefix(prefix: string) {
switch (prefix) {
case 'bc' || 'BC':
case 'bc':
return new BitcoinNetwork(BitcoinNetowkType.Bitcoin)
case 'tb' || 'TB':
case 'tb':
return new BitcoinNetwork(BitcoinNetowkType.Testnet)
case 'bcrt' || 'bcrt':
case 'bcrt':
return new BitcoinNetwork(BitcoinNetowkType.Regtest)
default:
return undefined
Expand Down Expand Up @@ -101,7 +101,8 @@ export class BitcoinAddress extends ThirdPartyAddress implements Address {
const hrp = new BitcoinNetwork(network).bech32HRP()
const words = bech32.toWords(Buffer.from(this.bytes.slice(2)))
words.unshift(version)
this.rawAddress = version === 0 ? bech32.encode(hrp, words) : bech32m.encode(hrp, words)
this.rawAddress =
version === 0 ? bech32.encode(hrp, words, false) : bech32m.encode(hrp, words, false)
}
} else {
let info = this.decode()
Expand Down Expand Up @@ -141,7 +142,7 @@ export class BitcoinAddress extends ThirdPartyAddress implements Address {
}

decode() {
let input = this.rawAddress
let input = this.rawAddress as `${string}1${string}`
if (input.length < 14 || input.length > 74) throw new Error('Invalid address length')

const bech32_network = (() => {
Expand Down
4 changes: 2 additions & 2 deletions sdk/typescript/rooch-sdk/src/address/rooch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class RoochAddress implements Address {
if (isHex(address)) {
this.address = fromHEX(address)
} else {
this.address = bech32m.fromWords(bech32m.decode(address).words)
this.address = bech32m.fromWords(bech32m.decode(address as `${string}1${string}`).words)
}
} else {
this.address = address
Expand All @@ -37,6 +37,6 @@ export class RoochAddress implements Address {
}

toBech32Address(): string {
return bech32m.encode(ROOCH_BECH32_PREFIX, bech32m.toWords(this.address))
return bech32m.encode(ROOCH_BECH32_PREFIX, bech32m.toWords(this.address), false)
}
}
Loading
Loading