Skip to content

Commit

Permalink
fix: sui sign block & account change (#238)
Browse files Browse the repository at this point in the history
* fix: sui sign block tx

* fix: sui change account

* chore: release version 2.1.10
  • Loading branch information
ByteZhang1024 authored Oct 10, 2024
1 parent dd6a7ac commit 6c2afa3
Show file tree
Hide file tree
Showing 38 changed files with 708 additions and 311 deletions.
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-core",
"version": "2.1.9",
"version": "2.1.10",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -29,9 +29,9 @@
"build-version-info": "node ./scripts/buildVersionInfo.js"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-errors": "2.1.9",
"@onekeyfe/cross-inpage-provider-events": "2.1.9",
"@onekeyfe/cross-inpage-provider-types": "2.1.9",
"@onekeyfe/cross-inpage-provider-errors": "2.1.10",
"@onekeyfe/cross-inpage-provider-events": "2.1.10",
"@onekeyfe/cross-inpage-provider-types": "2.1.10",
"events": "^3.3.0",
"lodash-es": "^4.17.21",
"ms": "^2.1.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/versionInfo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

const version = '2.1.7';
const version = '2.1.10';
const versionBuild = '2020-0101-1';

export default {
Expand Down
6 changes: 3 additions & 3 deletions packages/desktop/desktop-bridge-injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/desktop-bridge-injected",
"version": "2.1.9",
"version": "2.1.10",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -34,7 +34,7 @@
"electron": "^17.2.0"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.9",
"@onekeyfe/cross-inpage-provider-types": "2.1.9"
"@onekeyfe/cross-inpage-provider-core": "2.1.10",
"@onekeyfe/cross-inpage-provider-types": "2.1.10"
}
}
2 changes: 1 addition & 1 deletion packages/empty/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-empty",
"version": "2.1.9",
"version": "2.1.10",
"keywords": [
"cross-inpage-provider"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-errors",
"version": "2.1.9",
"version": "2.1.10",
"keywords": [
"cross-inpage-provider"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/events/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-events",
"version": "2.1.9",
"version": "2.1.10",
"keywords": [
"cross-inpage-provider"
],
Expand Down
1 change: 1 addition & 0 deletions packages/example/components/chains/ethereum/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default function Example() {

useEffect(() => {
const listener = (event: IEIP6963AnnounceProviderEvent) => {
console.log('evm eip6963 [listener]', event);
const { info, provider } = event.detail;
const wallet = walletsRef.current.find((wallet) => wallet.info.uuid === info.uuid);
if (!wallet) {
Expand Down
60 changes: 60 additions & 0 deletions packages/example/components/chains/suiStandard/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,66 @@ function Example() {
return JSON.stringify(res);
}}
/>

<ApiPayload
title="signTransactionBlock"
description="签名交易 (特殊情况,带 clock、system 参数)"
presupposeParams={signTransactionPresupposeParams}
onExecute={async (request: string) => {
const {
from,
to,
amount,
}: {
from: string;
to: string;
amount: number;
} = JSON.parse(request);

const transfer = new TransactionBlock();
const [coin] = transfer.splitCoins(transfer.gas, [transfer.pure(amount)]);
transfer.transferObjects([coin], transfer.pure(to));

const tx = await sponsorTransaction(
client,
from,
await transfer.build({
client,
onlyTransactionKind: true,
}),
);

// @ts-expect-error
tx.system = () => '0x5';
// @ts-expect-error
tx.clock = () => '0x6';
// @ts-expect-error
tx.random = () => '0x8';
// @ts-expect-error
tx.denyList = () => '0x403';

const res: unknown = await signTransactionBlock({
transactionBlock: tx,
account: currentAccount,
});
return JSON.stringify(res);
}}
onValidate={async (request: string, result: string) => {
const {
transactionBlockBytes,
signature,
}: {
transactionBlockBytes: string;
signature: string;
} = JSON.parse(result);
const publicKey = await verifyTransactionBlock(
Buffer.from(transactionBlockBytes, 'base64'),
signature,
);

return (currentAccount.address === publicKey.toSuiAddress()).toString();
}}
/>
</ApiGroup>

<DappList dapps={dapps} />
Expand Down
24 changes: 12 additions & 12 deletions packages/example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-example",
"version": "2.1.9",
"version": "2.1.10",
"private": true,
"scripts": {
"postinstall": "patch-package",
Expand All @@ -21,17 +21,17 @@
"@metamask/eth-sig-util": "^7.0.2",
"@metamask/onboarding": "^1.0.1",
"@mysten/dapp-kit": "0.13.2",
"@onekeyfe/cross-inpage-provider-core": "2.1.9",
"@onekeyfe/cross-inpage-provider-types": "2.1.9",
"@onekeyfe/onekey-aptos-provider": "2.1.9",
"@onekeyfe/onekey-cardano-provider": "2.1.9",
"@onekeyfe/onekey-conflux-provider": "2.1.9",
"@onekeyfe/onekey-cosmos-provider": "2.1.9",
"@onekeyfe/onekey-near-provider": "2.1.9",
"@onekeyfe/onekey-solana-provider": "2.1.9",
"@onekeyfe/onekey-sui-provider": "2.1.9",
"@onekeyfe/onekey-tron-provider": "2.1.9",
"@onekeyfe/onekey-webln-provider": "2.1.9",
"@onekeyfe/cross-inpage-provider-core": "2.1.10",
"@onekeyfe/cross-inpage-provider-types": "2.1.10",
"@onekeyfe/onekey-aptos-provider": "2.1.10",
"@onekeyfe/onekey-cardano-provider": "2.1.10",
"@onekeyfe/onekey-conflux-provider": "2.1.10",
"@onekeyfe/onekey-cosmos-provider": "2.1.10",
"@onekeyfe/onekey-near-provider": "2.1.10",
"@onekeyfe/onekey-solana-provider": "2.1.10",
"@onekeyfe/onekey-sui-provider": "2.1.10",
"@onekeyfe/onekey-tron-provider": "2.1.10",
"@onekeyfe/onekey-webln-provider": "2.1.10",
"@polkadot/api": "^9.11.3",
"@polkadot/extension-dapp": "^0.47.5",
"@radix-ui/react-checkbox": "^1.1.0",
Expand Down
Loading

0 comments on commit 6c2afa3

Please sign in to comment.