-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
e9aef83
commit 9a891bd
Showing
73 changed files
with
3,479 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
124
packages/example/components/chains/alephium/example.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
Oops, something went wrong.