Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
henry committed Oct 16, 2024
2 parents 271413e + 809e297 commit 343e19c
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 47 deletions.
2 changes: 1 addition & 1 deletion examples/example-auth-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite --port 3000",
"build": "tsc -b && vite build",
"build": "tsc && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/example-wallet-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite --port 3000",
"build": "tsc -b && vite build",
"build": "tsc && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/example-wallet-react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function App() {
//方式1: sendTransaction,useXterioTransaction 必须传contract跟functionName
const toAddr = '0xF4Ae736B14a7B5FDb803172B242074D6DFe655bb'
const amount = '0x0de0b6b3a7640000'
await sendTransaction?.({ gasLimit: '0x90de' }, toAddr, amount)
await sendTransaction?.(toAddr, amount, { gasLimit: '0x90de' })
}

const test2 = async () => {
Expand Down
37 changes: 2 additions & 35 deletions examples/tg-mini-app/src/contexts/okx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { formatEther } from "ethers/lib/utils";
import { Transaction } from "ethers/lib/ethers";

export interface IOkx {
okxConnect: () => Promise<void>;
okxConnect: () => Promise<string | undefined>;
okxDisconnect(): Promise<void>;
okxSetDefaultChainToXterBNB: () => void;
okxSetDefaultChainToXterBNBTest: () => void;
Expand Down Expand Up @@ -37,40 +37,6 @@ export const useOkx = (): IOkx => {
initProvider();
}, []);

useEffect(() => {
const displayUriHandler = (uri: string) => {
console.log(uri);
alert(uri);
};

const sessionUpdateHandler = (session: any) => {
console.log(JSON.stringify(session));
alert(JSON.stringify(session));
};

const sessionDeleteHandler = ({ topic }: { topic: string }) => {
console.log(topic);
alert(topic);
};

// 添加事件监听器
if (okxProvider) {
console.log('event added')
okxProvider.events.on("display_uri", displayUriHandler);
okxProvider.events.on("session_update", sessionUpdateHandler);
okxProvider.events.on("session_delete", sessionDeleteHandler);
}

// 清除事件监听器
return () => {
if (okxProvider) {
okxProvider.events.off("display_uri", displayUriHandler);
okxProvider.events.off("session_update", sessionUpdateHandler);
okxProvider.events.off("session_delete", sessionDeleteHandler);
}
};
}, [okxProvider]);

const okxConnect = useCallback(async () => {
console.log('okxConnect start');
if (okxProvider) {
Expand Down Expand Up @@ -103,6 +69,7 @@ export const useOkx = (): IOkx => {
});
console.log('session ==', JSON.stringify(session))
// alert(JSON.stringify(session));
return JSON.stringify(session);
} else {
alert('okxProvider not init');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const Okx = observer(() => {
const address = await okxGetAddress()
alert(address)
setAddress(address)

}

const handleGetChainId = async () => {
Expand Down
5 changes: 3 additions & 2 deletions examples/tg-mini-app/src/routes/RenderRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ export const renderRoutes = (mainRoutes) => {
return (
<Route key={index} element={<Layout />}>
{subRoutes
.filter((item) => !!item.component)
.map(({ component, path, name, isPublic }) => {
.filter((item: any) => !!item.component)
.map((it: any) => {
const { component, path, name, isPublic } = it || {}
// const Component = lazy(component)
const Component = component
return (
Expand Down
2 changes: 1 addition & 1 deletion examples/tg-mini-app/src/routes/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const routes: RouteConfigProps[] = [
name: 'Okx',
title: 'Okx',
component: Okx,
path: '/Okx'
path: '/okx'
}
]
}
Expand Down
8 changes: 4 additions & 4 deletions sh/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const publishAuth = async () => {
return
}
// publish success
updateReleaseDoc(authVersion)
updateReleaseDoc(authVersion, pathAuth)
await commitVersionFile('auth', authVersion)
await run(`bash release.sh auth ${authVersion}`, pathSh)
return authVersion
Expand All @@ -62,7 +62,7 @@ const publishWallet = async () => {
return
}
// publish success
updateReleaseDoc(walletVersion)
updateReleaseDoc(walletVersion, pathWallet)
await run(`bash release.sh wallet ${walletVersion}`, pathSh)
changeWalletPackageJson('reset')
await commitVersionFile('wallet', walletVersion)
Expand All @@ -88,8 +88,8 @@ const commitVersionFile = async (_f: string, _v: string) => {
await run(`git push origin main`)
}

const updateReleaseDoc = async (v: string) => {
const docPath = resolve(pathAuth, 'RELEASE.md')
const updateReleaseDoc = async (v: string, path: string) => {
const docPath = resolve(path, 'RELEASE.md')
const data = readFileSync(docPath, 'utf-8')
const pattern = new RegExp(`# ${v.replace(/\./g, '\\.')}(\\s|$)`)
if (!pattern.test(data)) {
Expand Down
3 changes: 3 additions & 0 deletions xterio-auth/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
- 2. isLogin 变更逻辑处理
- 3. idToken 刷新处理
- 4. 定制页面UI&样式配置参数增加

# 0.0.12
- 修复验证码倒计时结束未显示重发按钮问题
2 changes: 1 addition & 1 deletion xterio-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xterio-sdk/auth",
"version": "0.0.11",
"version": "0.0.12",
"description": "xterio-auth",
"author": "xterio platform",
"license": "ISC",
Expand Down
4 changes: 4 additions & 0 deletions xterio-wallet/RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 0.0.10
- auth数据解耦&优化
- 交易方法优化
- 用户登录后连接钱包的逻辑处理
2 changes: 1 addition & 1 deletion xterio-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@xterio-sdk/wallet",
"private": false,
"version": "0.0.9",
"version": "0.0.10",
"description": "xterio-wallet",
"author": "xterio platform",
"license": "ISC",
Expand Down

0 comments on commit 343e19c

Please sign in to comment.