Skip to content

Commit

Permalink
chore: add scdo on (#219)
Browse files Browse the repository at this point in the history
* chore: add scdo	on

* chore: optimize alephium params

* feat: support ton example

* feat: support ton sign Proof

* feat: support ton onekey connect

* feat: fix ton sign proof

* chore: release version 2.1.4
  • Loading branch information
ByteZhang1024 authored Sep 4, 2024
1 parent e9aef83 commit 9a891bd
Show file tree
Hide file tree
Showing 73 changed files with 3,479 additions and 219 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.3",
"version": "2.1.4",
"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.3",
"@onekeyfe/cross-inpage-provider-events": "2.1.3",
"@onekeyfe/cross-inpage-provider-types": "2.1.3",
"@onekeyfe/cross-inpage-provider-errors": "2.1.4",
"@onekeyfe/cross-inpage-provider-events": "2.1.4",
"@onekeyfe/cross-inpage-provider-types": "2.1.4",
"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.2';
const version = '2.1.3';
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.3",
"version": "2.1.4",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -34,7 +34,7 @@
"electron": "^17.2.0"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.3",
"@onekeyfe/cross-inpage-provider-types": "2.1.3"
"@onekeyfe/cross-inpage-provider-core": "2.1.4",
"@onekeyfe/cross-inpage-provider-types": "2.1.4"
}
}
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.3",
"version": "2.1.4",
"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.3",
"version": "2.1.4",
"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.3",
"version": "2.1.4",
"keywords": [
"cross-inpage-provider"
],
Expand Down
18 changes: 18 additions & 0 deletions packages/example/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export const thirdPartyChains: IChainInfo[] = [
];

export const registeredChains: IChainInfo[] = [
{
id: uuid.v4(),
name: 'Alephium',
href: '/alephium',
icon: 'https://uni.onekey-asset.com/static/chain/alph.png',
},
{
id: uuid.v4(),
name: 'Algo',
Expand Down Expand Up @@ -122,6 +128,12 @@ export const registeredChains: IChainInfo[] = [
href: '/solana',
icon: 'https://uni.onekey-asset.com/static/chain/sol.png',
},
{
id: uuid.v4(),
name: 'Scdo',
href: '/scdo',
icon: 'https://uni.onekey-asset.com/static/chain/scdo.png',
},
{
id: uuid.v4(),
name: 'Solana Standard',
Expand All @@ -140,6 +152,12 @@ export const registeredChains: IChainInfo[] = [
href: '/suiStandard',
icon: 'https://uni.onekey-asset.com/static/chain/sui.png',
},
{
id: uuid.v4(),
name: 'Ton',
href: '/ton',
icon: 'https://uni.onekey-asset.com/static/chain/ton.png',
},
{
id: uuid.v4(),
name: 'Tron',
Expand Down
8 changes: 8 additions & 0 deletions packages/example/components/ApiActuator/ApiPayload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,17 @@ function ApiExecute({
[dispatch],
);

const handleSetValidateResult = useCallback(
(newResult: string) => {
dispatch({ type: 'SET_VALIDATE_RESULT', payload: newResult });
},
[dispatch],
);

const handleExecute = useCallback(async () => {
setLoading(true);
handleSetResult('Calling...');
handleSetValidateResult('');

try {
// @ts-expect-error
Expand Down
6 changes: 6 additions & 0 deletions packages/example/components/chains/alephium/dapps.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const dapps = [
{
name: 'Magic Eden',
url: 'https://magiceden.io/',
},
];
124 changes: 124 additions & 0 deletions packages/example/components/chains/alephium/example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { dapps } from './dapps.config';
import { ApiPayload, ApiGroup } from '../../ApiActuator';
import DappList from '../../DAppList';
import InfoLayout from '../../InfoLayout';
import params from './params';
import {
AlephiumWalletProvider,
AlephiumConnectButton,
useWallet,
useBalance,
} from '@alephium/web3-react';
import { verifySignedMessage } from '@alephium/web3';

export function Example() {
const wallet = useWallet();
const balance = useBalance();

return (
<>
<AlephiumConnectButton />

<InfoLayout title="Base Info">
{wallet && <p>address: {wallet?.account?.address}</p>}
</InfoLayout>

<ApiGroup title="Send Transaction">
<ApiPayload
title="signAndSubmitTransferTx"
description="转账普通 Native"
allowCallWithoutProvider={!!wallet}
presupposeParams={params.signAndSubmitTransferTx(
wallet?.account?.address ?? '',
wallet?.account?.address ?? '',
)}
onExecute={async (request: string) => {
const params = JSON.parse(request);
return wallet.signer.signAndSubmitTransferTx({
...params,
destinations: params.destinations.map((destination: any) => ({
address: destination?.address,
attoAlphAmount: destination?.amount?.toString(),
tokens: destination?.tokens?.map((token: any) => ({
id: token?.id,
amount: token?.amount?.toString(),
})),
lockTime: destination?.lockTime,
message: destination?.message,
})),
signerAddress: params.signerAddress,
});
}}
/>
<ApiPayload
title="signAndSubmitDeployContractTx"
description=""
allowCallWithoutProvider={!!wallet}
presupposeParams={params.signAndSubmitDeployContractTx(wallet?.account?.address ?? '')}
onExecute={async (request: string) => {
return wallet.signer.signAndSubmitDeployContractTx(JSON.parse(request));
}}
/>
<ApiPayload
title="signAndSubmitExecuteScriptTx"
description=""
allowCallWithoutProvider={!!wallet}
presupposeParams={params.signAndSubmitExecuteScriptTx(wallet?.account?.address ?? '')}
onExecute={async (request: string) => {
return wallet.signer.signAndSubmitExecuteScriptTx(JSON.parse(request));
}}
/>
<ApiPayload
title="signAndSubmitUnsignedTx"
description=""
allowCallWithoutProvider={!!wallet}
presupposeParams={params.signAndSubmitUnsignedTx(wallet?.account?.address ?? '')}
onExecute={async (request: string) => {
return wallet.signer.signAndSubmitUnsignedTx(JSON.parse(request));
}}
/>
<ApiPayload
title="signUnsignedTx"
description=""
allowCallWithoutProvider={!!wallet}
presupposeParams={params.signUnsignedTx(wallet?.account?.address ?? '')}
onExecute={async (request: string) => {
return wallet.signer.signUnsignedTx(JSON.parse(request));
}}
/>
<ApiPayload
title="signMessage"
description=""
allowCallWithoutProvider={!!wallet}
presupposeParams={params.signMessage(wallet?.account?.address ?? '')}
onExecute={async (request: string) => {
return wallet.signer.signMessage(JSON.parse(request));
}}
onValidate={async (request: string, response: string) => {
const params = JSON.parse(request);
const signature = JSON.parse(response).signature;

return verifySignedMessage(
params.message,
params.messageHasher,
wallet.account.publicKey,
signature,
params.signerKeyType,
).toString();
}}
/>
</ApiGroup>

<DappList dapps={dapps} />
</>
);
}

export default function App() {
return (
<AlephiumWalletProvider network="mainnet" theme="retro">
<Example />
</AlephiumWalletProvider>
);
}
Loading

0 comments on commit 9a891bd

Please sign in to comment.