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

[Issue-3862] Support transfer ADA and Cardano Native Assets (CIP-26) #3872

Open
wants to merge 116 commits into
base: subwallet-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
a522dc9
[Issue-3816] feat: support cardano
bluezdot Oct 29, 2024
eca66a2
[Issue-3816] feat: support cardano 2
bluezdot Oct 29, 2024
5c26509
Merge branch 'subwallet-dev' into koni/dev/3816
Nov 8, 2024
6c8cdd2
[Issue-3816] fix: remove BlockFrostAPI interface, remove libs
bluezdot Nov 11, 2024
5c1e93d
[Issue-3816] feat: support display balance on cardano
bluezdot Nov 12, 2024
0328a2a
[Issue-3816] fix: fix eslint
bluezdot Nov 12, 2024
cee7566
[Issue-3816] fix: minor fix
bluezdot Nov 12, 2024
2d3d625
[Issue-3816] fix: minor fix
bluezdot Nov 12, 2024
b868187
Merge branch 'refs/heads/koni/dev/3816' into koni/dev/issue-3862
bluezdot Nov 26, 2024
7f56122
[Issue-3816] build: config webpack for csl lib
bluezdot Nov 26, 2024
55ac997
[Issue-3816] feat: add validate to display chain, token and balance f…
bluezdot Nov 27, 2024
3491198
Merge branch 'refs/heads/koni/dev/3816' into koni/dev/issue-3862
bluezdot Nov 27, 2024
35a9b9e
[Issue-3862] feat: handle cardano transaction before signing
bluezdot Nov 27, 2024
3e15079
[Issue-3862] feat: handle sign and approve send cardano
bluezdot Nov 29, 2024
45aa3ce
[Issue-3862] feat: transfer CNA
Dec 3, 2024
e9b7121
[Issue-3862] feat: tx status and ttl
Dec 3, 2024
ca8afa4
[Issue-3862] fix: fix export Cardano TTL config
bluezdot Dec 6, 2024
2e2223a
[Issue-3862] fix: fix tx hash returned from api, add analyze address …
bluezdot Dec 6, 2024
4194501
[Issue-3862] fix: fix display tx history
bluezdot Dec 6, 2024
36d430c
[Issue-3862] feat: handle send failed
bluezdot Dec 6, 2024
fc2e2e2
[Issue-3862] build: resolve build error
bluezdot Dec 9, 2024
b1dcea1
[Issue-3901] feat: support import watch-only cardano
bluezdot Dec 16, 2024
6c9a0af
[Issue-3901] feat: support import, export 15 word phrase
bluezdot Dec 16, 2024
1425935
[Issue-3927] Update function isAddressAndChainCompatible for working …
lw-cdm Dec 17, 2024
6ddcbb6
[Issue-3927] Remove mock code
lw-cdm Dec 17, 2024
87e5b69
[Issue-3927] Update logic for combineAllAccountProxy to work with Car…
lw-cdm Dec 17, 2024
ed2b984
[Issue-3927] Update logos for Cardano
lw-cdm Dec 17, 2024
9ce45ab
Merge branch 'refs/heads/koni/dev/issue-3927' into koni/dev/issue-3862
bluezdot Dec 17, 2024
96c8d8c
Merge branch 'refs/heads/subwallet-dev' into koni/dev/issue-3862
bluezdot Dec 18, 2024
e89a33a
[Issue-3926] feat: add feature to check if unified accounts need migrate
bluezdot Dec 18, 2024
a26afb0
Merge branch 'refs/heads/subwallet-dev' into koni/dev/issue-3862
bluezdot Dec 18, 2024
f24e7cc
[Issue-3926] feat: create all messages interface
bluezdot Dec 19, 2024
11ebb10
Merge branch 'refs/heads/koni/dev/issue-3862' into koni/dev/issue-3926
bluezdot Dec 20, 2024
d6455fd
[Issue-3926] feat: create ping session id message
bluezdot Dec 20, 2024
b552310
Rename types, interfaces, functions
lw-cdm Dec 20, 2024
aef90bd
[Issue-3926] feat: classify solo account need to be migrated
bluezdot Dec 23, 2024
96c2eb8
[Issue-3926] feat: add api to check if has any account need to be mig…
bluezdot Dec 23, 2024
e239319
[Issue-3926] feat: remove unused function
bluezdot Dec 24, 2024
6310ef3
[Issue-3926] feat: check acknowledgedMigration
bluezdot Dec 24, 2024
3ba31ae
[Issue-3925] feat: support cardano derive
bluezdot Dec 24, 2024
ad4f135
[Issue-3926] Update MigrateAccount screen
lw-cdm Dec 24, 2024
e06d25c
[Issue-3926] Update screen AccountSettings
lw-cdm Dec 24, 2024
0f44537
[Issue-3926] Add account settings button
lw-cdm Dec 24, 2024
920fc98
[Issue-3925] refactor: refactor interface param name
bluezdot Dec 24, 2024
3f09dee
Merge remote-tracking branch 'refs/remotes/origin/koni/dev/issue-3926…
lw-cdm Dec 24, 2024
2e5cd04
[Issue-3926] refactor: refactor interface param name
bluezdot Dec 24, 2024
e40748b
[Issue-3926] fix: ignore bitcoin from migration
bluezdot Dec 24, 2024
ef4e499
[Issue-3926] Update screen MigrateAccount
lw-cdm Dec 24, 2024
ff580a2
[Issue-3926] Update navigation flow for MigrateAccount
lw-cdm Dec 25, 2024
4c126a2
[Issue-3926] feat: migrate unified to unified; get eligible solo acc …
bluezdot Dec 24, 2024
de773a9
Merge branch 'refs/heads/koni/dev/issue-3926-ui' into koni/dev/issue-…
bluezdot Dec 25, 2024
be33b71
[Issue-3926] test: remove mock code
bluezdot Dec 25, 2024
0355005
[Issue-3926] Update MigrateAccount screen
lw-cdm Dec 25, 2024
d7e620d
[Issue-3926] feat: ping-pong mechanism to persist session information
bluezdot Dec 25, 2024
6d03ad6
[Issue-3926] Update BriefView for MigrateAccount
lw-cdm Dec 25, 2024
4cab38f
Merge remote-tracking branch 'refs/remotes/origin/koni/dev/issue-3926…
lw-cdm Dec 25, 2024
5d169a3
[Issue-3926] feat: update interface SoloAccountToBeMigrated
bluezdot Dec 25, 2024
5b2f52f
[Issue-3926] feat: migrate solo account to unified account
bluezdot Dec 25, 2024
5cc67d0
[Issue-3926] Update style for BriefView
lw-cdm Dec 25, 2024
6726e39
Merge remote-tracking branch 'refs/remotes/origin/koni/dev/issue-3926…
lw-cdm Dec 26, 2024
caeab65
[Issue-3926] refactor: rename interface feature
bluezdot Dec 26, 2024
7b07c2c
[Issue-3926] Update chain type logos correctly
lw-cdm Dec 26, 2024
4040378
[Issue-3926] fix: fix lock keyring
bluezdot Dec 26, 2024
cf9a136
Merge remote-tracking branch 'refs/remotes/origin/koni/dev/issue-3926…
lw-cdm Dec 26, 2024
ad818cc
[Issue-3926] fix: fix display success migrate unified account
bluezdot Dec 26, 2024
bee3c3a
[Issue-3926] fix: fix check migratable of ton-native account
bluezdot Dec 26, 2024
efd21f2
[Issue-3926] feat: migrate derived solo account relationship
bluezdot Dec 26, 2024
d589676
Merge remote-tracking branch 'refs/remotes/origin/koni/dev/issue-3926…
lw-cdm Dec 26, 2024
a198570
[Issue-3926] feat: migrate derived solo account relationship
bluezdot Dec 26, 2024
dd49483
Merge branch 'refs/heads/koni/dev/issue-3926-ui' into koni/dev/issue-…
bluezdot Dec 26, 2024
7aaa0fd
[Issue-3926] refactor: minor improve
bluezdot Dec 26, 2024
6e5a09c
[Issue-3927] Reorder chain type logos for some components
lw-cdm Dec 26, 2024
da0f5d6
Merge remote-tracking branch 'refs/remotes/origin/koni/dev/issue-3926…
lw-cdm Dec 26, 2024
938feba
[Issue-3927] Update _chainInfoToChainType to work with cardano
lw-cdm Dec 26, 2024
928a361
[Issue-3926] refactor: improve code clean
bluezdot Dec 26, 2024
246ad71
[Issue-3926] refactor: move utils function
bluezdot Dec 26, 2024
89f02e1
[Issue-3926] feat: migrate notifications in case migrate solo account…
bluezdot Dec 30, 2024
7fdc393
[Issue-3926] feat: ensure the keyring is lock if migration failed
bluezdot Dec 31, 2024
68fe4b0
[Issue-3926] Update some UX logic
lw-cdm Dec 31, 2024
85b1adf
[Issue-3926] perf: optimize performance of migrate relationship betwe…
bluezdot Dec 31, 2024
07adbd7
Merge branch 'refs/heads/koni/dev/issue-3926-ui' into koni/dev/issue-…
bluezdot Dec 31, 2024
2cdc8e8
[Issue-3926] fix: fix minor UI
bluezdot Dec 31, 2024
02941f2
[Issue-3926] feat: add interface to check migrate progress
bluezdot Dec 31, 2024
b51292f
[Issue-3926] feat: add message ping migration done
bluezdot Jan 2, 2025
90fc2bf
[Issue-3926] feat: re-order migration steps
bluezdot Jan 2, 2025
93c1dbd
[Issue-3926] fix: update title name when migrating notification for u…
bluezdot Jan 2, 2025
d46611b
[Issue-3926] Update account migration UX logic
lw-cdm Jan 2, 2025
a038009
Merge remote-tracking branch 'refs/remotes/origin/koni/dev/issue-3926…
lw-cdm Jan 2, 2025
e2aac32
[Issue-3926] fix: exception handle for migrating notification for uni…
bluezdot Jan 2, 2025
c1aaf76
Merge branch 'refs/heads/koni/dev/issue-3926-ui' into koni/dev/issue-…
bluezdot Jan 2, 2025
95ea3f3
[Issue-3926] fix: remove unused message
bluezdot Jan 2, 2025
25ff8d7
[Issue-3942] feat: build unsigned tx from API
bluezdot Jan 7, 2025
b4341d8
[Issue-3942] refactor: move interface
bluezdot Jan 8, 2025
687a120
[Issue-3942] feat: handle case self-transfer
bluezdot Jan 8, 2025
01b2c8c
Merge branch 'refs/heads/koni/dev/issue-3862' into koni/dev/issue-3926
bluezdot Jan 8, 2025
9d898ec
[Issue-3926] feat: rename solo account in migrate process to avoid du…
bluezdot Jan 8, 2025
68c58eb
[Issue-3926] feat: add warning derive cardano F2
bluezdot Jan 8, 2025
d9a9677
Merge branch 'refs/heads/subwallet-dev' into koni/dev/issue-3862
bluezdot Jan 8, 2025
28253af
Merge branch 'refs/heads/koni/dev/issue-3862' into koni/dev/issue-3926
bluezdot Jan 8, 2025
bc889a9
[Issue-3926] refactor: refactor unsigned tx validation
bluezdot Jan 9, 2025
8eaecac
[Issue-3942] refactor: refactor unsigned tx validation
bluezdot Jan 9, 2025
8948991
Revert "[Issue-3926] refactor: refactor unsigned tx validation"
bluezdot Jan 9, 2025
d09730b
[Issue-3926] Update UX and content for account migration feature
lw-cdm Jan 10, 2025
96a6398
[Issue-3942] refactor: minor refactor
bluezdot Jan 13, 2025
b7485af
[Issue-3942] feat: throw error when build failed
bluezdot Jan 13, 2025
71aeb0d
Merge branch 'refs/heads/koni/dev/issue-3942' into koni/dev/issue-3862
bluezdot Jan 14, 2025
667ee3b
Merge branch 'refs/heads/koni/dev/issue-3926' into koni/dev/issue-3862
bluezdot Jan 16, 2025
1943aba
[Issue-3942] feat: validate recipient when transfer cardano
bluezdot Jan 21, 2025
cd1d46d
[Issue-3942] feat: handle exception message if build tx fail
bluezdot Jan 21, 2025
2916234
[Sdk] Init package
S2kael Jan 21, 2025
a645644
[Issue-3926] Update some UI issues
lw-cdm Jan 21, 2025
488b9c3
[Issue-3942] feat: Handle message error when build tx
bluezdot Jan 21, 2025
72a0c7a
[Issue-3942] fix: remove unused code
bluezdot Jan 21, 2025
974ea8f
Merge branch 'refs/heads/koni/dev/issue-3926' into koni/dev/issue-3862
bluezdot Jan 22, 2025
f129a7a
[Issue-3926] fix: update solo account name, update current account
bluezdot Jan 22, 2025
05aae1b
Merge branch 'refs/heads/koni/dev/issue-3942-fix-bug' into koni/dev/i…
bluezdot Jan 22, 2025
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
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ BITTENSOR_API_KEY_3=abafdbad3
BITTENSOR_API_KEY_4=abafdbad4
BITTENSOR_API_KEY_5=abafdbad5
BITTENSOR_API_KEY_6=abafdbad6
SUBWALLET_API=localhost
SIMPLE_SWAP_API_KEY=abacasdf
SUBWALLET_API=http://localhost:3000/api
3 changes: 2 additions & 1 deletion .github/workflows/push-koni-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ jobs:
TRANSAK_API_KEY: ${{ secrets.TRANSAK_API_KEY }}
COINBASE_PAY_ID: ${{ secrets.COINBASE_PAY_ID }}
CHAINFLIP_BROKER_API: ${{ secrets.CHAINFLIP_BROKER_API }}
BITTENSOR_API_KEY_1: ${{ secrets.BITTENSOR_API_KEY_1 }}
BITTENSOR_API_KEY_1: ${{ secrets.BITTENSOR_API_KEY_1 }}
BITTENSOR_API_KEY_2: ${{ secrets.BITTENSOR_API_KEY_2 }}
BITTENSOR_API_KEY_3: ${{ secrets.BITTENSOR_API_KEY_3 }}
BITTENSOR_API_KEY_4: ${{ secrets.BITTENSOR_API_KEY_4 }}
BITTENSOR_API_KEY_5: ${{ secrets.BITTENSOR_API_KEY_5 }}
BITTENSOR_API_KEY_6: ${{ secrets.BITTENSOR_API_KEY_6 }}
SUBWALLET_API: ${{ secrets.SUBWALLET_API }}
SIMPLE_SWAP_API_KEY: ${{ secrets.SIMPLE_SWAP_API_KEY }}
GH_RELEASE_FILES: master-build.zip,master-src.zip
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ jobs:
TRANSAK_API_KEY: ${{ secrets.TRANSAK_API_KEY }}
COINBASE_PAY_ID: ${{ secrets.COINBASE_PAY_ID }}
CHAINFLIP_BROKER_API: ${{ secrets.CHAINFLIP_BROKER_API }}
BITTENSOR_API_KEY_1: ${{ secrets.BITTENSOR_API_KEY_1 }}
BITTENSOR_API_KEY_1: ${{ secrets.BITTENSOR_API_KEY_1 }}
BITTENSOR_API_KEY_2: ${{ secrets.BITTENSOR_API_KEY_2 }}
BITTENSOR_API_KEY_3: ${{ secrets.BITTENSOR_API_KEY_3 }}
BITTENSOR_API_KEY_4: ${{ secrets.BITTENSOR_API_KEY_4 }}
BITTENSOR_API_KEY_5: ${{ secrets.BITTENSOR_API_KEY_5 }}
BITTENSOR_API_KEY_6: ${{ secrets.BITTENSOR_API_KEY_6 }}
SIMPLE_SWAP_API_KEY: ${{ secrets.SIMPLE_SWAP_API_KEY }}
SUBWALLET_API: ${{ secrets.SUBWALLET_API }}
BRANCH_NAME: ${{ github.ref_name }}
run: |
yarn install --immutable | grep -v 'YN0013'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/push-web-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ jobs:
TRANSAK_API_KEY: ${{ secrets.TRANSAK_API_KEY }}
COINBASE_PAY_ID: ${{ secrets.COINBASE_PAY_ID }}
CHAINFLIP_BROKER_API: ${{ secrets.CHAINFLIP_BROKER_API }}
BITTENSOR_API_KEY_1: ${{ secrets.BITTENSOR_API_KEY_1 }}
BITTENSOR_API_KEY_1: ${{ secrets.BITTENSOR_API_KEY_1 }}
BITTENSOR_API_KEY_2: ${{ secrets.BITTENSOR_API_KEY_2 }}
BITTENSOR_API_KEY_3: ${{ secrets.BITTENSOR_API_KEY_3 }}
BITTENSOR_API_KEY_4: ${{ secrets.BITTENSOR_API_KEY_4 }}
BITTENSOR_API_KEY_5: ${{ secrets.BITTENSOR_API_KEY_5 }}
BITTENSOR_API_KEY_6: ${{ secrets.BITTENSOR_API_KEY_6 }}
SIMPLE_SWAP_API_KEY: ${{ secrets.SIMPLE_SWAP_API_KEY }}
SUBWALLET_API: ${{ secrets.SUBWALLET_API }}
BRANCH_NAME: master
run: |
yarn install --immutable | grep -v 'YN0013'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/push-webapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ jobs:
COINBASE_PAY_ID: ${{ secrets.COINBASE_PAY_ID }}
NFT_MINTING_HOST: ${{ secrets.NFT_MINTING_HOST }}
CHAINFLIP_BROKER_API: ${{ secrets.CHAINFLIP_BROKER_API }}
BITTENSOR_API_KEY_1: ${{ secrets.BITTENSOR_API_KEY_1 }}
BITTENSOR_API_KEY_1: ${{ secrets.BITTENSOR_API_KEY_1 }}
BITTENSOR_API_KEY_2: ${{ secrets.BITTENSOR_API_KEY_2 }}
SIMPLE_SWAP_API_KEY: ${{ secrets.SIMPLE_SWAP_API_KEY }}
SUBWALLET_API: ${{ secrets.SUBWALLET_API }}
BRANCH_NAME: ${{ github.ref_name }}
run: |
yarn install --immutable | grep -v 'YN0013'
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@
"@polkadot/types-support": "^15.0.1",
"@polkadot/util": "^13.2.3",
"@polkadot/util-crypto": "^13.2.3",
"@subwallet/chain-list": "0.2.97",
"@subwallet/keyring": "^0.1.8-beta.0",
"@subwallet/chain-list": "file:../SubWallet-Chainlist/packages/chain-list/build/",
"@subwallet/keyring": "file:../SubWallet-Base/packages/keyring/build/",
"@subwallet/react-ui": "5.1.2-b79",
"@subwallet/ui-keyring": "0.1.8-beta.0",
"@subwallet/ui-keyring": "file:../SubWallet-Base/packages/ui-keyring/build/",
"@types/bn.js": "^5.1.6",
"@zondax/ledger-substrate": "1.0.1",
"babel-core": "^7.0.0-bridge.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/extension-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@apollo/client": "^3.7.14",
"@azns/resolver-core": "^1.4.0",
"@chainflip/sdk": "^1.6.0",
"@emurgo/cardano-serialization-lib-nodejs": "^13.2.0",
"@equilab/api": "~1.14.25",
"@ethereumjs/common": "^4.1.0",
"@ethereumjs/tx": "^5.1.0",
Expand Down Expand Up @@ -61,6 +62,7 @@
"@subwallet/extension-dapp": "^1.3.12-1",
"@subwallet/extension-inject": "^1.3.12-1",
"@subwallet/keyring": "^0.1.8-beta.0",
"@subwallet/subwallet-api-sdk": "^1.3.12-1",
"@subwallet/ui-keyring": "^0.1.8-beta.0",
"@ton/core": "^0.56.3",
"@ton/crypto": "^3.2.0",
Expand Down
93 changes: 88 additions & 5 deletions packages/extension-base/src/background/KoniTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Resolver } from '@subwallet/extension-base/background/handlers/State';
import { AccountAuthType, AuthorizeRequest, ConfirmationRequestBase, RequestAccountList, RequestAccountSubscribe, RequestAccountUnsubscribe, RequestAuthorizeCancel, RequestAuthorizeReject, RequestAuthorizeSubscribe, RequestAuthorizeTab, RequestCurrentAccountAddress, ResponseAuthorizeList } from '@subwallet/extension-base/background/types';
import { AppConfig, BrowserConfig, OSConfig } from '@subwallet/extension-base/constants';
import { RequestOptimalTransferProcess } from '@subwallet/extension-base/services/balance-service/helpers';
import { CardanoTransactionConfig } from '@subwallet/extension-base/services/balance-service/transfer/cardano-transfer';
import { TonTransactionConfig } from '@subwallet/extension-base/services/balance-service/transfer/ton-transfer';
import { _CHAIN_VALIDATION_ERROR } from '@subwallet/extension-base/services/chain-service/handler/types';
import { _ChainState, _EvmApi, _NetworkUpsertParams, _SubstrateApi, _ValidateCustomAssetRequest, _ValidateCustomAssetResponse, EnableChainParams, EnableMultiChainParams } from '@subwallet/extension-base/services/chain-service/types';
Expand All @@ -16,7 +17,7 @@ import { AuthUrls } from '@subwallet/extension-base/services/request-service/typ
import { CrowdloanContributionsResponse } from '@subwallet/extension-base/services/subscan-service/types';
import { SWTransactionResponse, SWTransactionResult } from '@subwallet/extension-base/services/transaction-service/types';
import { WalletConnectNotSupportRequest, WalletConnectSessionRequest } from '@subwallet/extension-base/services/wallet-connect-service/types';
import { AccountJson, AccountsWithCurrentAddress, AddressJson, BalanceJson, BaseRequestSign, BuyServiceInfo, BuyTokenInfo, CommonOptimalPath, CurrentAccountInfo, EarningRewardHistoryItem, EarningRewardJson, EarningStatus, HandleYieldStepParams, InternalRequestSign, LeavePoolAdditionalData, NominationPoolInfo, OptimalYieldPath, OptimalYieldPathParams, RequestAccountBatchExportV2, RequestAccountCreateSuriV2, RequestAccountNameValidate, RequestAccountProxyEdit, RequestAccountProxyForget, RequestBatchJsonGetAccountInfo, RequestBatchRestoreV2, RequestBounceableValidate, RequestChangeTonWalletContractVersion, RequestCheckCrossChainTransfer, RequestCheckPublicAndSecretKey, RequestCheckTransfer, RequestCrossChainTransfer, RequestDeriveCreateMultiple, RequestDeriveCreateV3, RequestDeriveValidateV2, RequestEarlyValidateYield, RequestExportAccountProxyMnemonic, RequestGetAllTonWalletContractVersion, RequestGetDeriveAccounts, RequestGetDeriveSuggestion, RequestGetYieldPoolTargets, RequestInputAccountSubscribe, RequestJsonGetAccountInfo, RequestJsonRestoreV2, RequestMetadataHash, RequestMnemonicCreateV2, RequestMnemonicValidateV2, RequestPrivateKeyValidateV2, RequestShortenMetadata, RequestStakeCancelWithdrawal, RequestStakeClaimReward, RequestTransfer, RequestUnlockDotCheckCanMint, RequestUnlockDotSubscribeMintedData, RequestYieldLeave, RequestYieldStepSubmit, RequestYieldWithdrawal, ResponseAccountBatchExportV2, ResponseAccountCreateSuriV2, ResponseAccountNameValidate, ResponseBatchJsonGetAccountInfo, ResponseCheckPublicAndSecretKey, ResponseDeriveValidateV2, ResponseEarlyValidateYield, ResponseExportAccountProxyMnemonic, ResponseGetAllTonWalletContractVersion, ResponseGetDeriveAccounts, ResponseGetDeriveSuggestion, ResponseGetYieldPoolTargets, ResponseInputAccountSubscribe, ResponseJsonGetAccountInfo, ResponseMetadataHash, ResponseMnemonicCreateV2, ResponseMnemonicValidateV2, ResponsePrivateKeyValidateV2, ResponseShortenMetadata, StorageDataInterface, SubmitYieldStepData, SwapPair, SwapQuoteResponse, SwapRequest, SwapRequestResult, SwapSubmitParams, SwapTxData, TokenSpendingApprovalParams, UnlockDotTransactionNft, UnstakingStatus, ValidateSwapProcessParams, ValidateYieldProcessParams, YieldPoolInfo, YieldPositionInfo } from '@subwallet/extension-base/types';
import { AccountChainType, AccountJson, AccountsWithCurrentAddress, AddressJson, BalanceJson, BaseRequestSign, BuyServiceInfo, BuyTokenInfo, CommonOptimalPath, CurrentAccountInfo, EarningRewardHistoryItem, EarningRewardJson, EarningStatus, HandleYieldStepParams, InternalRequestSign, LeavePoolAdditionalData, NominationPoolInfo, OptimalYieldPath, OptimalYieldPathParams, RequestAccountBatchExportV2, RequestAccountCreateSuriV2, RequestAccountNameValidate, RequestAccountProxyEdit, RequestAccountProxyForget, RequestBatchJsonGetAccountInfo, RequestBatchRestoreV2, RequestBounceableValidate, RequestChangeTonWalletContractVersion, RequestCheckCrossChainTransfer, RequestCheckPublicAndSecretKey, RequestCheckTransfer, RequestCrossChainTransfer, RequestDeriveCreateMultiple, RequestDeriveCreateV3, RequestDeriveValidateV2, RequestEarlyValidateYield, RequestExportAccountProxyMnemonic, RequestGetAllTonWalletContractVersion, RequestGetDeriveAccounts, RequestGetDeriveSuggestion, RequestGetYieldPoolTargets, RequestInputAccountSubscribe, RequestJsonGetAccountInfo, RequestJsonRestoreV2, RequestMetadataHash, RequestMnemonicCreateV2, RequestMnemonicValidateV2, RequestPrivateKeyValidateV2, RequestShortenMetadata, RequestStakeCancelWithdrawal, RequestStakeClaimReward, RequestTransfer, RequestUnlockDotCheckCanMint, RequestUnlockDotSubscribeMintedData, RequestYieldLeave, RequestYieldStepSubmit, RequestYieldWithdrawal, ResponseAccountBatchExportV2, ResponseAccountCreateSuriV2, ResponseAccountNameValidate, ResponseBatchJsonGetAccountInfo, ResponseCheckPublicAndSecretKey, ResponseDeriveValidateV2, ResponseEarlyValidateYield, ResponseExportAccountProxyMnemonic, ResponseGetAllTonWalletContractVersion, ResponseGetDeriveAccounts, ResponseGetDeriveSuggestion, ResponseGetYieldPoolTargets, ResponseInputAccountSubscribe, ResponseJsonGetAccountInfo, ResponseMetadataHash, ResponseMnemonicCreateV2, ResponseMnemonicValidateV2, ResponsePrivateKeyValidateV2, ResponseShortenMetadata, StorageDataInterface, SubmitYieldStepData, SwapPair, SwapQuoteResponse, SwapRequest, SwapRequestResult, SwapSubmitParams, SwapTxData, TokenSpendingApprovalParams, UnlockDotTransactionNft, UnstakingStatus, ValidateSwapProcessParams, ValidateYieldProcessParams, YieldPoolInfo, YieldPositionInfo } from '@subwallet/extension-base/types';
import { RequestClaimBridge } from '@subwallet/extension-base/types/bridge';
import { GetNotificationParams, RequestIsClaimedPolygonBridge, RequestSwitchStatusParams } from '@subwallet/extension-base/types/notification';
import { InjectedAccount, InjectedAccountWithMeta, MetadataDefBase } from '@subwallet/extension-inject/types';
Expand Down Expand Up @@ -424,6 +425,9 @@ export interface UiSettings {
unlockType: WalletUnlockType;
enableChainPatrol: boolean;
notificationSetup: NotificationSetup;
isAcknowledgedUnifiedAccountMigration: boolean;
isUnifiedAccountMigrationInProgress: boolean;
isUnifiedAccountMigrationDone: boolean;
// On-ramp service account reference
walletReference: string;
}
Expand Down Expand Up @@ -467,7 +471,9 @@ export enum TransactionDirection {
export enum ChainType {
EVM = 'evm',
SUBSTRATE = 'substrate',
TON = 'ton'
BITCOIN = 'bitcoin',
TON = 'ton',
CARDANO = 'cardano'
}

export enum ExtrinsicType {
Expand Down Expand Up @@ -1080,6 +1086,12 @@ export interface TonSignRequest {
canSign: boolean;
}

export interface CardanoSignRequest {
account: AccountJson;
hashPayload: string;
canSign: boolean;
}

export interface ErrorValidation {
message: string;
name: string;
Expand All @@ -1098,6 +1110,12 @@ export interface TonSignatureRequest extends TonSignRequest {
payload: unknown;
}

export interface CardanoSignatureRequest extends CardanoSignRequest {
id: string;
type: string;
payload: unknown
}

export interface EvmSendTransactionRequest extends TransactionConfig, EvmSignRequest {
estimateGas: string;
parseData: EvmTransactionData;
Expand All @@ -1107,9 +1125,11 @@ export interface EvmSendTransactionRequest extends TransactionConfig, EvmSignReq

// TODO: add account info + dataToSign
export type TonSendTransactionRequest = TonTransactionConfig;
export type CardanoSendTransactionRequest = CardanoTransactionConfig;

export type EvmWatchTransactionRequest = EvmSendTransactionRequest;
export type TonWatchTransactionRequest = TonSendTransactionRequest;
export type CardanoWatchTransactionRequest = CardanoSendTransactionRequest;

export interface ConfirmationsQueueItemOptions {
requiredPassword?: boolean;
Expand Down Expand Up @@ -1175,28 +1195,40 @@ export interface ConfirmationDefinitionsTon {
tonWatchTransactionRequest: [ConfirmationsQueueItem<TonWatchTransactionRequest>, ConfirmationResult<string>]
}

export interface ConfirmationDefinitionsCardano {
cardanoSignatureRequest: [ConfirmationsQueueItem<CardanoSignatureRequest>, ConfirmationResult<string>],
cardanoSendTransactionRequest: [ConfirmationsQueueItem<CardanoSendTransactionRequest>, ConfirmationResult<string>],
cardanoWatchTransactionRequest: [ConfirmationsQueueItem<CardanoWatchTransactionRequest>, ConfirmationResult<string>]
}

export type ConfirmationType = keyof ConfirmationDefinitions;
export type ConfirmationTypeTon = keyof ConfirmationDefinitionsTon;
export type ConfirmationTypeCardano = keyof ConfirmationDefinitionsCardano;

export type ConfirmationsQueue = {
[CT in ConfirmationType]: Record<string, ConfirmationDefinitions[CT][0]>;
}
export type ConfirmationsQueueTon = {
[CT in ConfirmationTypeTon]: Record<string, ConfirmationDefinitionsTon[CT][0]>;
}
export type ConfirmationsQueueCardano = {
[CT in ConfirmationTypeCardano]: Record<string, ConfirmationDefinitionsCardano[CT][0]>;
}

export type RequestConfirmationsSubscribe = null;

export type RequestConfirmationsSubscribeTon = null;
export type RequestConfirmationsSubscribeCardano = null;

// Design to use only one confirmation
export type RequestConfirmationComplete = {
[CT in ConfirmationType]?: ConfirmationDefinitions[CT][1];
}

export type RequestConfirmationCompleteTon = {
[CT in ConfirmationTypeTon]?: ConfirmationDefinitionsTon[CT][1];
}
export type RequestConfirmationCompleteCardano = {
[CT in ConfirmationTypeCardano]?: ConfirmationDefinitionsCardano[CT][1];
}

export interface BondingOptionParams {
chain: string;
Expand Down Expand Up @@ -1893,6 +1925,47 @@ export interface ResponseNftImport {

/* Campaign */

/* Migrate Unified Account */
export interface RequestSaveMigrationAcknowledgedStatus {
isAcknowledgedUnifiedAccountMigration: boolean;
}

export interface RequestSaveUnifiedAccountMigrationInProgress {
isUnifiedAccountMigrationInProgress: boolean;
}

export interface RequestMigrateUnifiedAndFetchEligibleSoloAccounts {
password: string
}

export interface ResponseMigrateUnifiedAndFetchEligibleSoloAccounts {
migratedUnifiedAccountIds: string[],
soloAccounts: Record<string, SoloAccountToBeMigrated[]>
sessionId: string; // to keep linking to password in state
}

export interface SoloAccountToBeMigrated {
upcomingProxyId: string,
proxyId: string,
address: string,
name: string,
chainType: AccountChainType
}

export interface RequestMigrateSoloAccount {
soloAccounts: SoloAccountToBeMigrated[];
accountName: string;
sessionId: string;
}

export interface ResponseMigrateSoloAccount {
migratedUnifiedAccountId: string
}

export interface RequestPingSession {
sessionId: string;
}

/* Core types */
export type _Address = string;
export type _BalanceMetadata = unknown;
Expand Down Expand Up @@ -2072,7 +2145,10 @@ export interface KoniRequestSignatures {
'pri(settings.saveAutoLockTime)': [RequestChangeTimeAutoLock, boolean];
'pri(settings.saveUnlockType)': [RequestUnlockType, boolean];
'pri(settings.saveEnableChainPatrol)': [RequestChangeEnableChainPatrol, boolean];
'pri(settings.saveNotificationSetup)': [NotificationSetup, boolean]
'pri(settings.saveNotificationSetup)': [NotificationSetup, boolean];
'pri(settings.saveUnifiedAccountMigrationInProgress)': [RequestSaveUnifiedAccountMigrationInProgress, boolean];
'pri(settings.pingUnifiedAccountMigrationDone)': [null, boolean];
'pri(settings.saveMigrationAcknowledgedStatus)': [RequestSaveMigrationAcknowledgedStatus, boolean];
'pri(settings.saveLanguage)': [RequestChangeLanguage, boolean];
'pri(settings.savePriceCurrency)': [RequestChangePriceCurrency, boolean];
'pri(settings.saveShowZeroBalance)': [RequestChangeShowZeroBalance, boolean];
Expand Down Expand Up @@ -2156,8 +2232,10 @@ export interface KoniRequestSignatures {
// Confirmation Queues
'pri(confirmations.subscribe)': [RequestConfirmationsSubscribe, ConfirmationsQueue, ConfirmationsQueue];
'pri(confirmationsTon.subscribe)': [RequestConfirmationsSubscribeTon, ConfirmationsQueueTon, ConfirmationsQueueTon];
'pri(confirmationsCardano.subscribe)': [RequestConfirmationsSubscribeCardano, ConfirmationsQueueCardano, ConfirmationsQueueCardano];
'pri(confirmations.complete)': [RequestConfirmationComplete, boolean];
'pri(confirmationsTon.complete)': [RequestConfirmationCompleteTon, boolean];
'pri(confirmationsCardano.complete)': [RequestConfirmationCompleteCardano, boolean];

'pub(utils.getRandom)': [RandomTestRequest, number];
'pub(accounts.listV2)': [RequestAccountList, InjectedAccount[]];
Expand Down Expand Up @@ -2297,6 +2375,11 @@ export interface KoniRequestSignatures {

/* Ledger */
'pri(ledger.generic.allow)': [null, string[], string[]];

/* Migrate Unified Account */
'pri(migrate.migrateUnifiedAndFetchEligibleSoloAccounts)': [RequestMigrateUnifiedAndFetchEligibleSoloAccounts, ResponseMigrateUnifiedAndFetchEligibleSoloAccounts];
'pri(migrate.migrateSoloAccount)': [RequestMigrateSoloAccount, ResponseMigrateSoloAccount];
'pri(migrate.pingSession)': [RequestPingSession, boolean];
}

export interface ApplicationMetadataType {
Expand Down
8 changes: 6 additions & 2 deletions packages/extension-base/src/constants/signing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import { AccountChainType } from '@subwallet/extension-base/types';
export const SIGNING_COMPATIBLE_MAP: Record<ChainType, AccountChainType[]> = {
[ChainType.SUBSTRATE]: [AccountChainType.SUBSTRATE, AccountChainType.ETHEREUM],
[ChainType.EVM]: [AccountChainType.ETHEREUM],
[ChainType.TON]: [AccountChainType.TON]
[ChainType.BITCOIN]: [AccountChainType.BITCOIN],
[ChainType.TON]: [AccountChainType.TON],
[ChainType.CARDANO]: [AccountChainType.CARDANO]
};

export const LEDGER_SIGNING_COMPATIBLE_MAP: Record<ChainType, AccountChainType[]> = {
[ChainType.SUBSTRATE]: [AccountChainType.SUBSTRATE],
[ChainType.EVM]: [AccountChainType.ETHEREUM],
[ChainType.TON]: [AccountChainType.TON]
[ChainType.BITCOIN]: [AccountChainType.BITCOIN],
[ChainType.TON]: [AccountChainType.TON],
[ChainType.CARDANO]: [AccountChainType.CARDANO]
};
Loading