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

Feat: support aptos signAndSubmitTransaction #261

Merged
merged 2 commits into from
Dec 5, 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
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.19",
"version": "2.1.20",
"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.19",
"@onekeyfe/cross-inpage-provider-events": "2.1.19",
"@onekeyfe/cross-inpage-provider-types": "2.1.19",
"@onekeyfe/cross-inpage-provider-errors": "2.1.20",
"@onekeyfe/cross-inpage-provider-events": "2.1.20",
"@onekeyfe/cross-inpage-provider-types": "2.1.20",
"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.17';
const version = '2.1.19';
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.19",
"version": "2.1.20",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -34,7 +34,7 @@
"electron": "^17.2.0"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.19",
"@onekeyfe/cross-inpage-provider-types": "2.1.19"
"@onekeyfe/cross-inpage-provider-core": "2.1.20",
"@onekeyfe/cross-inpage-provider-types": "2.1.20"
}
}
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.19",
"version": "2.1.20",
"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.19",
"version": "2.1.20",
"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.19",
"version": "2.1.20",
"keywords": [
"cross-inpage-provider"
],
Expand Down
69 changes: 69 additions & 0 deletions packages/example/components/chains/aptosStandard/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import {
Ed25519PublicKey,
Ed25519Signature,
AccountAuthenticatorEd25519,
AccountAddress,
U64,
U256,
isEncodedEntryFunctionArgument,
} from '@aptos-labs/ts-sdk';
import {
WalletReadyState,
Expand Down Expand Up @@ -314,6 +318,70 @@ function Example() {
/>
</ApiGroup>

<ApiGroup title="SignAndSubmitTransaction Test">
<ApiPayload
title="signAndSubmitTransaction Normal Argument"
description="Normal Argument 测试"
presupposeParams={[
{
id: 'sender',
name: 'sender',
value: JSON.stringify({
recipient: account?.address ?? '',
amount: 100000,
coinType: '0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b',
}),
},
]}
onExecute={async (request: string) => {
const { recipient, amount, coinType } = JSON.parse(request);
return {
result: await signAndSubmitTransaction({
sender: account?.address ?? '',
data: {
function: '0x1::primary_fungible_store::transfer',
typeArguments: ['0x1::fungible_asset::Metadata'],
functionArguments: [coinType, recipient as string, amount as number],
},
}),
};
}}
/>

<ApiPayload
title="signAndSubmitTransaction Encode Argument"
description="Encode Argument 测试 (OneKey、OKX、MizuWallet 等都不支持)"
presupposeParams={[
{
id: 'sender',
name: 'sender',
value: JSON.stringify({
recipient: account?.address ?? '',
amount: 100000,
coinType: '0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b',
}),
},
]}
onExecute={async (request: string) => {
const { recipient, amount, coinType } = JSON.parse(request);
return {
result: await signAndSubmitTransaction({
sender: account?.address ?? '',
data: {
function: '0x1::primary_fungible_store::transfer',
typeArguments: ['0x1::fungible_asset::Metadata'],
functionArguments: [
coinType,
AccountAddress.from(recipient as string),
new U64(amount as number),
],
},
}),
};
}}
/>
</ApiGroup>

<DappList dapps={dapps} />
</>
);
Expand All @@ -326,6 +394,7 @@ function AptosConnectButton() {

const walletsRef = useRef<(Wallet | AptosStandardSupportedWallet)[]>([]);
walletsRef.current = wallets.filter((wallet) => wallet.readyState === WalletReadyState.Installed);
console.log('Aptos Standard Wallets:', walletsRef.current);

const onConnectWallet = useCallback(
async (selectedWallet: IKnownWallet) => {
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.19",
"version": "2.1.20",
"private": true,
"scripts": {
"postinstall": "patch-package",
Expand All @@ -25,17 +25,17 @@
"@metamask/onboarding": "^1.0.1",
"@mizuwallet-sdk/core": "^1.4.0",
"@mysten/dapp-kit": "0.13.2",
"@onekeyfe/cross-inpage-provider-core": "2.1.19",
"@onekeyfe/cross-inpage-provider-types": "2.1.19",
"@onekeyfe/onekey-aptos-provider": "2.1.19",
"@onekeyfe/onekey-cardano-provider": "2.1.19",
"@onekeyfe/onekey-conflux-provider": "2.1.19",
"@onekeyfe/onekey-cosmos-provider": "2.1.19",
"@onekeyfe/onekey-near-provider": "2.1.19",
"@onekeyfe/onekey-solana-provider": "2.1.19",
"@onekeyfe/onekey-sui-provider": "2.1.19",
"@onekeyfe/onekey-tron-provider": "2.1.19",
"@onekeyfe/onekey-webln-provider": "2.1.19",
"@onekeyfe/cross-inpage-provider-core": "2.1.20",
"@onekeyfe/cross-inpage-provider-types": "2.1.20",
"@onekeyfe/onekey-aptos-provider": "2.1.20",
"@onekeyfe/onekey-cardano-provider": "2.1.20",
"@onekeyfe/onekey-conflux-provider": "2.1.20",
"@onekeyfe/onekey-cosmos-provider": "2.1.20",
"@onekeyfe/onekey-near-provider": "2.1.20",
"@onekeyfe/onekey-solana-provider": "2.1.20",
"@onekeyfe/onekey-sui-provider": "2.1.20",
"@onekeyfe/onekey-tron-provider": "2.1.20",
"@onekeyfe/onekey-webln-provider": "2.1.20",
"@polkadot/api": "^9.11.3",
"@polkadot/extension-dapp": "^0.47.5",
"@radix-ui/react-checkbox": "^1.1.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/extension/extension-bridge-hosted/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/extension-bridge-hosted",
"version": "2.1.19",
"version": "2.1.20",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,8 +28,8 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.19",
"@onekeyfe/cross-inpage-provider-types": "2.1.19",
"@onekeyfe/cross-inpage-provider-core": "2.1.20",
"@onekeyfe/cross-inpage-provider-types": "2.1.20",
"uuid": "^8.3.2"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/extension/extension-bridge-injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/extension-bridge-injected",
"version": "2.1.19",
"version": "2.1.20",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,7 +28,7 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.19",
"@onekeyfe/cross-inpage-provider-types": "2.1.19"
"@onekeyfe/cross-inpage-provider-core": "2.1.20",
"@onekeyfe/cross-inpage-provider-types": "2.1.20"
}
}
14 changes: 7 additions & 7 deletions packages/injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-injected",
"version": "2.1.19",
"version": "2.1.20",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -42,12 +42,12 @@
"electron": "*"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.19",
"@onekeyfe/cross-inpage-provider-types": "2.1.19",
"@onekeyfe/desktop-bridge-injected": "2.1.19",
"@onekeyfe/extension-bridge-injected": "2.1.19",
"@onekeyfe/inpage-providers-hub": "2.1.19",
"@onekeyfe/native-bridge-injected": "2.1.19",
"@onekeyfe/cross-inpage-provider-core": "2.1.20",
"@onekeyfe/cross-inpage-provider-types": "2.1.20",
"@onekeyfe/desktop-bridge-injected": "2.1.20",
"@onekeyfe/extension-bridge-injected": "2.1.20",
"@onekeyfe/inpage-providers-hub": "2.1.20",
"@onekeyfe/native-bridge-injected": "2.1.20",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/native/native-bridge-injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/native-bridge-injected",
"version": "2.1.19",
"version": "2.1.20",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,7 +28,7 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.19",
"@onekeyfe/cross-inpage-provider-types": "2.1.19"
"@onekeyfe/cross-inpage-provider-core": "2.1.20",
"@onekeyfe/cross-inpage-provider-types": "2.1.20"
}
}
42 changes: 21 additions & 21 deletions packages/providers/inpage-providers-hub/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/inpage-providers-hub",
"version": "2.1.19",
"version": "2.1.20",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -30,26 +30,26 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.19",
"@onekeyfe/cross-inpage-provider-types": "2.1.19",
"@onekeyfe/onekey-algo-provider": "2.1.19",
"@onekeyfe/onekey-alph-provider": "2.1.19",
"@onekeyfe/onekey-aptos-provider": "2.1.19",
"@onekeyfe/onekey-bfc-provider": "2.1.19",
"@onekeyfe/onekey-btc-provider": "2.1.19",
"@onekeyfe/onekey-cardano-provider": "2.1.19",
"@onekeyfe/onekey-conflux-provider": "2.1.19",
"@onekeyfe/onekey-cosmos-provider": "2.1.19",
"@onekeyfe/onekey-eth-provider": "2.1.19",
"@onekeyfe/onekey-nostr-provider": "2.1.19",
"@onekeyfe/onekey-polkadot-provider": "2.1.19",
"@onekeyfe/onekey-private-provider": "2.1.19",
"@onekeyfe/onekey-scdo-provider": "2.1.19",
"@onekeyfe/onekey-solana-provider": "2.1.19",
"@onekeyfe/onekey-sui-provider": "2.1.19",
"@onekeyfe/onekey-ton-provider": "2.1.19",
"@onekeyfe/onekey-tron-provider": "2.1.19",
"@onekeyfe/onekey-webln-provider": "2.1.19",
"@onekeyfe/cross-inpage-provider-core": "2.1.20",
"@onekeyfe/cross-inpage-provider-types": "2.1.20",
"@onekeyfe/onekey-algo-provider": "2.1.20",
"@onekeyfe/onekey-alph-provider": "2.1.20",
"@onekeyfe/onekey-aptos-provider": "2.1.20",
"@onekeyfe/onekey-bfc-provider": "2.1.20",
"@onekeyfe/onekey-btc-provider": "2.1.20",
"@onekeyfe/onekey-cardano-provider": "2.1.20",
"@onekeyfe/onekey-conflux-provider": "2.1.20",
"@onekeyfe/onekey-cosmos-provider": "2.1.20",
"@onekeyfe/onekey-eth-provider": "2.1.20",
"@onekeyfe/onekey-nostr-provider": "2.1.20",
"@onekeyfe/onekey-polkadot-provider": "2.1.20",
"@onekeyfe/onekey-private-provider": "2.1.20",
"@onekeyfe/onekey-scdo-provider": "2.1.20",
"@onekeyfe/onekey-solana-provider": "2.1.20",
"@onekeyfe/onekey-sui-provider": "2.1.20",
"@onekeyfe/onekey-ton-provider": "2.1.20",
"@onekeyfe/onekey-tron-provider": "2.1.20",
"@onekeyfe/onekey-webln-provider": "2.1.20",
"web3": "^1.7.3"
},
"devDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions packages/providers/onekey-algo-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/onekey-algo-provider",
"version": "2.1.19",
"version": "2.1.20",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,9 +28,9 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.19",
"@onekeyfe/cross-inpage-provider-errors": "2.1.19",
"@onekeyfe/cross-inpage-provider-types": "2.1.19",
"@onekeyfe/extension-bridge-injected": "2.1.19"
"@onekeyfe/cross-inpage-provider-core": "2.1.20",
"@onekeyfe/cross-inpage-provider-errors": "2.1.20",
"@onekeyfe/cross-inpage-provider-types": "2.1.20",
"@onekeyfe/extension-bridge-injected": "2.1.20"
}
}
10 changes: 5 additions & 5 deletions packages/providers/onekey-alph-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/onekey-alph-provider",
"version": "2.1.19",
"version": "2.1.20",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -31,9 +31,9 @@
"@alephium/get-extension-wallet": "^1.5.2",
"@alephium/walletconnect-provider": "^1.5.2",
"@alephium/web3": "^1.5.2",
"@onekeyfe/cross-inpage-provider-core": "2.1.19",
"@onekeyfe/cross-inpage-provider-errors": "2.1.19",
"@onekeyfe/cross-inpage-provider-types": "2.1.19",
"@onekeyfe/extension-bridge-injected": "2.1.19"
"@onekeyfe/cross-inpage-provider-core": "2.1.20",
"@onekeyfe/cross-inpage-provider-errors": "2.1.20",
"@onekeyfe/cross-inpage-provider-types": "2.1.20",
"@onekeyfe/extension-bridge-injected": "2.1.20"
}
}
Loading
Loading