From e8c9e42ac13401bbc8ed813ee4ec19eef1852734 Mon Sep 17 00:00:00 2001 From: Stephen Debel Date: Thu, 4 Apr 2024 10:19:43 +0200 Subject: [PATCH 1/5] fix/coreum-cosmos-staking * fix/coreum-cosmos-staking * fix/coreum-cosmos-staking --- .../src/v1/node/CosmosNodeClient.ts | 38 +++--- .../src/v1/protocol/CosmosBaseProtocol.ts | 114 +++++++++--------- .../data/transaction/message/CosmosMessage.ts | 3 +- packages/cosmos-core/src/v1/types/rpc.ts | 16 ++- packages/cosmos/test/v1/paging.spec.ts | 8 +- packages/cosmos/test/v1/protocol.spec.ts | 1 - packages/cosmos/test/v1/specs/cosmos.ts | 24 ++-- packages/icp/test/stubs/icp.stub.ts | 15 ++- 8 files changed, 117 insertions(+), 102 deletions(-) diff --git a/packages/cosmos-core/src/v1/node/CosmosNodeClient.ts b/packages/cosmos-core/src/v1/node/CosmosNodeClient.ts index d03046e1..35843036 100644 --- a/packages/cosmos-core/src/v1/node/CosmosNodeClient.ts +++ b/packages/cosmos-core/src/v1/node/CosmosNodeClient.ts @@ -16,7 +16,10 @@ import { } from '../types/rpc' export class CosmosNodeClient { - constructor(public readonly baseURL: string, public useCORSProxy: boolean = false) {} + constructor( + public readonly baseURL: string, + public useCORSProxy: boolean = false + ) {} public async fetchBalance(address: string, denom: Units): Promise<{ total: Amount; available: Amount }> { const response = await Axios.get(this.url(`/cosmos/bank/v1beta1/balances/${address}`)) @@ -52,7 +55,7 @@ export class CosmosNodeClient { this.url( `/cosmos/tx/v1beta1/txs?events=${ isSender ? 'transfer.sender' : 'transfer.recipient' - }='${address}'&pagination.limit=${limit}&pagination.offset=${offset}&orderBy=ORDER_BY_DESC` + }='${address}'&pagination.limit=${limit}&pagination.offset=${offset}&orderBy=2` ) ) @@ -60,8 +63,8 @@ export class CosmosNodeClient { } public async fetchNodeInfo(): Promise { - const response = await Axios.get(this.url(`/node_info`)) - const nodeInfo = response.data.node_info as CosmosNodeInfo + const response = await Axios.get(this.url(`/cosmos/base/tendermint/v1beta1/node_info`)) + const nodeInfo = response.data.default_node_info as CosmosNodeInfo return nodeInfo } @@ -84,8 +87,8 @@ export class CosmosNodeClient { } public async fetchAccount(address: string): Promise { - const response = await Axios.get(this.url(`/auth/accounts/${address}`)) - const account = response.data.result as CosmosAccount + const response = await Axios.get(this.url(`/cosmos/auth/v1beta1/accounts/${address}`)) + const account = response.data.account as CosmosAccount return account } @@ -107,24 +110,25 @@ export class CosmosNodeClient { } public async fetchValidator(address: string): Promise { - const response = await Axios.get(this.url(`/staking/validators/${address}`)) - const validator = response.data.result as CosmosValidator + const response = await Axios.get(this.url(`/cosmos/staking/v1beta1/validators/${address}`)) + + const validator = response.data.validator as CosmosValidator return validator } public async fetchValidators(): Promise { - const response = await Axios.get(this.url('/staking/validators')) - const validators = response.data.result as CosmosValidator[] + const response = await Axios.get(this.url('/cosmos/staking/v1beta1/validators')) + const validators = response.data.validators as CosmosValidator[] return validators } public async fetchSelfDelegation(validatorAddress: string): Promise { - const validatorInfo = await Axios.get(this.url(`/distribution/validators/${validatorAddress}`)) - const operatorAddress = validatorInfo.data.result.operator_address - const response = await Axios.get(this.url(`/staking/delegators/${operatorAddress}/delegations/${validatorAddress}`)) - const delegation = response.data.result as CosmosDelegation + const validatorInfo = await Axios.get(this.url(`/cosmos/distribution/v1beta1/validators/${validatorAddress}`)) + const operatorAddress = validatorInfo.data.operator_address + const response = await Axios.get(this.url(`/cosmos/staking/v1beta1/validators/${validatorAddress}/delegations/${operatorAddress}`)) + const delegation = response.data.delegation_response as CosmosDelegation return delegation } @@ -169,8 +173,10 @@ export class CosmosNodeClient { } public async fetchRewardForDelegation(delegatorAddress: string, validatorAddress: string, denom: Units): Promise> { - const totalRewards = await Axios.get(this.url(`/distribution/delegators/${delegatorAddress}/rewards/${validatorAddress}`)) - .then((response) => response.data.result as { denom: string; amount: string }[]) + const totalRewards = await Axios.get( + this.url(`/cosmos/distribution/v1beta1/delegators/${delegatorAddress}/rewards/${validatorAddress}`) + ) + .then((response) => response.data.rewards as { denom: string; amount: string }[]) .catch(() => []) if (totalRewards?.length > 0) { return newAmount(CosmosCoin.sum(CosmosCoin.fromCoins(totalRewards), denom).decimalPlaces(0, BigNumber.ROUND_FLOOR), denom) diff --git a/packages/cosmos-core/src/v1/protocol/CosmosBaseProtocol.ts b/packages/cosmos-core/src/v1/protocol/CosmosBaseProtocol.ts index 8eb1990c..ed3c628f 100644 --- a/packages/cosmos-core/src/v1/protocol/CosmosBaseProtocol.ts +++ b/packages/cosmos-core/src/v1/protocol/CosmosBaseProtocol.ts @@ -384,8 +384,8 @@ export abstract class CosmosBaseProtocolImpl<_Units extends string> implements C ), memo, nodeInfo.network, - account.value.account_number, - account.value.sequence ?? '0' + account.account_number, + account.sequence ?? '0' ) return newUnsignedTransaction({ @@ -472,7 +472,7 @@ export abstract class CosmosBaseProtocolImpl<_Units extends string> implements C } else { promises.push( new Promise((resolve) => { - resolve({ txs: [], tx_responses: [], pagination: { total: String(senderTotal) } }) + resolve({ txs: [], tx_responses: [], pagination: null, total: String(senderTotal) }) }) ) } @@ -484,18 +484,14 @@ export abstract class CosmosBaseProtocolImpl<_Units extends string> implements C } else { promises.push( new Promise((resolve) => { - resolve({ txs: [], tx_responses: [], pagination: { total: String(recipientTotal) } }) + resolve({ txs: [], tx_responses: [], pagination: null, total: String(senderTotal) }) }) ) } } else { ;[senderTotal, recipientTotal] = await Promise.all([ - this.nodeClient - .fetchSendTransactionsFor(address, 1, 0, true) - .then((response) => new BigNumber(response.pagination.total).toNumber()), - this.nodeClient - .fetchSendTransactionsFor(address, 1, 0, false) - .then((response) => new BigNumber(response.pagination.total).toNumber()) + this.nodeClient.fetchSendTransactionsFor(address, 1, 0, true).then((response) => new BigNumber(response.total).toNumber()), + this.nodeClient.fetchSendTransactionsFor(address, 1, 0, false).then((response) => new BigNumber(response.total).toNumber()) ]) senderLimit = calculateTransactionLimit(limit, senderTotal, recipientTotal, senderOffset, recipientOffset) @@ -522,51 +518,51 @@ export abstract class CosmosBaseProtocolImpl<_Units extends string> implements C ) result = result.concat( - transaction.tx.body.messages.map((msg: any) => { - const tx: Partial> = { - isInbound: false, - amount: newAmount('0', 'blockchain'), - fee: newAmount(fee, 'blockchain'), - network: this.options.network, - status: { - type: 'unknown', - hash: transaction.txhash - }, - timestamp - } - switch (msg['@type']) { - case CosmosMessageTypeValue.UNDELEGATE: - return { - ...tx, - from: [msg.validator_address], - to: [msg.delegator_address] - } - case CosmosMessageTypeValue.WITHDRAW_DELEGATION_REWARD: - return { - ...tx, - from: [msg.delegator_address], - to: [msg.validator_address] - } - case CosmosMessageTypeValue.DELEGATE: - return { - ...tx, - from: [msg.delegator_address], - to: [msg.validator_address] - } - - default: - return { - ...tx, - from: [msg.from_address], - to: [msg.to_address], - isInbound: msg.to_address === address, - amount: newAmount(msg.amount[0].amount, 'blockchain') - } - } - }) + transaction.tx.body.messages + .filter((msg: any) => msg['@type'] !== CosmosMessageTypeValue.MSGMULTISEND) + .map((msg: any) => { + const tx: Partial> = { + isInbound: false, + amount: newAmount('0', 'blockchain'), + fee: newAmount(fee, 'blockchain'), + network: this.options.network, + status: { + type: 'unknown', + hash: transaction.txhash + }, + timestamp + } + switch (msg['@type']) { + case CosmosMessageTypeValue.UNDELEGATE: + return { + ...tx, + from: [msg.validator_address], + to: [msg.delegator_address] + } + case CosmosMessageTypeValue.WITHDRAW_DELEGATION_REWARD: + return { + ...tx, + from: [msg.delegator_address], + to: [msg.validator_address] + } + case CosmosMessageTypeValue.DELEGATE: + return { + ...tx, + from: [msg.delegator_address], + to: [msg.validator_address] + } + default: + return { + ...tx, + from: [msg.from_address], + to: [msg.to_address], + isInbound: msg.to_address === address, + amount: newAmount(msg.amount[0].amount, 'blockchain') + } + } + }) ) } - return { transactions: result, cursor: { @@ -815,8 +811,8 @@ export abstract class CosmosBaseProtocolImpl<_Units extends string> implements C ), memo !== undefined ? memo : '', nodeInfo.network, - account.value.account_number, - account.value.sequence ?? '0' + account.account_number, + account.sequence ?? '0' ) } @@ -858,8 +854,8 @@ export abstract class CosmosBaseProtocolImpl<_Units extends string> implements C ), memo !== undefined ? memo : '', nodeInfo.network, - account.value.account_number, - account.value.sequence ?? '0' + account.account_number, + account.sequence ?? '0' ) } @@ -871,8 +867,8 @@ export abstract class CosmosBaseProtocolImpl<_Units extends string> implements C return this.nodeClient.withdrawAllDelegationRewards( delegatorAddress, nodeInfo.network, - account.value.account_number, - account.value.sequence ?? '0', + account.account_number, + account.sequence ?? '0', new BigNumber(newAmount(metadata.fee!.defaults!.high).blockchain(metadata.units).value), new BigNumber(newAmount(fee).blockchain(metadata.units).value), memo !== undefined ? memo : '' diff --git a/packages/cosmos-core/src/v1/types/data/transaction/message/CosmosMessage.ts b/packages/cosmos-core/src/v1/types/data/transaction/message/CosmosMessage.ts index 1bdb92c6..8a38a606 100644 --- a/packages/cosmos-core/src/v1/types/data/transaction/message/CosmosMessage.ts +++ b/packages/cosmos-core/src/v1/types/data/transaction/message/CosmosMessage.ts @@ -26,7 +26,8 @@ export enum CosmosMessageTypeValue { SEND = '/cosmos.bank.v1beta1.MsgSend', DELEGATE = '/cosmos.staking.v1beta1.MsgDelegate', UNDELEGATE = '/cosmos.staking.v1beta1.MsgUndelegate', - WITHDRAW_DELEGATION_REWARD = '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward' + WITHDRAW_DELEGATION_REWARD = '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward', + MSGMULTISEND = '/cosmos.bank.v1beta1.MsgMultiSend' } export class CosmosMessageType { diff --git a/packages/cosmos-core/src/v1/types/rpc.ts b/packages/cosmos-core/src/v1/types/rpc.ts index 315d230c..4cf67130 100644 --- a/packages/cosmos-core/src/v1/types/rpc.ts +++ b/packages/cosmos-core/src/v1/types/rpc.ts @@ -6,7 +6,7 @@ export interface CosmosNodeInfo { block: string app: string } - id: string + default_node_id: string listen_addr: string network: string version: string @@ -19,8 +19,14 @@ export interface CosmosNodeInfo { } export interface CosmosAccount { - type: string - value: CosmosAccountValue + '@type': string + address: string + pub_key: { + '@type': string + key: string + } + account_number: string + sequence: string } export interface CosmosAccountValue { @@ -320,11 +326,11 @@ export interface TxResponse { export interface Pagination { next_key?: any - total: string } export interface CosmosPagedSendTxsResponse { txs: Tx[] tx_responses: TxResponse[] - pagination: Pagination + pagination: Pagination | null + total: string } diff --git a/packages/cosmos/test/v1/paging.spec.ts b/packages/cosmos/test/v1/paging.spec.ts index b446de54..443f8893 100644 --- a/packages/cosmos/test/v1/paging.spec.ts +++ b/packages/cosmos/test/v1/paging.spec.ts @@ -45,18 +45,18 @@ Promise.all( expect(firstTransactions.transactions.length).to.be.eq(limitFromResponseSet(mockTransactions.first)) expect(firstTransactions.cursor.hasNext, 'expected first transaction cursor to have `hasNext: true`').to.be.true - expect(firstTransactions.cursor.sender.total).to.eq(parseInt(mockTransactions.first.sender.pagination.total, 10)) + expect(firstTransactions.cursor.sender.total).to.eq(parseInt(mockTransactions.first.sender.total, 10)) expect(firstTransactions.cursor.sender.offset).to.eq(mockTransactions.first.sender.txs.length) - expect(firstTransactions.cursor.recipient.total).to.eq(parseInt(mockTransactions.first.recipient.pagination.total, 10)) + expect(firstTransactions.cursor.recipient.total).to.eq(parseInt(mockTransactions.first.recipient.total, 10)) expect(firstTransactions.cursor.recipient.offset).to.eq(mockTransactions.first.recipient.txs.length) expect(nextTransactions.transactions.length).to.be.eq(limitFromResponseSet(mockTransactions.next)) expect(nextTransactions.cursor.hasNext, 'expected next transaction cursor to have `hasNext: false`').to.be.false - expect(nextTransactions.cursor.sender.total).to.eq(parseInt(mockTransactions.next.sender.pagination.total, 10)) + expect(nextTransactions.cursor.sender.total).to.eq(parseInt(mockTransactions.next.sender.total, 10)) expect(nextTransactions.cursor.sender.offset).to.eq( mockTransactions.first.sender.txs.length + mockTransactions.next.sender.txs.length ) - expect(nextTransactions.cursor.recipient.total).to.eq(parseInt(mockTransactions.next.recipient.pagination.total, 10)) + expect(nextTransactions.cursor.recipient.total).to.eq(parseInt(mockTransactions.next.recipient.total, 10)) expect(nextTransactions.cursor.recipient.offset).to.eq( mockTransactions.first.recipient.txs.length + mockTransactions.next.recipient.txs.length ) diff --git a/packages/cosmos/test/v1/protocol.spec.ts b/packages/cosmos/test/v1/protocol.spec.ts index 274e1bef..30c3bf86 100644 --- a/packages/cosmos/test/v1/protocol.spec.ts +++ b/packages/cosmos/test/v1/protocol.spec.ts @@ -80,7 +80,6 @@ Promise.all( expect(preparedTx).to.have.property(property) }) } - expect(preparedTx).to.deep.include(tx.unsignedTx) }) }) diff --git a/packages/cosmos/test/v1/specs/cosmos.ts b/packages/cosmos/test/v1/specs/cosmos.ts index 77966078..23832aa4 100644 --- a/packages/cosmos/test/v1/specs/cosmos.ts +++ b/packages/cosmos/test/v1/specs/cosmos.ts @@ -332,9 +332,9 @@ export class CosmosTestProtocolSpec extends TestProtocolSpec { } ], pagination: { - next_key: null, - total: '4' - } + next_key: null + }, + total: '4' } const firstRecipient: CosmosPagedSendTxsResponse = { @@ -529,9 +529,9 @@ export class CosmosTestProtocolSpec extends TestProtocolSpec { } ], pagination: { - next_key: null, - total: '4' - } + next_key: null + }, + total: '4' } const nextSender: CosmosPagedSendTxsResponse = { @@ -738,9 +738,9 @@ export class CosmosTestProtocolSpec extends TestProtocolSpec { } ], pagination: { - next_key: null, - total: '4' - } + next_key: null + }, + total: '4' } const nextRecipient: CosmosPagedSendTxsResponse = { @@ -935,9 +935,9 @@ export class CosmosTestProtocolSpec extends TestProtocolSpec { } ], pagination: { - next_key: null, - total: '4' - } + next_key: null + }, + total: '4' } return { diff --git a/packages/icp/test/stubs/icp.stub.ts b/packages/icp/test/stubs/icp.stub.ts index 36b15ef2..00f91b12 100644 --- a/packages/icp/test/stubs/icp.stub.ts +++ b/packages/icp/test/stubs/icp.stub.ts @@ -1,17 +1,24 @@ import axios from '@airgap/coinlib-core/dependencies/src/axios-0.19.0/index' import * as sinon from 'sinon' -import { ICPProtocol } from '../../src/v1' +import { ICPProtocol, ICPUnits } from '../../src/v1' import { ProtocolHTTPStub, TestProtocolSpec } from '../implementations' +import { Balance, newAmount } from '@airgap/module-kit' export class ICPProtocolStub implements ProtocolHTTPStub { public async registerStub(testProtocolSpec: TestProtocolSpec) { sinon.restore() sinon - .stub(axios, 'get') - .withArgs(`${(await testProtocolSpec.onlineLib.getNetwork()).rpcUrl}/v2/accounts/${testProtocolSpec.wallet.addresses[0]}`) - .returns(Promise.resolve({ data: { balance: 10000000000000000000, nonce: -1 } })) + .stub(testProtocolSpec.onlineLib, 'getBalanceOfPublicKey') + .withArgs(testProtocolSpec.wallet.publicKey) + .returns( + Promise.resolve({ + total: newAmount(10000000000000000000, 'blockchain'), + transferable: newAmount(10000000000000000000, 'blockchain') + } as Balance) + ) + sinon .stub(axios, 'post') .withArgs(`/v2/transactions`) From 80e836156f44bfdafb86390db6e737bbe75cc490 Mon Sep 17 00:00:00 2001 From: Stephen Debel Date: Wed, 17 Apr 2024 14:24:28 +0200 Subject: [PATCH 2/5] fix/substrate-v2 * fix/substrate-v2 --- .../astar/src/v1/protocol/AstarProtocol.ts | 2 +- .../astar/src/v1/protocol/ShidenProtocol.ts | 2 +- .../src/v1/protocol/MoonbeamProtocol.ts | 2 +- .../src/v1/protocol/MoonriverProtocol.ts | 2 +- .../src/v1/protocol/KusamaProtocol.ts | 2 +- .../src/v1/protocol/PolkadotProtocol.ts | 2 +- .../subscan/SubscanBlockExplorerClient.ts | 56 +++++++++---------- .../src/v1/protocol/SubstrateProtocol.ts | 3 +- 8 files changed, 34 insertions(+), 37 deletions(-) diff --git a/packages/astar/src/v1/protocol/AstarProtocol.ts b/packages/astar/src/v1/protocol/AstarProtocol.ts index c0791a65..c44b7bf6 100644 --- a/packages/astar/src/v1/protocol/AstarProtocol.ts +++ b/packages/astar/src/v1/protocol/AstarProtocol.ts @@ -90,7 +90,7 @@ export const ASTAR_MAINNET_PROTOCOL_NETWORK: AstarProtocolNetwork = { type: 'mainnet', rpcUrl: 'https://astar-node.prod.gke.papers.tech', blockExplorerUrl: 'https://astar.subscan.io', - blockExplorerApi: 'https://astar.subscan.prod.gke.papers.tech/api/scan' + blockExplorerApi: 'https://astar.subscan.prod.gke.papers.tech/api/v2/scan' } const DEFAULT_ASTAR_PROTOCOL_NETWORK: AstarProtocolNetwork = ASTAR_MAINNET_PROTOCOL_NETWORK diff --git a/packages/astar/src/v1/protocol/ShidenProtocol.ts b/packages/astar/src/v1/protocol/ShidenProtocol.ts index 25abdf50..c8646d26 100644 --- a/packages/astar/src/v1/protocol/ShidenProtocol.ts +++ b/packages/astar/src/v1/protocol/ShidenProtocol.ts @@ -83,7 +83,7 @@ export const SHIDEN_MAINNET_PROTOCOL_NETWORK: AstarProtocolNetwork = { type: 'mainnet', rpcUrl: 'https://shiden-node.prod.gke.papers.tech', blockExplorerUrl: 'https://shiden.subscan.io', - blockExplorerApi: 'https://shiden.subscan.prod.gke.papers.tech/api/scan' + blockExplorerApi: 'https://shiden.subscan.prod.gke.papers.tech/api/v2/scan' } const DEFAULT_SHIDEN_PROTOCOL_NETWORK: AstarProtocolNetwork = SHIDEN_MAINNET_PROTOCOL_NETWORK diff --git a/packages/moonbeam/src/v1/protocol/MoonbeamProtocol.ts b/packages/moonbeam/src/v1/protocol/MoonbeamProtocol.ts index c04cba49..9737b39f 100644 --- a/packages/moonbeam/src/v1/protocol/MoonbeamProtocol.ts +++ b/packages/moonbeam/src/v1/protocol/MoonbeamProtocol.ts @@ -98,7 +98,7 @@ export const MOONBEAM_MAINNET_PROTOCOL_NETWORK: MoonbeamProtocolNetwork = { type: 'mainnet', rpcUrl: 'https://moonbeam-proxy.airgap.prod.gke.papers.tech', blockExplorerUrl: 'https://moonbeam.subscan.io', - blockExplorerApi: 'https://moonbeam.subscan.prod.gke.papers.tech/api/scan' + blockExplorerApi: 'https://moonbeam.subscan.prod.gke.papers.tech/api/v2/scan' } const DEFAULT_MOONBEAM_PROTOCOL_NETWORK: MoonbeamProtocolNetwork = MOONBEAM_MAINNET_PROTOCOL_NETWORK diff --git a/packages/moonbeam/src/v1/protocol/MoonriverProtocol.ts b/packages/moonbeam/src/v1/protocol/MoonriverProtocol.ts index 1a1b4a03..59890bc4 100644 --- a/packages/moonbeam/src/v1/protocol/MoonriverProtocol.ts +++ b/packages/moonbeam/src/v1/protocol/MoonriverProtocol.ts @@ -83,7 +83,7 @@ export const MOONRIVER_MAINNET_PROTOCOL_NETWORK: MoonbeamProtocolNetwork = { type: 'mainnet', rpcUrl: 'https://moonriver-proxy.airgap.prod.gke.papers.tech', blockExplorerUrl: 'https://moonriver.subscan.io', - blockExplorerApi: 'https://moonriver.subscan.prod.gke.papers.tech/api/scan' + blockExplorerApi: 'https://moonriver.subscan.prod.gke.papers.tech/api/v2/scan' } const DEFAULT_MOONRIVER_PROTOCOL_NETWORK: MoonbeamProtocolNetwork = MOONRIVER_MAINNET_PROTOCOL_NETWORK diff --git a/packages/polkadot/src/v1/protocol/KusamaProtocol.ts b/packages/polkadot/src/v1/protocol/KusamaProtocol.ts index b9f4c78b..689e7f0d 100644 --- a/packages/polkadot/src/v1/protocol/KusamaProtocol.ts +++ b/packages/polkadot/src/v1/protocol/KusamaProtocol.ts @@ -81,7 +81,7 @@ export const KUSAMA_MAINNET_PROTOCOL_NETWORK: PolkadotProtocolNetwork = { type: 'mainnet', rpcUrl: 'https://polkadot-kusama-node.prod.gke.papers.tech', blockExplorerUrl: 'https://kusama.subscan.io', - blockExplorerApi: 'https://kusama.subscan.prod.gke.papers.tech/api/scan' + blockExplorerApi: 'https://kusama.subscan.prod.gke.papers.tech/api/v2/scan' } const DEFAULT_KUSAMA_PROTOCOL_NETWORK: PolkadotProtocolNetwork = KUSAMA_MAINNET_PROTOCOL_NETWORK diff --git a/packages/polkadot/src/v1/protocol/PolkadotProtocol.ts b/packages/polkadot/src/v1/protocol/PolkadotProtocol.ts index 1cb5c52d..70dab4d4 100644 --- a/packages/polkadot/src/v1/protocol/PolkadotProtocol.ts +++ b/packages/polkadot/src/v1/protocol/PolkadotProtocol.ts @@ -89,7 +89,7 @@ export const POLKADOT_MAINNET_PROTOCOL_NETWORK: PolkadotProtocolNetwork = { type: 'mainnet', rpcUrl: 'https://polkadot-node.prod.gke.papers.tech', blockExplorerUrl: 'https://polkadot.subscan.io', - blockExplorerApi: 'https://polkadot.subscan.prod.gke.papers.tech/api/scan', + blockExplorerApi: 'https://polkadot.subscan.prod.gke.papers.tech/api/v2/scan', defaultValidator: '12C9U6zSSoZ6pgwR2ksFyBLgQH6v7dkqqPCRyHceoP8MJRo2' } diff --git a/packages/substrate/src/v1/block-explorer/subscan/SubscanBlockExplorerClient.ts b/packages/substrate/src/v1/block-explorer/subscan/SubscanBlockExplorerClient.ts index cc98fa41..6a8cddd0 100644 --- a/packages/substrate/src/v1/block-explorer/subscan/SubscanBlockExplorerClient.ts +++ b/packages/substrate/src/v1/block-explorer/subscan/SubscanBlockExplorerClient.ts @@ -25,49 +25,45 @@ export class SubscanBlockExplorerClient implements SubstrateBlockExplorerClient const airGapTransfers: Partial>[] = transfers ? transfers .filter((tx: any) => tx.module === 'balances') - .map( - (tx: any): Partial> => { - return { - from: [tx.from], - to: [tx.to], - isInbound: address.includes(tx.to), + .map((tx: any): Partial> => { + return { + from: [tx.from], + to: [tx.to], + isInbound: address.includes(tx.to), - amount: newAmount(tx.amount, protocolUnit), - fee: newAmount(tx.fee, 'blockchain'), + amount: newAmount(tx.amount, protocolUnit), + fee: newAmount(tx.fee, 'blockchain'), - timestamp: tx.block_timestamp, - status: { - type: tx.success !== undefined ? (tx.success ? 'applied' : 'failed') : 'unknown', - hash: tx.hash, - block: tx.block_num - } + timestamp: tx.block_timestamp, + status: { + type: tx.success !== undefined ? (tx.success ? 'applied' : 'failed') : 'unknown', + hash: tx.hash, + block: tx.block_num } } - ) + }) : [] const airGapPayouts: Partial>[] = rewardSlash ? rewardSlash .filter((tx: any) => tx.event_id === 'Reward') - .map( - (tx: any): Partial> => { - return { - from: ['Staking Reward'], - to: [address], - isInbound: true, + .map((tx: any): Partial> => { + return { + from: ['Staking Reward'], + to: [address], + isInbound: true, - amount: newAmount(tx.amount, 'blockchain'), - fee: newAmount('0', 'blockchain'), + amount: newAmount(tx.amount, 'blockchain'), + fee: newAmount('0', 'blockchain'), - timestamp: tx.block_timestamp, - status: { - type: 'applied', - hash: tx.extrinsic_hash, - block: tx.block_num - } + timestamp: tx.block_timestamp, + status: { + type: 'applied', + hash: tx.extrinsic_hash, + block: tx.block_num } } - ) + }) : [] return airGapTransfers diff --git a/packages/substrate/src/v1/protocol/SubstrateProtocol.ts b/packages/substrate/src/v1/protocol/SubstrateProtocol.ts index c9ce87b8..16b65096 100644 --- a/packages/substrate/src/v1/protocol/SubstrateProtocol.ts +++ b/packages/substrate/src/v1/protocol/SubstrateProtocol.ts @@ -81,7 +81,8 @@ export abstract class SubstrateProtocolImpl< _ProtocolNetwork extends SubstrateProtocolNetwork = SubstrateProtocolNetwork, _NodeClient extends SubstrateNodeClient<_ProtocolConfiguration> = SubstrateNodeClient<_ProtocolConfiguration>, _AccountController extends SubstrateAccountController<_ProtocolConfiguration> = SubstrateAccountController<_ProtocolConfiguration>, - _TransactionController extends SubstrateTransactionController<_ProtocolConfiguration> = SubstrateTransactionController<_ProtocolConfiguration> + _TransactionController extends + SubstrateTransactionController<_ProtocolConfiguration> = SubstrateTransactionController<_ProtocolConfiguration> > implements SubstrateProtocol<_ProtocolConfiguration, _Units, _ProtocolNetwork, SubstrateCryptoConfiguration<_ProtocolConfiguration>> { public readonly _isSubstrateProtocol: true = true From d8e89635c3a5a79d3a23355ae76c45a4b50d6468 Mon Sep 17 00:00:00 2001 From: Stephen Debel Date: Mon, 22 Apr 2024 15:49:22 +0200 Subject: [PATCH 3/5] Feat/cacu i * feat/cacu-i * feat/cacu-i * feat/cacu-i * feat/cacu-i * feat/cacu-i * feat/cacu-i * feat/cacu-i * feat/cacu-i * feat/cacu-i * feat/cacu-i * feat/cacu-i * feat/cacu-i * feat/cacu-i * feat/cacu-i --- lerna.json | 2 +- package-lock.json | 368 ++++++++++-------- packages/acurast/package.json | 64 +++ packages/acurast/readme.md | 121 ++++++ .../acurast/scripts/copy-files-after-build.js | 183 +++++++++ .../acurast/scripts/copy-files-after-build.ts | 41 ++ packages/acurast/src/index.ts | 1 + .../v1/controller/AcurastAccountController.ts | 6 + .../AcurastTransactionController.ts | 6 + packages/acurast/src/v1/index.ts | 17 + packages/acurast/src/v1/module.ts | 8 + .../acurast/src/v1/module/AcurastModule.ts | 72 ++++ .../acurast/src/v1/node/AcurastNodeClient.ts | 5 + .../src/v1/protocol/AcurastBaseProtocol.ts | 68 ++++ .../src/v1/protocol/AcurastProtocol.ts | 78 ++++ .../converter/transaction-converter.ts | 34 ++ .../transaction-sign-request-acurast.ts | 3 + .../transaction-sign-response-acurast.ts | 3 + .../transaction-sign-request-acurast.json | 29 ++ .../transaction-sign-response-acurast.json | 19 + .../v1/serializer/v3/serializer-companion.ts | 117 ++++++ .../v3/validators/transaction-validator.ts | 5 + .../v1/serializer/v3/validators/validators.ts | 3 + .../acurast/src/v1/types/configuration.ts | 6 + packages/acurast/src/v1/types/crypto.ts | 3 + packages/acurast/src/v1/types/protocol.ts | 16 + packages/acurast/test/tsconfig.json | 7 + packages/acurast/test/v1/_setup.spec.ts | 14 + packages/acurast/test/v1/block-explorer.ts | 64 +++ packages/acurast/test/v1/implementations.ts | 185 +++++++++ packages/acurast/test/v1/paging.spec.ts | 50 +++ packages/acurast/test/v1/protocol.spec.ts | 364 +++++++++++++++++ packages/acurast/test/v1/specs/acurast.ts | 173 ++++++++ .../acurast/test/v1/stubs/acurast.stub.ts | 113 ++++++ packages/acurast/tsconfig.json | 10 + packages/acurast/tslint.json | 3 + packages/aeternity/package.json | 8 +- packages/astar/package.json | 10 +- packages/bitcoin/package.json | 10 +- packages/core/package.json | 2 +- packages/core/src/utils/ProtocolSymbols.ts | 1 + packages/coreum/package.json | 12 +- packages/cosmos-core/package.json | 10 +- packages/cosmos/package.json | 12 +- packages/crypto/package.json | 6 +- packages/ethereum/package.json | 10 +- packages/groestlcoin/package.json | 10 +- packages/icp/package.json | 10 +- packages/icp/test/stubs/icp.stub.ts | 1 - packages/mina/package.json | 10 +- packages/module-kit/package.json | 6 +- packages/moonbeam/package.json | 10 +- packages/optimism/package.json | 12 +- packages/polkadot/package.json | 8 +- packages/serializer/package.json | 4 +- packages/substrate/package.json | 10 +- packages/tezos/package.json | 10 +- packages/wallet/package.json | 6 +- scripts/generate-schemas.sh | 4 + 59 files changed, 2182 insertions(+), 261 deletions(-) create mode 100644 packages/acurast/package.json create mode 100644 packages/acurast/readme.md create mode 100644 packages/acurast/scripts/copy-files-after-build.js create mode 100644 packages/acurast/scripts/copy-files-after-build.ts create mode 100644 packages/acurast/src/index.ts create mode 100644 packages/acurast/src/v1/controller/AcurastAccountController.ts create mode 100644 packages/acurast/src/v1/controller/AcurastTransactionController.ts create mode 100644 packages/acurast/src/v1/index.ts create mode 100644 packages/acurast/src/v1/module.ts create mode 100644 packages/acurast/src/v1/module/AcurastModule.ts create mode 100644 packages/acurast/src/v1/node/AcurastNodeClient.ts create mode 100644 packages/acurast/src/v1/protocol/AcurastBaseProtocol.ts create mode 100644 packages/acurast/src/v1/protocol/AcurastProtocol.ts create mode 100644 packages/acurast/src/v1/serializer/v3/schemas/converter/transaction-converter.ts create mode 100644 packages/acurast/src/v1/serializer/v3/schemas/definitions/transaction-sign-request-acurast.ts create mode 100644 packages/acurast/src/v1/serializer/v3/schemas/definitions/transaction-sign-response-acurast.ts create mode 100644 packages/acurast/src/v1/serializer/v3/schemas/generated/transaction-sign-request-acurast.json create mode 100644 packages/acurast/src/v1/serializer/v3/schemas/generated/transaction-sign-response-acurast.json create mode 100644 packages/acurast/src/v1/serializer/v3/serializer-companion.ts create mode 100644 packages/acurast/src/v1/serializer/v3/validators/transaction-validator.ts create mode 100644 packages/acurast/src/v1/serializer/v3/validators/validators.ts create mode 100644 packages/acurast/src/v1/types/configuration.ts create mode 100644 packages/acurast/src/v1/types/crypto.ts create mode 100644 packages/acurast/src/v1/types/protocol.ts create mode 100644 packages/acurast/test/tsconfig.json create mode 100644 packages/acurast/test/v1/_setup.spec.ts create mode 100644 packages/acurast/test/v1/block-explorer.ts create mode 100644 packages/acurast/test/v1/implementations.ts create mode 100644 packages/acurast/test/v1/paging.spec.ts create mode 100644 packages/acurast/test/v1/protocol.spec.ts create mode 100644 packages/acurast/test/v1/specs/acurast.ts create mode 100644 packages/acurast/test/v1/stubs/acurast.stub.ts create mode 100644 packages/acurast/tsconfig.json create mode 100644 packages/acurast/tslint.json diff --git a/lerna.json b/lerna.json index edfc3e70..b369ff32 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.13.25", + "version": "0.13.26-beta.0", "useWorkspaces": true, "command": { "publish": { diff --git a/package-lock.json b/package-lock.json index e15b59cb..237ac2cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,10 @@ "typescript": "4.8.4" } }, + "node_modules/@airgap/acurast": { + "resolved": "packages/acurast", + "link": true + }, "node_modules/@airgap/aeternity": { "resolved": "packages/aeternity", "link": true @@ -3176,7 +3180,7 @@ }, "node_modules/buffer": { "version": "5.2.1", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "base64-js": "^1.0.2", @@ -4612,7 +4616,6 @@ }, "node_modules/encoding": { "version": "0.1.13", - "dev": true, "license": "MIT", "optional": true, "dependencies": { @@ -4621,7 +4624,6 @@ }, "node_modules/encoding/node_modules/iconv-lite": { "version": "0.6.3", - "dev": true, "license": "MIT", "optional": true, "dependencies": { @@ -9282,7 +9284,7 @@ }, "node_modules/safer-buffer": { "version": "2.1.2", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/scrypt-js": { @@ -10154,7 +10156,6 @@ }, "node_modules/typescript": { "version": "4.8.4", - "dev": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", @@ -10652,39 +10653,52 @@ "node": ">=6" } }, + "packages/acurast": { + "name": "@airgap/acurast", + "version": "0.13.26-beta.0", + "license": "MIT", + "dependencies": { + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/substrate": "^0.13.26-beta.0", + "@polkadot/util": "2.0.1", + "@polkadot/wasm-crypto": "0.20.1" + } + }, "packages/aeternity": { "name": "@airgap/aeternity", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@stablelib/ed25519": "^1.0.3" } }, "packages/astar": { "name": "@airgap/astar", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", - "@airgap/substrate": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/substrate": "^0.13.26-beta.0", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" } }, "packages/bitcoin": { "name": "@airgap/bitcoin", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "bitcoinjs-lib": "5.2.0" } }, @@ -10819,7 +10833,7 @@ }, "packages/core": { "name": "@airgap/coinlib-core", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { "@stablelib/blake2b": "^1.0.1", @@ -10983,46 +10997,46 @@ }, "packages/coreum": { "name": "@airgap/coreum", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/cosmos-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/cosmos-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" } }, "packages/cosmos": { "name": "@airgap/cosmos", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/cosmos-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/cosmos-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" } }, "packages/cosmos-core": { "name": "@airgap/cosmos-core", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" } }, "packages/crypto": { "name": "@airgap/crypto", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", "@airgap/sapling-wasm": "^0.0.9", "@polkadot/wasm-crypto": "0.20.1", "@stablelib/hmac": "^1.0.1" @@ -11030,13 +11044,13 @@ }, "packages/ethereum": { "name": "@airgap/ethereum", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@ethereumjs/common": "2.6.5", "@ethereumjs/tx": "3.4.0", "@metamask/eth-sig-util": "4.0.0" @@ -11044,24 +11058,24 @@ }, "packages/groestlcoin": { "name": "@airgap/groestlcoin", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/bitcoin": "^0.13.25", - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/bitcoin": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" } }, "packages/icp": { "name": "@airgap/icp", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@dfinity/agent": "^0.15.4", "@dfinity/identity-secp256k1": "^0.15.4", "@dfinity/nns": "^0.14.0", @@ -11107,13 +11121,13 @@ }, "packages/mina": { "name": "@airgap/mina", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "graphql": "^16.7.1", "graphql-request": "^6.1.0", "mina-signer": "^2.0.3" @@ -11121,45 +11135,45 @@ }, "packages/module-kit": { "name": "@airgap/module-kit", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" } }, "packages/moonbeam": { "name": "@airgap/moonbeam", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", - "@airgap/substrate": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/substrate": "^0.13.26-beta.0" } }, "packages/optimism": { "name": "@airgap/optimism", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/ethereum": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/ethereum": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@ethereumjs/tx": "3.4.0" } }, "packages/polkadot": { "name": "@airgap/polkadot", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/substrate": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/substrate": "^0.13.26-beta.0" }, "devDependencies": { "@polkadot/wasm-crypto": "0.20.1" @@ -11167,35 +11181,35 @@ }, "packages/serializer": { "name": "@airgap/serializer", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0" } }, "packages/substrate": { "name": "@airgap/substrate", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" } }, "packages/tezos": { "name": "@airgap/tezos", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", "@airgap/sapling-wasm": "0.0.7", - "@airgap/serializer": "^0.13.25", + "@airgap/serializer": "^0.13.26-beta.0", "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", @@ -11396,31 +11410,42 @@ }, "packages/wallet": { "name": "@airgap/wallet", - "version": "0.13.25", + "version": "0.13.26-beta.0", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0" } } }, "dependencies": { + "@airgap/acurast": { + "version": "file:packages/acurast", + "requires": { + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/substrate": "^0.13.26-beta.0", + "@polkadot/util": "2.0.1", + "@polkadot/wasm-crypto": "0.20.1" + } + }, "@airgap/aeternity": { "version": "file:packages/aeternity", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@stablelib/ed25519": "^1.0.3" } }, "@airgap/astar": { "version": "file:packages/astar", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", - "@airgap/substrate": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/substrate": "^0.13.26-beta.0", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" } @@ -11428,10 +11453,10 @@ "@airgap/bitcoin": { "version": "file:packages/bitcoin", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "bitcoinjs-lib": "5.2.0" }, "dependencies": { @@ -11677,37 +11702,37 @@ "@airgap/coreum": { "version": "file:packages/coreum", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/cosmos-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/cosmos-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" } }, "@airgap/cosmos": { "version": "file:packages/cosmos", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/cosmos-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/cosmos-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" } }, "@airgap/cosmos-core": { "version": "file:packages/cosmos-core", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" } }, "@airgap/crypto": { "version": "file:packages/crypto", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", "@airgap/sapling-wasm": "^0.0.9", "@polkadot/wasm-crypto": "0.20.1", "@stablelib/hmac": "^1.0.1" @@ -11716,10 +11741,10 @@ "@airgap/ethereum": { "version": "file:packages/ethereum", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@ethereumjs/common": "2.6.5", "@ethereumjs/tx": "3.4.0", "@metamask/eth-sig-util": "4.0.0" @@ -11728,19 +11753,19 @@ "@airgap/groestlcoin": { "version": "file:packages/groestlcoin", "requires": { - "@airgap/bitcoin": "^0.13.25", - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/bitcoin": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" } }, "@airgap/icp": { "version": "file:packages/icp", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@dfinity/agent": "^0.15.4", "@dfinity/identity-secp256k1": "^0.15.4", "@dfinity/nns": "^0.14.0", @@ -11781,10 +11806,10 @@ "@airgap/mina": { "version": "file:packages/mina", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "graphql": "^16.7.1", "graphql-request": "^6.1.0", "mina-signer": "^2.0.3" @@ -11793,36 +11818,36 @@ "@airgap/module-kit": { "version": "file:packages/module-kit", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" } }, "@airgap/moonbeam": { "version": "file:packages/moonbeam", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", - "@airgap/substrate": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/substrate": "^0.13.26-beta.0" } }, "@airgap/optimism": { "version": "file:packages/optimism", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/ethereum": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/ethereum": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@ethereumjs/tx": "3.4.0" } }, "@airgap/polkadot": { "version": "file:packages/polkadot", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/substrate": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/substrate": "^0.13.26-beta.0", "@polkadot/wasm-crypto": "0.20.1" } }, @@ -11832,16 +11857,16 @@ "@airgap/serializer": { "version": "file:packages/serializer", "requires": { - "@airgap/coinlib-core": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0" } }, "@airgap/substrate": { "version": "file:packages/substrate", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" } @@ -11849,11 +11874,11 @@ "@airgap/tezos": { "version": "file:packages/tezos", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", "@airgap/sapling-wasm": "0.0.7", - "@airgap/serializer": "^0.13.25", + "@airgap/serializer": "^0.13.26-beta.0", "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", @@ -11993,8 +12018,8 @@ "@airgap/wallet": { "version": "file:packages/wallet", "requires": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0" } }, "@babel/code-frame": { @@ -12165,7 +12190,8 @@ }, "dependencies": { "crc": { - "version": "4.3.2" + "version": "4.3.2", + "requires": {} } } }, @@ -12188,7 +12214,8 @@ "dev": true }, "@graphql-typed-document-node/core": { - "version": "3.2.0" + "version": "3.2.0", + "requires": {} }, "@hutson/parse-repository-url": { "version": "3.0.2", @@ -13434,7 +13461,8 @@ }, "@octokit/plugin-request-log": { "version": "1.0.4", - "dev": true + "dev": true, + "requires": {} }, "@octokit/plugin-rest-endpoint-methods": { "version": "7.1.2", @@ -13516,7 +13544,8 @@ } }, "@polkadot/wasm-crypto": { - "version": "0.20.1" + "version": "0.20.1", + "requires": {} }, "@sindresorhus/is": { "version": "0.7.0", @@ -14147,7 +14176,7 @@ }, "buffer": { "version": "5.2.1", - "dev": true, + "devOptional": true, "requires": { "base64-js": "^1.0.2", "ieee754": "^1.1.4" @@ -15157,7 +15186,6 @@ }, "encoding": { "version": "0.1.13", - "dev": true, "optional": true, "requires": { "iconv-lite": "^0.6.2" @@ -15165,7 +15193,6 @@ "dependencies": { "iconv-lite": { "version": "0.6.3", - "dev": true, "optional": true, "requires": { "safer-buffer": ">= 2.1.2 < 3.0.0" @@ -18212,7 +18239,7 @@ }, "safer-buffer": { "version": "2.1.2", - "dev": true + "devOptional": true }, "scrypt-js": { "version": "3.0.1" @@ -18800,8 +18827,7 @@ } }, "typescript": { - "version": "4.8.4", - "dev": true + "version": "4.8.4" }, "uglify-js": { "version": "3.17.4", diff --git a/packages/acurast/package.json b/packages/acurast/package.json new file mode 100644 index 00000000..f9024169 --- /dev/null +++ b/packages/acurast/package.json @@ -0,0 +1,64 @@ +{ + "name": "@airgap/acurast", + "version": "0.13.26-beta.0", + "description": "The @airgap/acurast is an Acurast implementation of the ICoinProtocol interface from @airgap/coinlib-core.", + "keywords": [ + "airgap", + "blockchain", + "crypto", + "substrate", + "acurast" + ], + "license": "MIT", + "homepage": "https://www.airgap.it", + "repository": { + "type": "git", + "url": "https://github.com/airgap-it/airgap-coin-lib" + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "rm -rf ./dist && tsc && node scripts/copy-files-after-build.js", + "build-scripts": "tsc scripts/*.ts", + "lint": "tslint -c ./tslint.json --project ./tsconfig.json --format stylish --fix", + "lint:prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", + "lint-ci": "tslint -t json -o ../../lint-reports/acurast.json --project . || true", + "lint-ci:prettier": "prettier \"src/**/*.ts\" \"test/**/*.ts\" --list-different", + "test": "TS_NODE_PROJECT='./test/tsconfig.json' nyc mocha --bail --require ts-node/register --require tsconfig-paths/register --require source-map-support/register --full-trace --delay --timeout 40000 ./test/**/**.spec.ts", + "test-ci": "nyc --reporter=lcov npm test", + "browserify": "browserify ./dist/index.js -s airgapCoinLibAcurast > ./dist/airgap-coinlib-acurast.min.js" + }, + "author": "Papers AG (https://papers.ch)", + "dependencies": { + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/substrate": "^0.13.26-beta.0", + "@polkadot/util": "2.0.1", + "@polkadot/wasm-crypto": "0.20.1" + }, + "localDependencies": {}, + "nyc": { + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "test/**/*.spec.ts" + ], + "extension": [ + ".ts" + ], + "require": [ + "ts-node/register" + ], + "reporter": [ + "text", + "text-summary" + ], + "report-dir": "../../coverage/acurast", + "sourceMap": true, + "instrument": true + }, + "gitHead": "8e8feb6788204501b7173aa825f5456c2a5f185b" +} diff --git a/packages/acurast/readme.md b/packages/acurast/readme.md new file mode 100644 index 00000000..acf5d250 --- /dev/null +++ b/packages/acurast/readme.md @@ -0,0 +1,121 @@ +# AirGap Coin Library + +[![npm](https://img.shields.io/npm/v/airgap-coin-lib.svg?colorB=brightgreen)](https://www.npmjs.com/package/airgap-coin-lib) +[![documentation](https://img.shields.io/badge/documentation-online-brightgreen.svg)](https://airgap-it.github.io/airgap-coin-lib/) +[![build](https://img.shields.io/travis/airgap-it/airgap-coin-lib.svg)](https://travis-ci.org/airgap-it/airgap-coin-lib/) +[![codecov](https://img.shields.io/codecov/c/gh/airgap-it/airgap-coin-lib.svg)](https://codecov.io/gh/airgap-it/airgap-coin-lib/) + +The `airgap-coin-lib` is a protocol-agnostic library that allows easy handling of the most important tasks relating cryptocurrencies and blockchains. + +It implements operations such as preparing, signing and broadcasting transactions for a range of protocols. + +The library consists of a shared interface for all implemented protocols. This is especially useful in the context of AirGap because methods are designed to support offline key management and signing. The following core operations are specified: + +- `prepareTransaction` - This is done on AirGap Wallet (online) side. Either a public key or extended public key is used and will fetch the required information from the network. +- `signTransaction` - This is done in AirGap Vault (offline) side. The output of "prepareTransaction" is the input for this method (hence the output of "prepareTransaction" is transferred via URL scheme (same-device) or QR code (2-device-setup)). +- `broadcastTransaction` - This is done in AirGap Wallet (online) side. The output of "signTransaction" is the input for this method (hence the output of "signTransaction" is transferred via URL scheme (same-device) or QR code (2-device-setup)). + +## Supported Protocols + +The modular design used in this library allows you to simply add new protocols with special logic. Adding a new Bitcoin-like protocol basically means: + +1. select the correct network parameters (see `src/networks.ts`) +2. set the Insight API URL to communicate with the blockchain + +Adding a new Ethereum-like protocol means: + +1. set the correct chain id +2. set the JSON RPC URL + +Currently supported are: + +- Bitcoin +- Ethereum + - Generic ERC20 Tokens +- Aeternity +- Tezos + - FA1.2 tokens + - tzBTC + - USDtz + - FA2 tokens +- Groestlcoin +- Cosmos +- Polkadot +- Kusama + +## Features + +### Protocols + +The way the interface was designed is to allow stateless calls. This means the class stores very little state itself. +All required input comes from the method params (public key, extended public key, etc...) + +Currently we support for Bitcoin-like (UTXO) protocols: + +- Single Address Wallets (deprecated) +- HD Wallets + +Currently we support for Ethereum-like (Account-based) protocols: + +- Single Address Wallets + +### Delegation + +There is a different interface that can be implemented if the protocol supports delegation. The delegation flow usually requires some changes in the user interface of the AirGap Wallet as well. + +### Inter App Communication + +A serializer is included that encodes JSON structures with RLP and base58check. Those strings can then be sent to the other app, either through QR codes or a URL. The serializer can only serialize messages in predefined formats, so new message types have to be added when new protocols are added. + +### Tezos FA1.2 and FA2 tokens + +It is possible to interact (fetch balances, create transfers, etc.) with an FA1.2 and FA2 smart contracts using the `TezosFA12Protocol` and `TezosFA2Protocol` classes. An example on how to use them can be found in `examples/custom/protocols/tezos/fa2-smart-contract.ts`. + +## Synchronising information between wallet and vault + +Such that the system works we need to be able to synchronise wallets. A wallet can be: + +- Single Address Wallet +- HD Wallet + +For the single address wallet we only need to share the public key. For HD Wallet we need to share the extended public key. + +## Getting started + +### Requirements + +``` +npm >= 6 +NodeJS >= 12 +``` + +Build dependencies get installed using `npm install`. + +### Clone and Run + +``` +$ git clone https://github.com/airgap-it/airgap-coin-lib.git +$ cd airgap-coin-lib +$ npm install +``` + +To run the tests, you will have to install the test dependencies + +``` +$ npm run install-test-dependencies +$ npm test +``` + +To remove the test dependencies and clean up the `package.json` and `package-lock.json`, execute this command + +``` +$ npm run install-build-dependencies +``` + +### Contributing + +We welcome contributions from the community. Simple readme updates or bugfixes can be addressed with a PR directly. + +For larger changes like new protocols, new features or larger refactorings, please contact us first by opening an issue. This project is under constant development and until version `1.x.x` has been reached, there will be frequent breaking changes. So make sure to take a look at the `develop` branch. + +Regarding new protocols / currencies, we cannot guarantee that they will be merged, but we're more than happy to discuss the details of a specific integration in a github issue. diff --git a/packages/acurast/scripts/copy-files-after-build.js b/packages/acurast/scripts/copy-files-after-build.js new file mode 100644 index 00000000..f8ae0e4e --- /dev/null +++ b/packages/acurast/scripts/copy-files-after-build.js @@ -0,0 +1,183 @@ +'use strict' +var __awaiter = + (this && this.__awaiter) || + function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P + ? value + : new P(function (resolve) { + resolve(value) + }) + } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)) + } catch (e) { + reject(e) + } + } + function rejected(value) { + try { + step(generator['throw'](value)) + } catch (e) { + reject(e) + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected) + } + step((generator = generator.apply(thisArg, _arguments || [])).next()) + }) + } +var __generator = + (this && this.__generator) || + function (thisArg, body) { + var _ = { + label: 0, + sent: function () { + if (t[0] & 1) throw t[1] + return t[1] + }, + trys: [], + ops: [] + }, + f, + y, + t, + g + return ( + (g = { next: verb(0), throw: verb(1), return: verb(2) }), + typeof Symbol === 'function' && + (g[Symbol.iterator] = function () { + return this + }), + g + ) + function verb(n) { + return function (v) { + return step([n, v]) + } + } + function step(op) { + if (f) throw new TypeError('Generator is already executing.') + while (_) + try { + if ( + ((f = 1), + y && + (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) && + !(t = t.call(y, op[1])).done) + ) + return t + if (((y = 0), t)) op = [op[0] & 2, t.value] + switch (op[0]) { + case 0: + case 1: + t = op + break + case 4: + _.label++ + return { value: op[1], done: false } + case 5: + _.label++ + y = op[1] + op = [0] + continue + case 7: + op = _.ops.pop() + _.trys.pop() + continue + default: + if (!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) && (op[0] === 6 || op[0] === 2)) { + _ = 0 + continue + } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { + _.label = op[1] + break + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1] + t = op + break + } + if (t && _.label < t[2]) { + _.label = t[2] + _.ops.push(op) + break + } + if (t[2]) _.ops.pop() + _.trys.pop() + continue + } + op = body.call(thisArg, _) + } catch (e) { + op = [6, e] + y = 0 + } finally { + f = t = 0 + } + if (op[0] & 5) throw op[1] + return { value: op[0] ? op[1] : void 0, done: true } + } + } +exports.__esModule = true +var fs_1 = require('fs') +var path_1 = require('path') +var findFilesOnLevel = function (base) { + return __awaiter(void 0, void 0, void 0, function () { + var files, filesInFolder, _i, filesInFolder_1, file, path, isDirectory, _a, _b, _c + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + files = [] + filesInFolder = fs_1.readdirSync(base) + ;(_i = 0), (filesInFolder_1 = filesInFolder) + _d.label = 1 + case 1: + if (!(_i < filesInFolder_1.length)) return [3 /*break*/, 5] + file = filesInFolder_1[_i] + path = base + '/' + file + isDirectory = fs_1.lstatSync(path).isDirectory() + if (!isDirectory) return [3 /*break*/, 3] + _b = (_a = files.push).apply + _c = [files] + return [4 /*yield*/, findFilesOnLevel(path)] + case 2: + _b.apply(_a, _c.concat([_d.sent()])) + return [3 /*break*/, 4] + case 3: + if (file.endsWith('json') || file.endsWith('js')) { + files.push(path) + path_1 + .dirname(path) + .split(path_1.sep) + .reduce(function (prevPath, folder) { + var currentPath = path_1.join(prevPath, folder, path_1.sep) + if (currentPath === 'src/') { + return 'dist/' + } + if (!fs_1.existsSync(currentPath)) { + fs_1.mkdirSync(currentPath) + } + return currentPath + }, '') + console.log('Copying file', path.replace('./src', './dist')) + fs_1.copyFileSync(path, path.replace('./src', './dist')) + } + _d.label = 4 + case 4: + _i++ + return [3 /*break*/, 1] + case 5: + return [2 /*return*/, files] + } + }) + }) +} +findFilesOnLevel('./src/v1/serializer/v3/schemas/generated') + .then(function () {}) + ['catch'](console.error) +fs_1.copyFileSync('./package.json', './dist/package.json') +fs_1.copyFileSync('./readme.md', './dist/readme.md') diff --git a/packages/acurast/scripts/copy-files-after-build.ts b/packages/acurast/scripts/copy-files-after-build.ts new file mode 100644 index 00000000..7460b5e9 --- /dev/null +++ b/packages/acurast/scripts/copy-files-after-build.ts @@ -0,0 +1,41 @@ +import { mkdirSync, copyFileSync, readdirSync, lstatSync, existsSync } from 'fs' +import { dirname, join, sep } from 'path' + +const findFilesOnLevel = async (base: string) => { + const files: string[] = [] + const filesInFolder = readdirSync(base) + for (const file of filesInFolder) { + const path = `${base}/${file}` + const isDirectory = lstatSync(path).isDirectory() + if (isDirectory) { + files.push(...(await findFilesOnLevel(path))) + } else if ((file as any).endsWith('json') || (file as any).endsWith('js')) { + files.push(path) + dirname(path) + .split(sep) + .reduce((prevPath, folder) => { + const currentPath = join(prevPath, folder, sep) + if (currentPath === 'src/') { + return 'dist/' + } + + if (!existsSync(currentPath)) { + mkdirSync(currentPath) + } + + return currentPath + }, '') + + console.log('Copying file', path.replace('./src', './dist')) + + copyFileSync(path, path.replace('./src', './dist')) + } + } + return files +} +findFilesOnLevel('./src/v1/serializer/v3/schemas/generated') + .then(() => {}) + .catch(console.error) + +copyFileSync('./package.json', './dist/package.json') +copyFileSync('./readme.md', './dist/readme.md') diff --git a/packages/acurast/src/index.ts b/packages/acurast/src/index.ts new file mode 100644 index 00000000..c317f850 --- /dev/null +++ b/packages/acurast/src/index.ts @@ -0,0 +1 @@ +export * from './v1' diff --git a/packages/acurast/src/v1/controller/AcurastAccountController.ts b/packages/acurast/src/v1/controller/AcurastAccountController.ts new file mode 100644 index 00000000..a5e2711d --- /dev/null +++ b/packages/acurast/src/v1/controller/AcurastAccountController.ts @@ -0,0 +1,6 @@ +import { SubstrateCommonAccountController } from '@airgap/substrate/v1' + +import { AcurastNodeClient } from '../node/AcurastNodeClient' +import { AcurastProtocolConfiguration } from '../types/configuration' + +export class AcurastAccountController extends SubstrateCommonAccountController {} diff --git a/packages/acurast/src/v1/controller/AcurastTransactionController.ts b/packages/acurast/src/v1/controller/AcurastTransactionController.ts new file mode 100644 index 00000000..f8904d19 --- /dev/null +++ b/packages/acurast/src/v1/controller/AcurastTransactionController.ts @@ -0,0 +1,6 @@ +import { SubstrateCommonTransactionController } from '@airgap/substrate/v1' + +import { AcurastNodeClient } from '../node/AcurastNodeClient' +import { AcurastProtocolConfiguration } from '../types/configuration' + +export class AcurastTransactionController extends SubstrateCommonTransactionController {} diff --git a/packages/acurast/src/v1/index.ts b/packages/acurast/src/v1/index.ts new file mode 100644 index 00000000..6305134a --- /dev/null +++ b/packages/acurast/src/v1/index.ts @@ -0,0 +1,17 @@ +import { AcurastModule } from './module/AcurastModule' +import { AcurastProtocol, createAcurastProtocol } from './protocol/AcurastProtocol' +import { AcurastProtocolConfiguration } from './types/configuration' +import { AcurastCryptoConfiguration } from './types/crypto' +import { AcurastProtocolNetwork, AcurastProtocolOptions, AcurastUnits } from './types/protocol' + +// Module + +export { AcurastModule } + +// Protocol + +export { AcurastProtocol, createAcurastProtocol } + +// Types + +export { AcurastCryptoConfiguration, AcurastUnits, AcurastProtocolNetwork, AcurastProtocolOptions, AcurastProtocolConfiguration } diff --git a/packages/acurast/src/v1/module.ts b/packages/acurast/src/v1/module.ts new file mode 100644 index 00000000..436c7692 --- /dev/null +++ b/packages/acurast/src/v1/module.ts @@ -0,0 +1,8 @@ +import { AirGapModule } from '@airgap/module-kit' +import { AcurastModule } from './module/AcurastModule' + +export * from './index' + +export function create(): AirGapModule { + return new AcurastModule() +} diff --git a/packages/acurast/src/v1/module/AcurastModule.ts b/packages/acurast/src/v1/module/AcurastModule.ts new file mode 100644 index 00000000..1968892b --- /dev/null +++ b/packages/acurast/src/v1/module/AcurastModule.ts @@ -0,0 +1,72 @@ +import { Domain, MainProtocolSymbols } from '@airgap/coinlib-core' +import { ConditionViolationError } from '@airgap/coinlib-core/errors' +import { + AirGapModule, + AirGapV3SerializerCompanion, + createSupportedProtocols, + ModuleNetworkRegistry, + ProtocolConfiguration, + ProtocolNetwork +} from '@airgap/module-kit' +import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer' +import { AirGapProtocol, OfflineProtocol, OnlineProtocol } from '@airgap/module-kit/protocol/protocol' +import { SubscanBlockExplorer } from '@airgap/substrate' + +import { ACURAST_MAINNET_PROTOCOL_NETWORK, createAcurastProtocol } from '../protocol/AcurastProtocol' +import { AcurastV3SerializerCompanion } from '../serializer/v3/serializer-companion' +import { AcurastProtocolNetwork } from '../types/protocol' + +type SupportedProtocols = MainProtocolSymbols.ACURAST + +export class AcurastModule implements AirGapModule<{ Protocols: SupportedProtocols; ProtocolNetwork: AcurastProtocolNetwork }> { + private readonly networkRegistries: Record = { + [MainProtocolSymbols.ACURAST]: new ModuleNetworkRegistry({ + supportedNetworks: [ACURAST_MAINNET_PROTOCOL_NETWORK] + }) + } + public readonly supportedProtocols: Record = createSupportedProtocols(this.networkRegistries) + + public async createOfflineProtocol(identifier: SupportedProtocols): Promise { + return this.createProtocol(identifier) + } + + public async createOnlineProtocol( + identifier: SupportedProtocols, + networkOrId?: AcurastProtocolNetwork | string + ): Promise { + const network: ProtocolNetwork | undefined = + typeof networkOrId === 'object' ? networkOrId : this.networkRegistries[identifier]?.findNetwork(networkOrId) + + if (network === undefined) { + throw new ConditionViolationError(Domain.SUBSTRATE, `Protocol network type not supported. (Acurast)`) + } + + return this.createProtocol(identifier, network) + } + + public async createBlockExplorer( + identifier: SupportedProtocols, + networkOrId?: AcurastProtocolNetwork | string + ): Promise { + const network: ProtocolNetwork | undefined = + typeof networkOrId === 'object' ? networkOrId : this.networkRegistries[identifier]?.findNetwork(networkOrId) + + if (network === undefined) { + throw new ConditionViolationError(Domain.SUBSTRATE, `Block Explorer network type not supported. (Acurast)`) + } + + return new SubscanBlockExplorer(network.blockExplorerUrl) + } + + public async createV3SerializerCompanion(): Promise { + return new AcurastV3SerializerCompanion() + } + + private createProtocol(identifier: SupportedProtocols, network?: ProtocolNetwork): AirGapProtocol { + if (identifier === MainProtocolSymbols.ACURAST) { + return createAcurastProtocol({ network }) + } else { + throw new ConditionViolationError(Domain.SUBSTRATE, `Protocol ${identifier} not supported. (Acurast)`) + } + } +} diff --git a/packages/acurast/src/v1/node/AcurastNodeClient.ts b/packages/acurast/src/v1/node/AcurastNodeClient.ts new file mode 100644 index 00000000..b3774b44 --- /dev/null +++ b/packages/acurast/src/v1/node/AcurastNodeClient.ts @@ -0,0 +1,5 @@ +import { SubstrateCommonNodeClient } from '@airgap/substrate/v1' + +import { AcurastProtocolConfiguration } from '../types/configuration' + +export class AcurastNodeClient extends SubstrateCommonNodeClient {} diff --git a/packages/acurast/src/v1/protocol/AcurastBaseProtocol.ts b/packages/acurast/src/v1/protocol/AcurastBaseProtocol.ts new file mode 100644 index 00000000..ef819efc --- /dev/null +++ b/packages/acurast/src/v1/protocol/AcurastBaseProtocol.ts @@ -0,0 +1,68 @@ +import { + SubscanBlockExplorerClient, + SubstrateAccountId, + SubstrateProtocol, + SubstrateProtocolImpl, + SubstrateSS58Address, + SubstrateTransactionType +} from '@airgap/substrate/v1' + +import { AcurastAccountController } from '../controller/AcurastAccountController' +import { AcurastTransactionController } from '../controller/AcurastTransactionController' +import { AcurastNodeClient } from '../node/AcurastNodeClient' +import { AcurastProtocolConfiguration } from '../types/configuration' +import { AcurastCryptoConfiguration } from '../types/crypto' +import { AcurastBaseProtocolOptions, AcurastProtocolNetwork } from '../types/protocol' + +// Interface + +export interface AcurastBaseProtocol<_Units extends string = string> + extends SubstrateProtocol {} + +// Implemenation + +export abstract class AcurastBaseProtocolImpl<_Units extends string> + extends SubstrateProtocolImpl< + _Units, + AcurastProtocolConfiguration, + AcurastProtocolNetwork, + AcurastNodeClient, + AcurastAccountController, + AcurastTransactionController + > + implements AcurastBaseProtocol<_Units> +{ + public constructor(options: AcurastBaseProtocolOptions<_Units>) { + const nodeClient: AcurastNodeClient = new AcurastNodeClient(options.configuration, options.network.rpcUrl) + + const accountController: AcurastAccountController = new AcurastAccountController(options.configuration, nodeClient) + const transactionController: AcurastTransactionController = new AcurastTransactionController(options.configuration, nodeClient) + + const blockExplorer: SubscanBlockExplorerClient = new SubscanBlockExplorerClient(options.network.blockExplorerApi) + + super(options, nodeClient, accountController, transactionController, blockExplorer) + } + + protected async getFutureRequiredTransactions( + accountId: SubstrateAccountId, + intention: 'transfer' | 'check' + ): Promise<[SubstrateTransactionType, any][]> { + const balance = await this.accountController.getBalance(accountId) + + const transferableBalance = balance.transferable.minus(balance.existentialDeposit) + + const requiredTransactions: [SubstrateTransactionType, any][] = [] + + if (intention === 'transfer') { + requiredTransactions.push([ + 'transfer', + { + to: SubstrateSS58Address.createPlaceholder(), + value: transferableBalance + } + ]) + } + + return requiredTransactions + } +} diff --git a/packages/acurast/src/v1/protocol/AcurastProtocol.ts b/packages/acurast/src/v1/protocol/AcurastProtocol.ts new file mode 100644 index 00000000..92962e0f --- /dev/null +++ b/packages/acurast/src/v1/protocol/AcurastProtocol.ts @@ -0,0 +1,78 @@ +import { MainProtocolSymbols } from '@airgap/coinlib-core' +import { ProtocolMetadata, RecursivePartial } from '@airgap/module-kit' +import { AcurastProtocolConfiguration } from '../types/configuration' +import { AcurastProtocolNetwork, AcurastProtocolOptions, AcurastUnits } from '../types/protocol' + +import { AcurastBaseProtocol, AcurastBaseProtocolImpl } from './AcurastBaseProtocol' + +//interface +export interface AcurastProtocol extends AcurastBaseProtocol {} + +// Implementation + +export const ACURAST_METADATA: ProtocolMetadata = { + identifier: MainProtocolSymbols.ACURAST, + name: 'Acurast', + + units: { + cACU: { + symbol: { value: 'cACU' }, + decimals: 12 + } + }, + mainUnit: 'cACU', + + account: { + standardDerivationPath: `m/44'/434'/0'/0/0`, + address: { + isCaseSensitive: true, + placeholder: `5ABC...`, + regex: '^5[a-km-zA-HJ-NP-Z1-9]+$' + } + } +} + +export const ACURAST_CONFIGURATION: AcurastProtocolConfiguration = { + account: { + type: 'ss58', + format: 42 + }, + transaction: { + types: {} + } +} + +export class AcurastProtocolImpl extends AcurastBaseProtocolImpl implements AcurastProtocol { + public constructor(options: RecursivePartial = {}) { + const completeOptions: AcurastProtocolOptions = createAcurastProtocolOptions(options.network) + + const metadata: ProtocolMetadata = ACURAST_METADATA + const configuration: AcurastProtocolConfiguration = ACURAST_CONFIGURATION + + super({ metadata, configuration, network: completeOptions.network }) + } +} + +// Factory + +export function createAcurastProtocol(options: RecursivePartial = {}): AcurastProtocol { + return new AcurastProtocolImpl(options) +} + +export const ACURAST_MAINNET_PROTOCOL_NETWORK: AcurastProtocolNetwork = { + name: 'Mainnet', + type: 'mainnet', + rpcUrl: 'https://acurast-canarynet-node.prod.gke.acurast.com', + // rpcUrl: 'https://rpc.collator-1.acurast.papers.tech', //testnet + blockExplorerUrl: 'https://polkadot.js.org/apps/?rpc=wss://acurast-canarynet-ws.prod.gke.papers.tech#/explorer', + // blockExplorerUrl: 'https://polkadot.js.org/apps/?rpc=wss.collator-1.acurast.papers.tech#/explorer', + blockExplorerApi: '' +} + +const DEFAULT_ACURAST_PROTOCOL_NETWORK: AcurastProtocolNetwork = ACURAST_MAINNET_PROTOCOL_NETWORK + +export function createAcurastProtocolOptions(network: Partial = {}): AcurastProtocolOptions { + return { + network: { ...DEFAULT_ACURAST_PROTOCOL_NETWORK, ...network } + } +} diff --git a/packages/acurast/src/v1/serializer/v3/schemas/converter/transaction-converter.ts b/packages/acurast/src/v1/serializer/v3/schemas/converter/transaction-converter.ts new file mode 100644 index 00000000..92a10b60 --- /dev/null +++ b/packages/acurast/src/v1/serializer/v3/schemas/converter/transaction-converter.ts @@ -0,0 +1,34 @@ +import { + SubstrateSignedTransaction, + substrateSignedTransactionToResponse, + substrateTransactionSignRequestToUnsigned, + substrateTransactionSignResponseToSigned, + SubstrateUnsignedTransaction, + substrateUnsignedTransactionToRequest +} from '@airgap/substrate/v1' + +import { AcurastTransactionSignRequest } from '../definitions/transaction-sign-request-acurast' +import { AcurastTransactionSignResponse } from '../definitions/transaction-sign-response-acurast' + +export function acurastUnsignedTransactionToRequest( + unsigned: SubstrateUnsignedTransaction, + publicKey: string, + callbackUrl?: string +): AcurastTransactionSignRequest { + return substrateUnsignedTransactionToRequest(unsigned, publicKey, callbackUrl) +} + +export function acurastSignedTransactionToResponse( + signed: SubstrateSignedTransaction, + accountIdentifier: string +): AcurastTransactionSignResponse { + return substrateSignedTransactionToResponse(signed, accountIdentifier) +} + +export function acurastTransactionSignRequestToUnsigned(request: AcurastTransactionSignRequest): SubstrateUnsignedTransaction { + return substrateTransactionSignRequestToUnsigned(request) +} + +export function acurastTransactionSignResponseToSigned(response: AcurastTransactionSignResponse): SubstrateSignedTransaction { + return substrateTransactionSignResponseToSigned(response) +} diff --git a/packages/acurast/src/v1/serializer/v3/schemas/definitions/transaction-sign-request-acurast.ts b/packages/acurast/src/v1/serializer/v3/schemas/definitions/transaction-sign-request-acurast.ts new file mode 100644 index 00000000..d06999ca --- /dev/null +++ b/packages/acurast/src/v1/serializer/v3/schemas/definitions/transaction-sign-request-acurast.ts @@ -0,0 +1,3 @@ +import { SubstrateTransactionSignRequest } from '@airgap/substrate/v1' + +export interface AcurastTransactionSignRequest extends SubstrateTransactionSignRequest {} diff --git a/packages/acurast/src/v1/serializer/v3/schemas/definitions/transaction-sign-response-acurast.ts b/packages/acurast/src/v1/serializer/v3/schemas/definitions/transaction-sign-response-acurast.ts new file mode 100644 index 00000000..b556bd49 --- /dev/null +++ b/packages/acurast/src/v1/serializer/v3/schemas/definitions/transaction-sign-response-acurast.ts @@ -0,0 +1,3 @@ +import { SubstrateTransactionSignResponse } from '@airgap/substrate/v1' + +export interface AcurastTransactionSignResponse extends SubstrateTransactionSignResponse {} diff --git a/packages/acurast/src/v1/serializer/v3/schemas/generated/transaction-sign-request-acurast.json b/packages/acurast/src/v1/serializer/v3/schemas/generated/transaction-sign-request-acurast.json new file mode 100644 index 00000000..9c13d1f9 --- /dev/null +++ b/packages/acurast/src/v1/serializer/v3/schemas/generated/transaction-sign-request-acurast.json @@ -0,0 +1,29 @@ +{ + "$ref": "#/definitions/AcurastTransactionSignRequest", + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "AcurastTransactionSignRequest": { + "additionalProperties": false, + "properties": { + "callbackURL": { + "type": "string" + }, + "publicKey": { + "type": "string" + }, + "transaction": { + "additionalProperties": false, + "properties": { + "encoded": { + "type": "string" + } + }, + "required": ["encoded"], + "type": "object" + } + }, + "required": ["publicKey", "transaction"], + "type": "object" + } + } +} diff --git a/packages/acurast/src/v1/serializer/v3/schemas/generated/transaction-sign-response-acurast.json b/packages/acurast/src/v1/serializer/v3/schemas/generated/transaction-sign-response-acurast.json new file mode 100644 index 00000000..2047c207 --- /dev/null +++ b/packages/acurast/src/v1/serializer/v3/schemas/generated/transaction-sign-response-acurast.json @@ -0,0 +1,19 @@ +{ + "$ref": "#/definitions/AcurastTransactionSignResponse", + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "AcurastTransactionSignResponse": { + "additionalProperties": false, + "properties": { + "accountIdentifier": { + "type": "string" + }, + "transaction": { + "type": "string" + } + }, + "required": ["accountIdentifier", "transaction"], + "type": "object" + } + } +} diff --git a/packages/acurast/src/v1/serializer/v3/serializer-companion.ts b/packages/acurast/src/v1/serializer/v3/serializer-companion.ts new file mode 100644 index 00000000..b67f170c --- /dev/null +++ b/packages/acurast/src/v1/serializer/v3/serializer-companion.ts @@ -0,0 +1,117 @@ +import { Domain, MainProtocolSymbols } from '@airgap/coinlib-core' +import { validators } from '@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate' +import { UnsupportedError } from '@airgap/coinlib-core/errors' +import { AirGapV3SerializerCompanion, SignedTransaction, UnsignedTransaction } from '@airgap/module-kit' +import { V3SchemaConfiguration } from '@airgap/module-kit/types/serializer' +import { IACMessageType, SchemaRoot, TransactionSignRequest, TransactionSignResponse } from '@airgap/serializer' +import { SubstrateSignedTransaction, SubstrateUnsignedTransaction } from '@airgap/substrate/v1' + +import { + acurastSignedTransactionToResponse, + acurastTransactionSignRequestToUnsigned, + acurastTransactionSignResponseToSigned, + acurastUnsignedTransactionToRequest +} from './schemas/converter/transaction-converter' +import { AcurastTransactionValidator } from './validators/transaction-validator' +import { acurastValidators } from './validators/validators' + +const acurastTransactionSignRequest: SchemaRoot = require('./schemas/generated/transaction-sign-request-acurast.json') +const acurastTransactionSignResponse: SchemaRoot = require('./schemas/generated/transaction-sign-response-acurast.json') + +export class AcurastV3SerializerCompanion implements AirGapV3SerializerCompanion { + public readonly schemas: V3SchemaConfiguration[] = [ + { + type: IACMessageType.TransactionSignRequest, + schema: { schema: acurastTransactionSignRequest }, + protocolIdentifier: MainProtocolSymbols.ACURAST + }, + { + type: IACMessageType.TransactionSignResponse, + schema: { schema: acurastTransactionSignResponse }, + protocolIdentifier: MainProtocolSymbols.ACURAST + } + ] + + private readonly acurastTransactionValidator: AcurastTransactionValidator = new AcurastTransactionValidator() + + public constructor() { + Object.keys(acurastValidators).forEach((key: string) => { + validators[key] = acurastValidators[key as keyof typeof acurastValidators] + }) + } + + public async toTransactionSignRequest( + identifier: string, + unsignedTransaction: UnsignedTransaction, + publicKey: string, + callbackUrl?: string + ): Promise { + if (identifier === MainProtocolSymbols.ACURAST) { + return acurastUnsignedTransactionToRequest(unsignedTransaction as SubstrateUnsignedTransaction, publicKey, callbackUrl) + } else { + throw new UnsupportedError(Domain.SUBSTRATE, `Protocol ${identifier} not supported`) + } + } + + public async fromTransactionSignRequest( + identifier: string, + transactionSignRequest: TransactionSignRequest + ): Promise { + if (identifier === MainProtocolSymbols.ACURAST) { + return acurastTransactionSignRequestToUnsigned(transactionSignRequest) + } else { + throw new UnsupportedError(Domain.SUBSTRATE, `Protocol ${identifier} not supported`) + } + } + + public async validateTransactionSignRequest(identifier: string, transactionSignRequest: TransactionSignRequest): Promise { + if (identifier === MainProtocolSymbols.ACURAST) { + try { + await this.acurastTransactionValidator.validateUnsignedTransaction(transactionSignRequest) + + return true + } catch { + return false + } + } else { + throw new UnsupportedError(Domain.SUBSTRATE, `Protocol ${identifier} not supported`) + } + } + + public async toTransactionSignResponse( + identifier: string, + signedTransaction: SignedTransaction, + accountIdentifier: string + ): Promise { + if (identifier === MainProtocolSymbols.ACURAST) { + return acurastSignedTransactionToResponse(signedTransaction as SubstrateSignedTransaction, accountIdentifier) + } else { + throw new UnsupportedError(Domain.SUBSTRATE, `Protocol ${identifier} not supported`) + } + } + + public async fromTransactionSignResponse( + identifier: string, + transactionSignResponse: TransactionSignResponse + ): Promise { + if (identifier === MainProtocolSymbols.ACURAST) { + return acurastTransactionSignResponseToSigned(transactionSignResponse) + } else { + throw new UnsupportedError(Domain.SUBSTRATE, `Protocol ${identifier} not supported`) + } + } + + public async validateTransactionSignResponse(identifier: string, transactionSignResponse: TransactionSignResponse): Promise { + if (identifier === MainProtocolSymbols.ACURAST) { + try { + await this.acurastTransactionValidator.validateSignedTransaction(transactionSignResponse) + + return true + } catch { + return false + } + } else { + throw new UnsupportedError(Domain.SUBSTRATE, `Protocol ${identifier} not supported`) + } + } +} diff --git a/packages/acurast/src/v1/serializer/v3/validators/transaction-validator.ts b/packages/acurast/src/v1/serializer/v3/validators/transaction-validator.ts new file mode 100644 index 00000000..2c1b7096 --- /dev/null +++ b/packages/acurast/src/v1/serializer/v3/validators/transaction-validator.ts @@ -0,0 +1,5 @@ +// tslint:disable: max-classes-per-file +import { TransactionValidator } from '@airgap/serializer' +import { SubstrateTransactionValidator } from '@airgap/substrate/v1' + +export class AcurastTransactionValidator extends SubstrateTransactionValidator implements TransactionValidator {} diff --git a/packages/acurast/src/v1/serializer/v3/validators/validators.ts b/packages/acurast/src/v1/serializer/v3/validators/validators.ts new file mode 100644 index 00000000..48bb3072 --- /dev/null +++ b/packages/acurast/src/v1/serializer/v3/validators/validators.ts @@ -0,0 +1,3 @@ +import { substrateValidators } from '@airgap/substrate/v1' + +export const acurastValidators = substrateValidators diff --git a/packages/acurast/src/v1/types/configuration.ts b/packages/acurast/src/v1/types/configuration.ts new file mode 100644 index 00000000..70e9f3e6 --- /dev/null +++ b/packages/acurast/src/v1/types/configuration.ts @@ -0,0 +1,6 @@ +import { SubstrateProtocolConfiguration, SubstrateSS58AccountConfiguration } from '@airgap/substrate/v1' + +export type AcurastTransactionType = never + +export interface AcurastProtocolConfiguration + extends SubstrateProtocolConfiguration {} diff --git a/packages/acurast/src/v1/types/crypto.ts b/packages/acurast/src/v1/types/crypto.ts new file mode 100644 index 00000000..399c634b --- /dev/null +++ b/packages/acurast/src/v1/types/crypto.ts @@ -0,0 +1,3 @@ +import { Sr25519CryptoConfiguration } from '@airgap/module-kit' + +export type AcurastCryptoConfiguration = Sr25519CryptoConfiguration diff --git a/packages/acurast/src/v1/types/protocol.ts b/packages/acurast/src/v1/types/protocol.ts new file mode 100644 index 00000000..5ed0110a --- /dev/null +++ b/packages/acurast/src/v1/types/protocol.ts @@ -0,0 +1,16 @@ +import { SubstrateProtocolNetwork, SubstrateProtocolOptions } from '@airgap/substrate/v1' + +import { AcurastProtocolConfiguration } from './configuration' + +export type AcurastUnits = 'cACU' + +export interface AcurastProtocolNetwork extends SubstrateProtocolNetwork { + blockExplorerApi: string +} + +export interface AcurastProtocolOptions { + network: AcurastProtocolNetwork +} + +export interface AcurastBaseProtocolOptions<_Units extends string> + extends SubstrateProtocolOptions<_Units, AcurastProtocolConfiguration, AcurastProtocolNetwork> {} diff --git a/packages/acurast/test/tsconfig.json b/packages/acurast/test/tsconfig.json new file mode 100644 index 00000000..7d1c848d --- /dev/null +++ b/packages/acurast/test/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "strict": false + }, + "include": ["."] +} diff --git a/packages/acurast/test/v1/_setup.spec.ts b/packages/acurast/test/v1/_setup.spec.ts new file mode 100644 index 00000000..d02b2bf4 --- /dev/null +++ b/packages/acurast/test/v1/_setup.spec.ts @@ -0,0 +1,14 @@ +import Axios from '@airgap/coinlib-core/dependencies/src/axios-0.19.0' + +const MockAdapter = require('axios-mock-adapter') + +// This sets the mock adapter on the default instance +const mock = new MockAdapter(Axios) + +mock.onAny().replyOnce((config) => { + console.log('UNMOCKED URL, RETURNING ERROR 500', config.url) + + return [500, {}] +}) + +// mock.onAny().passThrough() diff --git a/packages/acurast/test/v1/block-explorer.ts b/packages/acurast/test/v1/block-explorer.ts new file mode 100644 index 00000000..fb85ea00 --- /dev/null +++ b/packages/acurast/test/v1/block-explorer.ts @@ -0,0 +1,64 @@ +// tslint:disable no-floating-promises +import { AirGapBlockExplorer } from '@airgap/module-kit' +import { SubscanBlockExplorer } from '@airgap/substrate' +import chai = require('chai') +import chaiAsPromised = require('chai-as-promised') +import 'mocha' + +import { ACURAST_MAINNET_PROTOCOL_NETWORK } from '../../src/v1/protocol/AcurastProtocol' + +// use chai-as-promised plugin +chai.use(chaiAsPromised) +const expect = chai.expect + +const blockExplorers: AirGapBlockExplorer[] = [new SubscanBlockExplorer(ACURAST_MAINNET_PROTOCOL_NETWORK.blockExplorerUrl)] + +Promise.all( + blockExplorers.map(async (blockExplorer: AirGapBlockExplorer) => { + const blockExplorerMetadata = await blockExplorer.getMetadata() + + const address = 'dummyAddress' + const txId = 'dummyTxId' + + const addressUrl = await blockExplorer.createAddressUrl(address) + const transactionUrl = await blockExplorer.createTransactionUrl(txId) + + describe(`Block Explorer ${blockExplorerMetadata.name}`, () => { + it('should replace address', async () => { + expect(addressUrl).to.contain(address) + }) + + it('should replace txId', async () => { + expect(transactionUrl).to.contain(txId) + }) + + it('should contain blockexplorer url', async () => { + expect(addressUrl).to.contain(blockExplorerMetadata.url) + expect(transactionUrl).to.contain(blockExplorerMetadata.url) + }) + + it('should not contain placeholder brackets', async () => { + // Placeholders should be replaced + expect(addressUrl).to.not.contain('{{') + expect(addressUrl).to.not.contain('}}') + expect(transactionUrl).to.not.contain('{{') + expect(transactionUrl).to.not.contain('}}') + }) + + it('should always use https://', async () => { + expect(addressUrl).to.not.contain('http://') + expect(transactionUrl).to.not.contain('http://') + expect(addressUrl).to.contain('https://') + expect(transactionUrl).to.contain('https://') + }) + + it('should never contain 2 / after each other', async () => { + // We remove "https://" so we can check if the rest of the url contains "//" + expect(addressUrl.split('https://').join('')).to.not.contain('//') + expect(transactionUrl.split('https://').join('')).to.not.contain('//') + }) + }) + }) +).then(() => { + run() +}) diff --git a/packages/acurast/test/v1/implementations.ts b/packages/acurast/test/v1/implementations.ts new file mode 100644 index 00000000..e7b8fdec --- /dev/null +++ b/packages/acurast/test/v1/implementations.ts @@ -0,0 +1,185 @@ +import { derive, mnemonicToSeed } from '@airgap/crypto' +import { Amount, CryptoDerivative, PublicKey, SecretKey, Signature } from '@airgap/module-kit' +import { SubstrateSignedTransaction, SubstrateUnsignedTransaction } from '@airgap/substrate/v1' + +import { AcurastBaseProtocolImpl } from '../../src/v1/protocol/AcurastBaseProtocol' + +interface ProtocolHTTPStub<_Units extends string = string> { + registerStub(testProtocolSpec: TestProtocolSpec): Promise + noBalanceStub(testProtocolSpec: TestProtocolSpec): Promise + transactionListStub(testProtocolSpec: TestProtocolSpec<_Units>, address: string): Promise +} + +abstract class TestProtocolSpec<_Units extends string = string> { + public name: string = 'TEST' + // tslint:disable:no-object-literal-type-assertion + public abstract lib: AcurastBaseProtocolImpl<_Units> + public abstract stub: ProtocolHTTPStub + // tslint:enable:no-object-literal-type-assertion + public validAddresses: string[] = [] + public abstract wallet: { + secretKey: SecretKey + publicKey: PublicKey + derivationPath: string + addresses: string[] + } + public abstract txs: { + to: string[] + from: string[] + amount: Amount<_Units> + fee: Amount<_Units> + unsignedTx: SubstrateUnsignedTransaction + signedTx: SubstrateSignedTransaction + }[] + public messages: { message: string; signature: Signature }[] = [] + public encryptAsymmetric: { message: string; encrypted: string }[] = [] + public encryptAES: { message: string; encrypted: string }[] = [] + + public abstract verifySignature: (publicKey: PublicKey, tx: SubstrateSignedTransaction) => Promise + + public abstract seed(): string + public abstract mnemonic(): string + + public async derivative(derivationPath?: string): Promise { + const [metadata, cryptoConfiguration] = await Promise.all([this.lib.getMetadata(), this.lib.getCryptoConfiguration()]) + + return derive( + cryptoConfiguration, + await mnemonicToSeed(cryptoConfiguration, this.mnemonic()), + derivationPath ?? metadata.account.standardDerivationPath + ) + } + + public transactionList(address: string): { + first: { + transfers: { + code: number + message: string + data: { count: number; transfers: any[] } + } + rewardSlash: { + code: number + message: string + data: { count: number; list: any[] } + } + } + next: { + transfers: { + code: number + message: string + data: { count: number; transfers: any[] } + } + rewardSlash: { + code: number + message: string + data: { count: number; list: any[] } + } + } + } { + const transfers: { + code: number + message: string + data: { count: number; transfers: any[] } + } = { + code: 0, + message: 'Success', + data: { + count: 3, + transfers: [ + { + from: address, + to: address, + success: true, + hash: '0x3f88e87ec0ced6d64ef5b7b0ac4d0bd6a0ef16131c3fd0b04dda5bab36277727', + block_num: 7739881, + block_timestamp: 1637139150, + module: 'balances', + amount: '0.01', + amount_v2: '0', + amount_v3: '0', + fee: '154000014' + }, + { + from: address, + to: address, + success: true, + hash: '0x3f88e87ec0ced6d64ef5b7b0ac4d0bd6a0ef16131c3fd0b04dda5bab36277727', + block_num: 7739881, + block_timestamp: 1637139150, + module: 'balances', + amount: '0.01', + amount_v2: '0', + amount_v3: '0', + fee: '154000014' + } + ] + } + } + + const rewardSlash: { + code: number + message: string + data: { count: number; list: any[] } + } = { + code: 0, + message: 'Success', + data: { + count: 3, + list: [ + { + account: address, + amount: '7452710', + block_num: 5760182, + block_timestamp: 1625226342, + event_id: 'Reward', + event_idx: 15, + event_index: '5760182-15', + event_method: 'Reward', + extrinsic_hash: '0x194d9bbe005bbec27741dd07a29cd2f852e600554ddd91f30f6bbd1d8702744c', + extrinsic_idx: 1, + extrinsic_index: '5760182-1', + module_id: 'staking', + stash: address + }, + { + account: address, + amount: '7452710', + block_num: 5760182, + block_timestamp: 1625226342, + event_id: 'Reward', + event_idx: 15, + event_index: '5760182-15', + event_method: 'Reward', + extrinsic_hash: '0x194d9bbe005bbec27741dd07a29cd2f852e600554ddd91f30f6bbd1d8702744c', + extrinsic_idx: 1, + extrinsic_index: '5760182-1', + module_id: 'staking', + stash: address + } + ] + } + } + + return { + first: { transfers, rewardSlash }, + next: { + transfers: { + ...transfers, + data: { + ...transfers.data, + transfers: [transfers.data.transfers[0]] + } + }, + rewardSlash: { + ...rewardSlash, + data: { + ...rewardSlash.data, + list: [rewardSlash.data.list[0]] + } + } + } + } + } +} + +export { TestProtocolSpec, ProtocolHTTPStub } diff --git a/packages/acurast/test/v1/paging.spec.ts b/packages/acurast/test/v1/paging.spec.ts new file mode 100644 index 00000000..a22baea8 --- /dev/null +++ b/packages/acurast/test/v1/paging.spec.ts @@ -0,0 +1,50 @@ +import chai = require('chai') +import chaiAsPromised = require('chai-as-promised') +import 'mocha' +import sinon = require('sinon') + +import { TestProtocolSpec } from './implementations' +import { AcurastTestProtocolSpec } from './specs/acurast' + +// use chai-as-promised plugin +chai.use(chaiAsPromised) +const expect = chai.expect + +const protocols: TestProtocolSpec[] = [new AcurastTestProtocolSpec()] + +protocols.forEach(async (protocol: TestProtocolSpec) => { + describe(`Transaction Paging`, () => { + afterEach(async () => { + sinon.restore() + }) + + it(`should properly page transactions for ${protocol.name.toUpperCase()}`, async () => { + const address = protocol.validAddresses[0] + const mockTransactions = protocol.transactionList(address) + + await protocol.stub.transactionListStub(protocol, address) + + const firstTransactions = await protocol.lib.getTransactionsForAddress( + address, + mockTransactions.first.transfers.data.transfers.length + ) + const nextTransactions = await protocol.lib.getTransactionsForAddress( + address, + mockTransactions.next.transfers.data.transfers.length + mockTransactions.next.rewardSlash.data.list.length + 1, + firstTransactions.cursor + ) + + expect(firstTransactions.transactions.length).to.be.eq( + mockTransactions.first.transfers.data.transfers.length + mockTransactions.first.rewardSlash.data.list.length + ) + expect(firstTransactions.cursor.hasNext).to.be.true + expect(firstTransactions.cursor.page).to.eq(1) + + expect(nextTransactions.transactions.length).to.be.eq( + mockTransactions.next.transfers.data.transfers.length + mockTransactions.next.rewardSlash.data.list.length + ) + expect(nextTransactions.cursor.hasNext).to.be.false + expect(nextTransactions.cursor.page).to.be.undefined + }) + }) +}) diff --git a/packages/acurast/test/v1/protocol.spec.ts b/packages/acurast/test/v1/protocol.spec.ts new file mode 100644 index 00000000..78a9c129 --- /dev/null +++ b/packages/acurast/test/v1/protocol.spec.ts @@ -0,0 +1,364 @@ +// tslint:disable no-floating-promises +import { AirGapTransaction } from '@airgap/module-kit' +import { SubstrateSignedTransaction } from '@airgap/substrate/v1' +import chai = require('chai') +import chaiAsPromised = require('chai-as-promised') +import 'mocha' +import sinon = require('sinon') + +import { TestProtocolSpec } from './implementations' +import { AcurastTestProtocolSpec } from './specs/acurast' + +// use chai-as-promised plugin +chai.use(chaiAsPromised) +const expect = chai.expect + +const protocols = [new AcurastTestProtocolSpec()] + +const itIf = (condition, title, test) => { + return condition ? it(title, test) : it.skip(title, test) +} + +Promise.all( + protocols.map(async (protocol: TestProtocolSpec) => { + const protocolMetadata = await protocol.lib.getMetadata() + + describe(`Protocol ${protocol.name}`, () => { + describe(`KeyPair`, () => { + beforeEach(async () => { + await protocol.stub.registerStub(protocol) + }) + + afterEach(async () => { + sinon.restore() + }) + + it('getKeyPairFromDerivative - should be able to create a key pair from a derivative (extended keys)', async () => { + const { secretKey, publicKey } = await protocol.lib.getKeyPairFromDerivative( + await protocol.derivative(protocol.wallet.derivationPath) + ) + + expect(secretKey).to.deep.equal(protocol.wallet.secretKey) + expect(publicKey).to.deep.equal(protocol.wallet.publicKey) + }) + + it('getAddressFromPublicKey - should be able to create a valid address from a supplied publicKey', async () => { + const { publicKey } = await protocol.lib.getKeyPairFromDerivative(await protocol.derivative(protocol.wallet.derivationPath)) + const address = await protocol.lib.getAddressFromPublicKey(publicKey) + + // check if address format matches + if (protocolMetadata.account?.address?.regex) { + expect(address.match(new RegExp(protocolMetadata.account.address.regex))).not.to.equal(null) + } + + // check if address matches to supplied one + expect(address).to.equal(protocol.wallet.addresses[0], 'address does not match') + }) + }) + + describe(`Prepare Transaction`, () => { + beforeEach(async () => { + await protocol.stub.registerStub(protocol) + }) + + afterEach(async () => { + sinon.restore() + }) + + it('prepareTransactionWithPublicKey - Is able to prepare a tx using its public key', async () => { + const preparedTx = await protocol.lib.prepareTransactionWithPublicKey( + protocol.wallet.publicKey, + [ + { + to: protocol.txs[0].to[0], + amount: protocol.txs[0].amount + } + ], + { fee: protocol.txs[0].fee } + ) + + protocol.txs.forEach((tx) => { + expect(preparedTx).to.deep.include(tx.unsignedTx) + }) + }) + + it('prepareTransactionWithPublicKey - Is able to prepare a transaction with amount 0', async () => { + // should not throw an exception when trying to create a 0 TX, given enough funds are available for the gas + try { + await protocol.lib.prepareTransactionWithPublicKey( + protocol.wallet.publicKey, + [ + { + to: protocol.txs[0].to[0], + amount: { value: '0', unit: 'blockchain' } + } + ], + { fee: protocol.txs[0].fee } + ) + } catch (error) { + throw error + } + + // restore stubs + sinon.restore() + await protocol.stub.noBalanceStub(protocol) + + try { + await protocol.lib.prepareTransactionWithPublicKey( + protocol.wallet.publicKey, + [ + { + to: protocol.txs[0].to[0], + amount: { value: '0', unit: 'blockchain' } + } + ], + { fee: protocol.txs[0].fee } + ) + throw new Error(`should have failed`) + } catch (error) { + expect(error.toString()).to.contain('balance') + } + }) + }) + + describe(`Sign Transaction`, () => { + beforeEach(async () => { + await protocol.stub.registerStub(protocol) + }) + + afterEach(async () => { + sinon.restore() + }) + + it('signTransactionWithSecretKey - Is able to sign a transaction using a SecretKey', async () => { + const { secretKey } = await protocol.lib.getKeyPairFromDerivative(await protocol.derivative(protocol.wallet.derivationPath)) + const txs: SubstrateSignedTransaction[] = [] + + for (const { unsignedTx } of protocol.txs) { + const tx = await protocol.lib.signTransactionWithSecretKey(unsignedTx, secretKey) + txs.push(tx) + } + + for (let index = 0; index < txs.length; index++) { + expect(await protocol.verifySignature(protocol.wallet.publicKey, txs[index])).to.be.true + } + }) + }) + + describe(`Extract TX`, () => { + it('getDetailsFromTransaction - Is able to extract all necessary properties from an unsigned TX', async () => { + for (const tx of protocol.txs) { + const airgapTxs: AirGapTransaction[] = await protocol.lib.getDetailsFromTransaction(tx.unsignedTx, protocol.wallet.publicKey) + + if (airgapTxs.length !== 1) { + throw new Error('Unexpected number of transactions') + } + + const airgapTx: AirGapTransaction = JSON.parse(JSON.stringify(airgapTxs[0])) + + expect(airgapTx.to, 'to property does not match').to.deep.equal(tx.to) + expect(airgapTx.from, 'from property does not match').to.deep.equal(tx.from) + + expect(airgapTx.amount, 'amount does not match').to.deep.equal(protocol.txs[0].amount) + expect(airgapTx.fee, 'fee does not match').to.deep.equal(protocol.txs[0].fee) + + expect(airgapTx.arbitraryData, 'arbitraryDetails should not exist').to.be.undefined + } + }) + + it('getDetailsFromTransaction - Is able to extract all necessary properties from a signed TX', async () => { + for (const tx of protocol.txs) { + const airgapTxs: AirGapTransaction[] = await protocol.lib.getDetailsFromTransaction(tx.unsignedTx, protocol.wallet.publicKey) + + if (airgapTxs.length !== 1) { + throw new Error('Unexpected number of transactions') + } + + const airgapTx: AirGapTransaction = JSON.parse(JSON.stringify(airgapTxs[0])) + expect( + airgapTx.to.map((obj) => obj.toLowerCase()), + 'from' + ).to.deep.equal(tx.to.map((obj) => obj.toLowerCase())) + expect( + airgapTx.from.sort().map((obj) => obj.toLowerCase()), + 'to' + ).to.deep.equal(tx.from.sort().map((obj) => obj.toLowerCase())) + expect(airgapTx.amount).to.deep.equal(protocol.txs[0].amount) + expect(airgapTx.fee).to.deep.equal(protocol.txs[0].fee) + expect(airgapTx.arbitraryData, 'arbitraryDetails should not exist').to.be.undefined + } + }) + + it('should match all valid addresses', async () => { + for (const address of protocol.validAddresses) { + const match = protocolMetadata.account?.address?.regex ? address.match(protocolMetadata.account.address.regex) : false + + expect(match && match.length > 0, `address: ${address}`).to.be.true + } + }) + }) + + describe(`Sign Message`, async () => { + afterEach(async () => { + sinon.restore() + }) + + itIf(protocol.messages.length > 0, 'verifyMessageWithPublicKey - Is able to verify a message using a PublicKey', async () => { + const { publicKey } = await protocol.lib.getKeyPairFromDerivative(await protocol.derivative()) + + for (const messageObject of protocol.messages) { + try { + const signatureIsValid = await protocol.lib.verifyMessageWithPublicKey( + messageObject.message, + messageObject.signature, + publicKey + ) + + expect(signatureIsValid).to.be.true + } catch (e) { + expect(e.message).to.equal('Method not implemented.') + } + } + }) + + itIf( + protocol.messages.length > 0, + 'signMessageWithKeyPair and verifyMessageWithPublicKey - Is able to sign and verify a message', + async () => { + const { secretKey, publicKey } = await protocol.lib.getKeyPairFromDerivative(await protocol.derivative()) + + for (const messageObject of protocol.messages) { + try { + const signature = await protocol.lib.signMessageWithKeyPair(messageObject.message, { + publicKey, + secretKey + }) + const signatureIsValid = await protocol.lib.verifyMessageWithPublicKey(messageObject.message, signature, publicKey) + + expect(signatureIsValid, 'first signature is invalid').to.be.true + + const signature2IsValid = await protocol.lib.verifyMessageWithPublicKey( + `different-message-${messageObject.message}`, + signature, + publicKey + ) + expect(signature2IsValid, 'second signature is invalid').to.be.false + } catch (e) { + expect(e.message).to.equal('Method not implemented.') + } + } + } + ) + }) + + describe(`Encrypt Message Asymmetric`, () => { + afterEach(async () => { + sinon.restore() + }) + + itIf( + protocol.encryptAsymmetric.length > 0, + 'encryptAsymmetricWithPublicKey - Is able to encrypt a message using a PublicKey', + async () => { + // This test probably doesn't serve much of a purpose + const { publicKey } = await protocol.lib.getKeyPairFromDerivative(await protocol.derivative()) + + for (const messageObject of protocol.encryptAsymmetric) { + try { + const encryptedPayload = await protocol.lib.encryptAsymmetricWithPublicKey(messageObject.message, publicKey) + expect(encryptedPayload.length).to.equal(messageObject.encrypted.length) + } catch (e) { + expect(e.message).to.equal('Method not implemented.') + } + } + } + ) + + itIf( + protocol.encryptAsymmetric.length > 0, + 'decryptAsymmetricWithKeyPair - Is able to decrypt a message using a SecretKey', + async () => { + const { secretKey, publicKey } = await protocol.lib.getKeyPairFromDerivative(await protocol.derivative()) + + for (const messageObject of protocol.encryptAsymmetric) { + try { + const decryptedPayload = await protocol.lib.decryptAsymmetricWithKeyPair(messageObject.encrypted, { + publicKey, + secretKey + } as any) + expect(decryptedPayload).to.equal(messageObject.message) + } catch (e) { + expect(e.message).to.equal('Method not implemented.') + } + } + } + ) + + itIf( + protocol.encryptAsymmetric.length > 0, + 'encryptAsymmetricWithPublicKey and decryptAsymmetricWithKeyPair - Is able to encrypt and decrypt a message', + async () => { + const { secretKey, publicKey } = await protocol.lib.getKeyPairFromDerivative(await protocol.derivative()) + + for (const messageObject of protocol.encryptAsymmetric) { + const encryptedPayload = await protocol.lib.encryptAsymmetricWithPublicKey(messageObject.message, publicKey) + + try { + const decryptedPayload = await protocol.lib.decryptAsymmetricWithKeyPair(encryptedPayload, { + publicKey, + secretKey + } as any) + + expect(decryptedPayload).to.equal(messageObject.message) + } catch (e) { + expect(e.message).to.equal('Method not implemented.') + } + } + } + ) + }) + + describe(`Encrypt Message Symmetric`, () => { + afterEach(async () => { + sinon.restore() + }) + + itIf(protocol.encryptAES.length > 0, 'decryptAESWithSecretKey - Is able to encrypt a message using a SecretKey', async () => { + const { secretKey } = await protocol.lib.getKeyPairFromDerivative(await protocol.derivative()) + + for (const messageObject of protocol.encryptAES) { + try { + const decryptedPayload = await protocol.lib.decryptAESWithSecretKey(messageObject.encrypted, secretKey) + expect(decryptedPayload).to.equal(messageObject.message) + } catch (e) { + console.error(e) + expect(e.message).to.equal('Method not implemented.') + } + } + }) + + itIf( + protocol.encryptAES.length > 0, + 'encryptAESWithSecretKey and decryptAESWithSecretKey - Is able to encrypt and decrypt a message', + async () => { + const { secretKey } = await protocol.lib.getKeyPairFromDerivative(await protocol.derivative()) + + for (const messageObject of protocol.encryptAES) { + const encryptedPayload = await protocol.lib.encryptAESWithSecretKey(messageObject.message, secretKey) + + try { + const decryptedPayload = await protocol.lib.decryptAESWithSecretKey(encryptedPayload, secretKey) + + expect(decryptedPayload).to.equal(messageObject.message) + } catch (e) { + expect(e.message).to.equal('Method not implemented.') + } + } + } + ) + }) + }) + }) +).then(() => { + run() +}) diff --git a/packages/acurast/test/v1/specs/acurast.ts b/packages/acurast/test/v1/specs/acurast.ts new file mode 100644 index 00000000..497f48de --- /dev/null +++ b/packages/acurast/test/v1/specs/acurast.ts @@ -0,0 +1,173 @@ +// tslint:disable: no-object-literal-type-assertion +import { Amount, PublicKey, SecretKey } from '@airgap/module-kit' +import { SubstrateSignedTransaction, SubstrateUnsignedTransaction } from '@airgap/substrate/v1' +import { sr25519Verify, waitReady } from '@polkadot/wasm-crypto' + +import { AcurastUnits } from '../../../src/v1' +import { AcurastProtocolImpl } from '../../../src/v1/protocol/AcurastProtocol' +import { TestProtocolSpec } from '../implementations' +import { AcurastProtocolStub } from '../stubs/acurast.stub' + +// Test Mnemonic: food talent voyage degree siege clever account medal film remind good kind +// Derivation path: m/ +// Private Key: d08bc6388fdeb30fc34a8e0286384bd5a84b838222bb9b012fc227d7473fc87aa2913d02297653ce859ccd6b2c057f7e57c9ef6cc359300a891c581fb6d03141 +// Public Key: 52e1d70619678f95a0806fa5eb818fc938cd5f885a19c3fb242d0b0d0620ee10 +// Hex Seed: 55a1417bbfacd64e069b4d07e47fb34ce9ff53b15556698038604f002524aec0 +// Address (Acurast SS58): 5DwNsYGaFEL7ZKBUDLBa6xBg3wbicC2DUeJR2NMr7AM9FaJV +export class AcurastTestProtocolSpec extends TestProtocolSpec { + public name = 'Acurast' + public lib = new AcurastProtocolImpl() + public stub = new AcurastProtocolStub() + + public validAddresses = [ + '5DwNsYGaFEL7ZKBUDLBa6xBg3wbicC2DUeJR2NMr7AM9FaJV', + '5DFMUQiYhjLRo3vLoZLto1uL8bHZBXnEkZG7yRSTA17u68Yk', + '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY', + '5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY', + '5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y', + '5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw', + '5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL', + '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty', + '5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy', + '5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y' + ] + + public wallet = { + secretKey: { + type: 'priv', + format: 'hex', + value: + 'd08bc6388fdeb30fc34a8e0286384bd5a84b838222bb9b012fc227d7473fc87aa2913d02297653ce859ccd6b2c057f7e57c9ef6cc359300a891c581fb6d03141' + } as SecretKey, + publicKey: { + type: 'pub', + format: 'hex', + value: '52e1d70619678f95a0806fa5eb818fc938cd5f885a19c3fb242d0b0d0620ee10' + } as PublicKey, + derivationPath: `m/`, + addresses: ['5DwNsYGaFEL7ZKBUDLBa6xBg3wbicC2DUeJR2NMr7AM9FaJV'] + } + + public txs = [ + { + from: this.wallet.addresses, + to: this.wallet.addresses, + amount: { + value: '1000000000000', + unit: 'blockchain' + } as Amount, + fee: { + value: '1000000000', + unit: 'blockchain' + } as Amount, + unsignedTx: { + type: 'unsigned', + encoded: + // tslint:disable-next-line: prefer-template + '04' + // number of txs + '2106' + // tx length + '01' + // optional type (specVersion) + '1e000000' + // specVersion + '00' + // type + '02286bee' + // fee + // transaction + '4102' + // length + '84' + // signed flag (not signed) + '00' + // MultiAddress type + '52e1d70619678f95a0806fa5eb818fc938cd5f885a19c3fb242d0b0d0620ee10' + // AccountId signer + '00' + // signature type (ed25519) + '0000000000000000000000000000000000000000000000000000000000000000' + // signature + '0000000000000000000000000000000000000000000000000000000000000000' + // signature + '1503' + // era + '08' + // nonce + '00' + // tip + '0a03' + // moduleId + callId + '00' + // MultiAddress type + '52e1d70619678f95a0806fa5eb818fc938cd5f885a19c3fb242d0b0d0620ee10' + // AccountId destination + '070010a5' + // value + // payload + 'd4e8' + // payload length + 'a903' + + Buffer.from( + '0a03' + // moduleId + callId + '00' + // MultiAddress type + '52e1d70619678f95a0806fa5eb818fc938cd5f885a19c3fb242d0b0d0620ee10' + // AccountId destination + '070010a5' + // value + 'd4e8' + // payload length + '1503' + // era + '08' + // nonce + '00' + // tip + '1e000000' + // specVersion + '01000000' + // transactionVersion + 'dfea37d4892a3588124f357ad36eaf545905de18c510c02604bb23354fd2bded' + // genesis hash + '544452e78ab8a42c5a0508de1a57dd36bae940a45201c4f461becc2ca504c33b' // block hash + ).toString('hex') // payload + } as SubstrateUnsignedTransaction, + signedTx: { + type: 'signed', + encoded: + // tslint:disable-next-line: prefer-template + '04' + // number of txs + '2106' + // tx length + '01' + // optional type (specVersion) + '1e000000' + // specVersion + '00' + // type + '02286bee' + // fee + // transaction + '4102' + // length + '84' + // signed flag (signed) + '00' + // MultiAddress type + '52e1d70619678f95a0806fa5eb818fc938cd5f885a19c3fb242d0b0d0620ee10' + // AccountId signer + '01' + // signature type (sr25519) + '86d66b8aa8a49d7b39d8f0da894d68214f276f4051ce5616a6713328e4f0a375' + // signature + '4116106c19f6a514bebce3b5716c7a420a49ad68de9997d705a5be5ed7b5e283' + // signature + '1503' + // era + '08' + // nonce + '00' + // tip + '0a03' + // moduleId + callId + '00' + // MultiAddress type + '52e1d70619678f95a0806fa5eb818fc938cd5f885a19c3fb242d0b0d0620ee10' + // AccountId destination + '070010a5' + // value + // payload + 'd4e8' + // payload length + Buffer.from( + '0a03' + // moduleId + callId + '00' + // MultiAddress type + '52e1d70619678f95a0806fa5eb818fc938cd5f885a19c3fb242d0b0d0620ee10' + // AccountId destination + '070010a5' + // value + '1503' + // era + '08' + // nonce + '00' + // tip + '1e000000' + // specVersion + '01000000' + // transactionVersion + 'dfea37d4892a3588124f357ad36eaf545905de18c510c02604bb23354fd2bded' + // genesis hash + '544452e78ab8a42c5a0508de1a57dd36bae940a45201c4f461becc2ca504c33b' // block hash + ).toString('hex') // payload + } as SubstrateSignedTransaction + } + ] + + public verifySignature = async (publicKey: PublicKey, tx: SubstrateSignedTransaction): Promise => { + await waitReady() + + const decoded = this.lib.transactionController.decodeDetails(tx.encoded)[0] + + const signature = decoded.transaction.signature.signature.value + const payload = Buffer.from(decoded.payload, 'hex') + const publicKeyBuffer = Buffer.from(publicKey.value, 'hex') + + return sr25519Verify(signature, payload, publicKeyBuffer) + } + + public seed(): string { + return '55a1417bbfacd64e069b4d07e47fb34ce9ff53b15556698038604f002524aec0' + } + + public mnemonic(): string { + return 'food talent voyage degree siege clever account medal film remind good kind' + } + + public messages = [] + + public encryptAES = [] +} diff --git a/packages/acurast/test/v1/stubs/acurast.stub.ts b/packages/acurast/test/v1/stubs/acurast.stub.ts new file mode 100644 index 00000000..7827bea8 --- /dev/null +++ b/packages/acurast/test/v1/stubs/acurast.stub.ts @@ -0,0 +1,113 @@ +// tslint:disable: no-object-literal-type-assertion +import axios from '@airgap/coinlib-core/dependencies/src/axios-0.19.0/index' +import BigNumber from '@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber' +import { SubstrateAccountBalance } from '@airgap/substrate/v1' +import * as sinon from 'sinon' + +import { AcurastUnits } from '../../../src/v1' +import { ProtocolHTTPStub, TestProtocolSpec } from '../implementations' + +export class AcurastProtocolStub implements ProtocolHTTPStub { + public async registerStub(testProtocolSpec: TestProtocolSpec): Promise { + sinon + .stub(testProtocolSpec.lib.accountController, 'getBalance') + .withArgs(sinon.match.any) + .returns( + Promise.resolve({ + total: new BigNumber(10000000000000), + existentialDeposit: new BigNumber(0), + transferable: new BigNumber(10000000000000), + transferableCoveringFees: new BigNumber(10000000000000) + } as SubstrateAccountBalance) + ) + + await this.registerDefaultStub(testProtocolSpec) + } + + public async noBalanceStub(testProtocolSpec: TestProtocolSpec): Promise { + sinon + .stub(testProtocolSpec.lib.accountController, 'getBalance') + .withArgs(sinon.match.any) + .returns( + Promise.resolve({ + total: new BigNumber(0), + existentialDeposit: new BigNumber(0), + transferable: new BigNumber(0), + transferableCoveringFees: new BigNumber(0) + } as SubstrateAccountBalance) + ) + + await this.registerDefaultStub(testProtocolSpec) + } + + private async registerDefaultStub(testProtocolSpec: TestProtocolSpec): Promise { + sinon + .stub(testProtocolSpec.lib.nodeClient, 'getTransactionMetadata') + .withArgs('transfer') + .returns(Promise.resolve({ palletIndex: 10, callIndex: 3 })) + + sinon + .stub(testProtocolSpec.lib.nodeClient, 'getTransferFeeEstimate') + .returns(Promise.resolve(new BigNumber(testProtocolSpec.txs[0].fee.value))) + + sinon + .stub(testProtocolSpec.lib.nodeClient, 'getAccountInfo') + .withArgs(sinon.match.any) + .returns( + Promise.resolve({ + nonce: { value: new BigNumber(2) }, + data: { + free: { value: new BigNumber(1000000000000) }, + reserved: { value: new BigNumber(0) }, + miscFrozen: { value: new BigNumber(0) }, + feeFrozen: { value: new BigNumber(0) } + } + }) + ) + + sinon + .stub(testProtocolSpec.lib.nodeClient, 'getFirstBlockHash') + .returns(Promise.resolve('0xdfea37d4892a3588124f357ad36eaf545905de18c510c02604bb23354fd2bded')) + + sinon + .stub(testProtocolSpec.lib.nodeClient, 'getLastBlockHash') + .returns(Promise.resolve('0x544452e78ab8a42c5a0508de1a57dd36bae940a45201c4f461becc2ca504c33b')) + + sinon.stub(testProtocolSpec.lib.nodeClient, 'getCurrentHeight').returns(Promise.resolve(new BigNumber(232241))) + + sinon.stub(testProtocolSpec.lib.nodeClient, 'getRuntimeVersion').returns(Promise.resolve({ specVersion: 30, transactionVersion: 1 })) + } + + public async transactionListStub(testProtocolSpec: TestProtocolSpec, address: string): Promise { + const protocolNetwork = await testProtocolSpec.lib.getNetwork() + + const transactions = testProtocolSpec.transactionList(address) + + sinon + .stub(axios, 'post') + .withArgs(`${protocolNetwork.blockExplorerApi}/transfers`, { + row: transactions.first.transfers.data.transfers.length, + page: 0, + address + }) + .returns(Promise.resolve({ data: transactions.first.transfers })) + .withArgs(`${protocolNetwork.blockExplorerApi}/account/reward_slash`, { + row: transactions.first.transfers.data.transfers.length, + page: 0, + address + }) + .returns(Promise.resolve({ data: transactions.first.rewardSlash })) + .withArgs(`${protocolNetwork.blockExplorerApi}/transfers`, { + row: transactions.next.transfers.data.transfers.length + transactions.next.rewardSlash.data.list.length + 1, + page: 1, + address + }) + .returns(Promise.resolve({ data: transactions.next.transfers })) + .withArgs(`${protocolNetwork.blockExplorerApi}/account/reward_slash`, { + row: transactions.next.transfers.data.transfers.length + transactions.next.rewardSlash.data.list.length + 1, + page: 1, + address + }) + .returns(Promise.resolve({ data: transactions.next.rewardSlash })) + } +} diff --git a/packages/acurast/tsconfig.json b/packages/acurast/tsconfig.json new file mode 100644 index 00000000..81fc71d2 --- /dev/null +++ b/packages/acurast/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "dist/", + "typeRoots": ["../../node_modules/@types", "./node_modules/@types"], + "strict": false + }, + "include": ["src/**/*.ts"], + "exclude": ["src/dependencies/cache/**/*", "src/dependencies/github/**/*"] +} diff --git a/packages/acurast/tslint.json b/packages/acurast/tslint.json new file mode 100644 index 00000000..394d8a23 --- /dev/null +++ b/packages/acurast/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["../../tslint.json"] +} diff --git a/packages/aeternity/package.json b/packages/aeternity/package.json index 104b29ba..1fffa366 100644 --- a/packages/aeternity/package.json +++ b/packages/aeternity/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/aeternity", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/aeternity is an Aeternity implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,9 +30,9 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@stablelib/ed25519": "^1.0.3" }, "localDependencies": {}, diff --git a/packages/astar/package.json b/packages/astar/package.json index 60fd443c..9dc82e8b 100644 --- a/packages/astar/package.json +++ b/packages/astar/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/astar", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/astar is an Astar implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -32,10 +32,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", - "@airgap/substrate": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/substrate": "^0.13.26-beta.0", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" }, diff --git a/packages/bitcoin/package.json b/packages/bitcoin/package.json index 20bae009..4ad7caef 100644 --- a/packages/bitcoin/package.json +++ b/packages/bitcoin/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/bitcoin", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/bitcoin is a Bitcoin implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,10 +30,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "bitcoinjs-lib": "5.2.0" }, "localDependencies": { diff --git a/packages/core/package.json b/packages/core/package.json index 161d6413..331e751b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/coinlib-core", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/coinlib-core is a protocol agnostic library to prepare, sign and broadcast cryptocurrency transactions.", "keywords": [ "airgap", diff --git a/packages/core/src/utils/ProtocolSymbols.ts b/packages/core/src/utils/ProtocolSymbols.ts index 1dcb02c8..7835f402 100644 --- a/packages/core/src/utils/ProtocolSymbols.ts +++ b/packages/core/src/utils/ProtocolSymbols.ts @@ -1,4 +1,5 @@ export enum MainProtocolSymbols { + ACURAST = 'acurast', AE = 'ae', BTC = 'btc', BTC_SEGWIT = 'btc_segwit', diff --git a/packages/coreum/package.json b/packages/coreum/package.json index 88d7c457..20a61a13 100644 --- a/packages/coreum/package.json +++ b/packages/coreum/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/coreum", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/coreum is a Coreum implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,11 +30,11 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/cosmos-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/cosmos-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" }, "nyc": { "include": [ diff --git a/packages/cosmos-core/package.json b/packages/cosmos-core/package.json index 26666ef4..549eefd3 100644 --- a/packages/cosmos-core/package.json +++ b/packages/cosmos-core/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/cosmos-core", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/cosmos-core is a Cosmos base implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,10 +30,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" }, "nyc": { "include": [ diff --git a/packages/cosmos/package.json b/packages/cosmos/package.json index 047ac2d3..8e345ef3 100644 --- a/packages/cosmos/package.json +++ b/packages/cosmos/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/cosmos", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/cosmos is a Cosmos implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,11 +30,11 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/cosmos-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/cosmos-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" }, "localDependencies": {}, "nyc": { diff --git a/packages/crypto/package.json b/packages/crypto/package.json index a40ca25a..1affd19c 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/crypto", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/crypto packages provides common crypto functionalities.", "keywords": [ "airgap", @@ -30,8 +30,8 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", "@airgap/sapling-wasm": "^0.0.9", "@polkadot/wasm-crypto": "0.20.1", "@stablelib/hmac": "^1.0.1" diff --git a/packages/ethereum/package.json b/packages/ethereum/package.json index 5d655191..aaef57bf 100644 --- a/packages/ethereum/package.json +++ b/packages/ethereum/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/ethereum", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/ethereum is an Ethereum implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,10 +30,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@ethereumjs/common": "2.6.5", "@ethereumjs/tx": "3.4.0", "@metamask/eth-sig-util": "4.0.0" diff --git a/packages/groestlcoin/package.json b/packages/groestlcoin/package.json index c48d9b53..cfe503b1 100644 --- a/packages/groestlcoin/package.json +++ b/packages/groestlcoin/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/groestlcoin", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/groestlcoin is a Groestlcoin implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,10 +30,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/bitcoin": "^0.13.25", - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/bitcoin": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" }, "localDependencies": { "groestlcoinjs-message": "2.1.0" diff --git a/packages/icp/package.json b/packages/icp/package.json index 6c5415e5..ed939e72 100644 --- a/packages/icp/package.json +++ b/packages/icp/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/icp", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/icp is an ICP implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,10 +30,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@dfinity/agent": "^0.15.4", "@dfinity/identity-secp256k1": "^0.15.4", "@dfinity/nns": "^0.14.0", diff --git a/packages/icp/test/stubs/icp.stub.ts b/packages/icp/test/stubs/icp.stub.ts index 00f91b12..f23583cd 100644 --- a/packages/icp/test/stubs/icp.stub.ts +++ b/packages/icp/test/stubs/icp.stub.ts @@ -18,7 +18,6 @@ export class ICPProtocolStub implements ProtocolHTTPStub(10000000000000000000, 'blockchain') } as Balance) ) - sinon .stub(axios, 'post') .withArgs(`/v2/transactions`) diff --git a/packages/mina/package.json b/packages/mina/package.json index ea0c889b..42711361 100644 --- a/packages/mina/package.json +++ b/packages/mina/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/mina", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/mina is a Mina implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,10 +30,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "graphql": "^16.7.1", "graphql-request": "^6.1.0", "mina-signer": "^2.0.3" diff --git a/packages/module-kit/package.json b/packages/module-kit/package.json index e050d87f..8b741be3 100644 --- a/packages/module-kit/package.json +++ b/packages/module-kit/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/module-kit", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/module-kit package provides the common interfaces and functionalities to implement AirGap modules.", "keywords": [ "airgap", @@ -29,8 +29,8 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/serializer": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0" }, "nyc": { "include": [ diff --git a/packages/moonbeam/package.json b/packages/moonbeam/package.json index 792f768a..c0676985 100644 --- a/packages/moonbeam/package.json +++ b/packages/moonbeam/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/moonbeam", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/moonbeam is a Moonbeam implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -32,10 +32,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", - "@airgap/substrate": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/substrate": "^0.13.26-beta.0" }, "localDependencies": {}, "nyc": { diff --git a/packages/optimism/package.json b/packages/optimism/package.json index 698882ca..d459e6c9 100644 --- a/packages/optimism/package.json +++ b/packages/optimism/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/optimism", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/optimism is an Optimism implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -31,11 +31,11 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/ethereum": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/ethereum": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@ethereumjs/tx": "3.4.0" }, "nyc": { diff --git a/packages/polkadot/package.json b/packages/polkadot/package.json index 5f8bf724..ee140acd 100644 --- a/packages/polkadot/package.json +++ b/packages/polkadot/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/polkadot", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/polkadot is a Polkadot implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -32,9 +32,9 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/substrate": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/substrate": "^0.13.26-beta.0" }, "devDependencies": { "@polkadot/wasm-crypto": "0.20.1" diff --git a/packages/serializer/package.json b/packages/serializer/package.json index 3b6485c9..e0ca59ec 100644 --- a/packages/serializer/package.json +++ b/packages/serializer/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/serializer", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/serializer provides serializers used in AirGap applications.", "keywords": [ "airgap", @@ -37,7 +37,7 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0" }, "localDependencies": {}, "nyc": { diff --git a/packages/substrate/package.json b/packages/substrate/package.json index 1a66ab33..618e54bd 100644 --- a/packages/substrate/package.json +++ b/packages/substrate/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/substrate", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/substrate is a Substrate base implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -32,10 +32,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", - "@airgap/serializer": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26-beta.0", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" }, diff --git a/packages/tezos/package.json b/packages/tezos/package.json index e3287780..4472a9fc 100644 --- a/packages/tezos/package.json +++ b/packages/tezos/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/tezos", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/tezos is a Tezos implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,11 +30,11 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/crypto": "^0.13.25", - "@airgap/module-kit": "^0.13.25", + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/crypto": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0", "@airgap/sapling-wasm": "0.0.7", - "@airgap/serializer": "^0.13.25", + "@airgap/serializer": "^0.13.26-beta.0", "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 228281f4..194efdea 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/wallet", - "version": "0.13.25", + "version": "0.13.26-beta.0", "description": "The @airgap/wallet package provides interfaces for offline/online wallet functionalities.", "keywords": [ "airgap" @@ -27,8 +27,8 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.25", - "@airgap/module-kit": "^0.13.25" + "@airgap/coinlib-core": "^0.13.26-beta.0", + "@airgap/module-kit": "^0.13.26-beta.0" }, "nyc": { "include": [ diff --git a/scripts/generate-schemas.sh b/scripts/generate-schemas.sh index 12988639..7960505f 100755 --- a/scripts/generate-schemas.sh +++ b/scripts/generate-schemas.sh @@ -19,6 +19,10 @@ # node_modules/.bin/ts-json-schema-generator --path 'packages/astar/src/v1/serializer/v3/schemas/definitions/transaction-sign-response-astar.ts' --tsconfig 'tsconfig.json' -c > packages/astar/src/v1/serializer/v3/schemas/generated/transaction-sign-response-astar.json # node_modules/.bin/ts-json-schema-generator --path 'packages/astar/src/v1/serializer/v3/schemas/definitions/transaction-sign-request-astar.ts' --tsconfig 'tsconfig.json' -c > packages/astar/src/v1/serializer/v3/schemas/generated/transaction-sign-request-astar.json +# Acurast +# node_modules/.bin/ts-json-schema-generator --path 'packages/acurast/src/v1/serializer/v3/schemas/definitions/transaction-sign-response-acurast.ts' --tsconfig 'tsconfig.json' -c > packages/acurast/src/v1/serializer/v3/schemas/generated/transaction-sign-response-acurast.json +# node_modules/.bin/ts-json-schema-generator --path 'packages/acurast/src/v1/serializer/v3/schemas/definitions/transaction-sign-request-acurast.ts' --tsconfig 'tsconfig.json' -c > packages/acurast/src/v1/serializer/v3/schemas/generated/transaction-sign-request-acurast.json + # Bitcoin # node_modules/.bin/ts-json-schema-generator --path 'packages/bitcoin/src/v0/types/signed-transaction-bitcoin-segwit.ts' --tsconfig 'tsconfig.json' > packages/bitcoin/src/v0/serializer/schemas/v3/transaction-sign-response-bitcoin-segwit.json # node_modules/.bin/ts-json-schema-generator --path 'packages/bitcoin/src/v0/types/signed-transaction-bitcoin.ts' --tsconfig 'tsconfig.json' > packages/bitcoin/src/v0/serializer/schemas/v3/transaction-sign-response-bitcoin.json From dab45a8cf4c2532237b3e3b779344121e81c76e3 Mon Sep 17 00:00:00 2001 From: Stephen Debel Date: Mon, 29 Apr 2024 16:50:05 +0200 Subject: [PATCH 4/5] fix/cosmos-tx * fix/cosmos-tx --- packages/cosmos-core/src/v1/node/CosmosNodeClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cosmos-core/src/v1/node/CosmosNodeClient.ts b/packages/cosmos-core/src/v1/node/CosmosNodeClient.ts index 35843036..6e6e8e61 100644 --- a/packages/cosmos-core/src/v1/node/CosmosNodeClient.ts +++ b/packages/cosmos-core/src/v1/node/CosmosNodeClient.ts @@ -55,7 +55,7 @@ export class CosmosNodeClient { this.url( `/cosmos/tx/v1beta1/txs?events=${ isSender ? 'transfer.sender' : 'transfer.recipient' - }='${address}'&pagination.limit=${limit}&pagination.offset=${offset}&orderBy=2` + }='${address}'&events=tx.height=0&pagination.limit=${limit}&pagination.offset=${offset}&orderBy=2` ) ) From 587fe3e726ea5d77eb0ea52e0d910006bfaa9cee Mon Sep 17 00:00:00 2001 From: Isacco Sordo Date: Wed, 29 May 2024 09:54:28 +0200 Subject: [PATCH 5/5] chore: version bump * chore: version bump --- lerna.json | 2 +- package-lock.json | 330 +++++++++++++++--------------- packages/acurast/package.json | 10 +- packages/aeternity/package.json | 8 +- packages/astar/package.json | 10 +- packages/bitcoin/package.json | 10 +- packages/core/package.json | 2 +- packages/coreum/package.json | 12 +- packages/cosmos-core/package.json | 10 +- packages/cosmos/package.json | 12 +- packages/crypto/package.json | 6 +- packages/ethereum/package.json | 10 +- packages/groestlcoin/package.json | 10 +- packages/icp/package.json | 10 +- packages/mina/package.json | 10 +- packages/module-kit/package.json | 6 +- packages/moonbeam/package.json | 10 +- packages/optimism/package.json | 12 +- packages/polkadot/package.json | 8 +- packages/serializer/package.json | 4 +- packages/substrate/package.json | 10 +- packages/tezos/package.json | 10 +- packages/wallet/package.json | 6 +- 23 files changed, 259 insertions(+), 259 deletions(-) diff --git a/lerna.json b/lerna.json index b369ff32..1b83ece3 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.13.26-beta.0", + "version": "0.13.26", "useWorkspaces": true, "command": { "publish": { diff --git a/package-lock.json b/package-lock.json index 237ac2cd..b6fd9604 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10655,50 +10655,50 @@ }, "packages/acurast": { "name": "@airgap/acurast", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", - "@airgap/substrate": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", + "@airgap/substrate": "^0.13.26", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" } }, "packages/aeternity": { "name": "@airgap/aeternity", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@stablelib/ed25519": "^1.0.3" } }, "packages/astar": { "name": "@airgap/astar", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", - "@airgap/substrate": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", + "@airgap/substrate": "^0.13.26", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" } }, "packages/bitcoin": { "name": "@airgap/bitcoin", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "bitcoinjs-lib": "5.2.0" } }, @@ -10833,7 +10833,7 @@ }, "packages/core": { "name": "@airgap/coinlib-core", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { "@stablelib/blake2b": "^1.0.1", @@ -10997,46 +10997,46 @@ }, "packages/coreum": { "name": "@airgap/coreum", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/cosmos-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/cosmos-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26" } }, "packages/cosmos": { "name": "@airgap/cosmos", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/cosmos-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/cosmos-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26" } }, "packages/cosmos-core": { "name": "@airgap/cosmos-core", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26" } }, "packages/crypto": { "name": "@airgap/crypto", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", "@airgap/sapling-wasm": "^0.0.9", "@polkadot/wasm-crypto": "0.20.1", "@stablelib/hmac": "^1.0.1" @@ -11044,13 +11044,13 @@ }, "packages/ethereum": { "name": "@airgap/ethereum", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@ethereumjs/common": "2.6.5", "@ethereumjs/tx": "3.4.0", "@metamask/eth-sig-util": "4.0.0" @@ -11058,24 +11058,24 @@ }, "packages/groestlcoin": { "name": "@airgap/groestlcoin", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/bitcoin": "^0.13.26-beta.0", - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/bitcoin": "^0.13.26", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26" } }, "packages/icp": { "name": "@airgap/icp", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@dfinity/agent": "^0.15.4", "@dfinity/identity-secp256k1": "^0.15.4", "@dfinity/nns": "^0.14.0", @@ -11121,13 +11121,13 @@ }, "packages/mina": { "name": "@airgap/mina", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "graphql": "^16.7.1", "graphql-request": "^6.1.0", "mina-signer": "^2.0.3" @@ -11135,45 +11135,45 @@ }, "packages/module-kit": { "name": "@airgap/module-kit", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/serializer": "^0.13.26" } }, "packages/moonbeam": { "name": "@airgap/moonbeam", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", - "@airgap/substrate": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", + "@airgap/substrate": "^0.13.26" } }, "packages/optimism": { "name": "@airgap/optimism", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/ethereum": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/ethereum": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@ethereumjs/tx": "3.4.0" } }, "packages/polkadot": { "name": "@airgap/polkadot", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/substrate": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/substrate": "^0.13.26" }, "devDependencies": { "@polkadot/wasm-crypto": "0.20.1" @@ -11181,35 +11181,35 @@ }, "packages/serializer": { "name": "@airgap/serializer", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26" } }, "packages/substrate": { "name": "@airgap/substrate", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" } }, "packages/tezos": { "name": "@airgap/tezos", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", "@airgap/sapling-wasm": "0.0.7", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26", "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", @@ -11410,11 +11410,11 @@ }, "packages/wallet": { "name": "@airgap/wallet", - "version": "0.13.26-beta.0", + "version": "0.13.26", "license": "MIT", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26" } } }, @@ -11422,10 +11422,10 @@ "@airgap/acurast": { "version": "file:packages/acurast", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", - "@airgap/substrate": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", + "@airgap/substrate": "^0.13.26", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" } @@ -11433,19 +11433,19 @@ "@airgap/aeternity": { "version": "file:packages/aeternity", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@stablelib/ed25519": "^1.0.3" } }, "@airgap/astar": { "version": "file:packages/astar", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", - "@airgap/substrate": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", + "@airgap/substrate": "^0.13.26", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" } @@ -11453,10 +11453,10 @@ "@airgap/bitcoin": { "version": "file:packages/bitcoin", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "bitcoinjs-lib": "5.2.0" }, "dependencies": { @@ -11702,37 +11702,37 @@ "@airgap/coreum": { "version": "file:packages/coreum", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/cosmos-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/cosmos-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26" } }, "@airgap/cosmos": { "version": "file:packages/cosmos", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/cosmos-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/cosmos-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26" } }, "@airgap/cosmos-core": { "version": "file:packages/cosmos-core", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26" } }, "@airgap/crypto": { "version": "file:packages/crypto", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", "@airgap/sapling-wasm": "^0.0.9", "@polkadot/wasm-crypto": "0.20.1", "@stablelib/hmac": "^1.0.1" @@ -11741,10 +11741,10 @@ "@airgap/ethereum": { "version": "file:packages/ethereum", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@ethereumjs/common": "2.6.5", "@ethereumjs/tx": "3.4.0", "@metamask/eth-sig-util": "4.0.0" @@ -11753,19 +11753,19 @@ "@airgap/groestlcoin": { "version": "file:packages/groestlcoin", "requires": { - "@airgap/bitcoin": "^0.13.26-beta.0", - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/bitcoin": "^0.13.26", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26" } }, "@airgap/icp": { "version": "file:packages/icp", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@dfinity/agent": "^0.15.4", "@dfinity/identity-secp256k1": "^0.15.4", "@dfinity/nns": "^0.14.0", @@ -11806,10 +11806,10 @@ "@airgap/mina": { "version": "file:packages/mina", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "graphql": "^16.7.1", "graphql-request": "^6.1.0", "mina-signer": "^2.0.3" @@ -11818,36 +11818,36 @@ "@airgap/module-kit": { "version": "file:packages/module-kit", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/serializer": "^0.13.26" } }, "@airgap/moonbeam": { "version": "file:packages/moonbeam", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", - "@airgap/substrate": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", + "@airgap/substrate": "^0.13.26" } }, "@airgap/optimism": { "version": "file:packages/optimism", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/ethereum": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/ethereum": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@ethereumjs/tx": "3.4.0" } }, "@airgap/polkadot": { "version": "file:packages/polkadot", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/substrate": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/substrate": "^0.13.26", "@polkadot/wasm-crypto": "0.20.1" } }, @@ -11857,16 +11857,16 @@ "@airgap/serializer": { "version": "file:packages/serializer", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26" } }, "@airgap/substrate": { "version": "file:packages/substrate", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" } @@ -11874,11 +11874,11 @@ "@airgap/tezos": { "version": "file:packages/tezos", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", "@airgap/sapling-wasm": "0.0.7", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26", "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", @@ -12018,8 +12018,8 @@ "@airgap/wallet": { "version": "file:packages/wallet", "requires": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26" } }, "@babel/code-frame": { diff --git a/packages/acurast/package.json b/packages/acurast/package.json index f9024169..a167b351 100644 --- a/packages/acurast/package.json +++ b/packages/acurast/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/acurast", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/acurast is an Acurast implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -31,10 +31,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", - "@airgap/substrate": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", + "@airgap/substrate": "^0.13.26", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" }, diff --git a/packages/aeternity/package.json b/packages/aeternity/package.json index 1fffa366..40c3550b 100644 --- a/packages/aeternity/package.json +++ b/packages/aeternity/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/aeternity", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/aeternity is an Aeternity implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,9 +30,9 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@stablelib/ed25519": "^1.0.3" }, "localDependencies": {}, diff --git a/packages/astar/package.json b/packages/astar/package.json index 9dc82e8b..43f38a4c 100644 --- a/packages/astar/package.json +++ b/packages/astar/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/astar", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/astar is an Astar implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -32,10 +32,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", - "@airgap/substrate": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", + "@airgap/substrate": "^0.13.26", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" }, diff --git a/packages/bitcoin/package.json b/packages/bitcoin/package.json index 4ad7caef..199a051e 100644 --- a/packages/bitcoin/package.json +++ b/packages/bitcoin/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/bitcoin", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/bitcoin is a Bitcoin implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,10 +30,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "bitcoinjs-lib": "5.2.0" }, "localDependencies": { diff --git a/packages/core/package.json b/packages/core/package.json index 331e751b..40284158 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/coinlib-core", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/coinlib-core is a protocol agnostic library to prepare, sign and broadcast cryptocurrency transactions.", "keywords": [ "airgap", diff --git a/packages/coreum/package.json b/packages/coreum/package.json index 20a61a13..3daaf4f4 100644 --- a/packages/coreum/package.json +++ b/packages/coreum/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/coreum", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/coreum is a Coreum implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,11 +30,11 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/cosmos-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/cosmos-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26" }, "nyc": { "include": [ diff --git a/packages/cosmos-core/package.json b/packages/cosmos-core/package.json index 549eefd3..09c6ffef 100644 --- a/packages/cosmos-core/package.json +++ b/packages/cosmos-core/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/cosmos-core", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/cosmos-core is a Cosmos base implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,10 +30,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26" }, "nyc": { "include": [ diff --git a/packages/cosmos/package.json b/packages/cosmos/package.json index 8e345ef3..394ab7ad 100644 --- a/packages/cosmos/package.json +++ b/packages/cosmos/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/cosmos", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/cosmos is a Cosmos implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,11 +30,11 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/cosmos-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/cosmos-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26" }, "localDependencies": {}, "nyc": { diff --git a/packages/crypto/package.json b/packages/crypto/package.json index 1affd19c..838aa637 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/crypto", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/crypto packages provides common crypto functionalities.", "keywords": [ "airgap", @@ -30,8 +30,8 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", "@airgap/sapling-wasm": "^0.0.9", "@polkadot/wasm-crypto": "0.20.1", "@stablelib/hmac": "^1.0.1" diff --git a/packages/ethereum/package.json b/packages/ethereum/package.json index aaef57bf..2caea446 100644 --- a/packages/ethereum/package.json +++ b/packages/ethereum/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/ethereum", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/ethereum is an Ethereum implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,10 +30,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@ethereumjs/common": "2.6.5", "@ethereumjs/tx": "3.4.0", "@metamask/eth-sig-util": "4.0.0" diff --git a/packages/groestlcoin/package.json b/packages/groestlcoin/package.json index cfe503b1..e3377b5c 100644 --- a/packages/groestlcoin/package.json +++ b/packages/groestlcoin/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/groestlcoin", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/groestlcoin is a Groestlcoin implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,10 +30,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/bitcoin": "^0.13.26-beta.0", - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/bitcoin": "^0.13.26", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26" }, "localDependencies": { "groestlcoinjs-message": "2.1.0" diff --git a/packages/icp/package.json b/packages/icp/package.json index ed939e72..fd683d0a 100644 --- a/packages/icp/package.json +++ b/packages/icp/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/icp", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/icp is an ICP implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,10 +30,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@dfinity/agent": "^0.15.4", "@dfinity/identity-secp256k1": "^0.15.4", "@dfinity/nns": "^0.14.0", diff --git a/packages/mina/package.json b/packages/mina/package.json index 42711361..c2ac408b 100644 --- a/packages/mina/package.json +++ b/packages/mina/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/mina", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/mina is a Mina implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,10 +30,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "graphql": "^16.7.1", "graphql-request": "^6.1.0", "mina-signer": "^2.0.3" diff --git a/packages/module-kit/package.json b/packages/module-kit/package.json index 8b741be3..b235baf0 100644 --- a/packages/module-kit/package.json +++ b/packages/module-kit/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/module-kit", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/module-kit package provides the common interfaces and functionalities to implement AirGap modules.", "keywords": [ "airgap", @@ -29,8 +29,8 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/serializer": "^0.13.26" }, "nyc": { "include": [ diff --git a/packages/moonbeam/package.json b/packages/moonbeam/package.json index c0676985..82c42b2c 100644 --- a/packages/moonbeam/package.json +++ b/packages/moonbeam/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/moonbeam", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/moonbeam is a Moonbeam implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -32,10 +32,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", - "@airgap/substrate": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", + "@airgap/substrate": "^0.13.26" }, "localDependencies": {}, "nyc": { diff --git a/packages/optimism/package.json b/packages/optimism/package.json index d459e6c9..a729aa1a 100644 --- a/packages/optimism/package.json +++ b/packages/optimism/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/optimism", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/optimism is an Optimism implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -31,11 +31,11 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/ethereum": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/ethereum": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@ethereumjs/tx": "3.4.0" }, "nyc": { diff --git a/packages/polkadot/package.json b/packages/polkadot/package.json index ee140acd..9c6108c7 100644 --- a/packages/polkadot/package.json +++ b/packages/polkadot/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/polkadot", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/polkadot is a Polkadot implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -32,9 +32,9 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/substrate": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/substrate": "^0.13.26" }, "devDependencies": { "@polkadot/wasm-crypto": "0.20.1" diff --git a/packages/serializer/package.json b/packages/serializer/package.json index e0ca59ec..1f4ea728 100644 --- a/packages/serializer/package.json +++ b/packages/serializer/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/serializer", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/serializer provides serializers used in AirGap applications.", "keywords": [ "airgap", @@ -37,7 +37,7 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26" }, "localDependencies": {}, "nyc": { diff --git a/packages/substrate/package.json b/packages/substrate/package.json index 618e54bd..9066b5c3 100644 --- a/packages/substrate/package.json +++ b/packages/substrate/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/substrate", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/substrate is a Substrate base implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -32,10 +32,10 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", + "@airgap/serializer": "^0.13.26", "@polkadot/util": "2.0.1", "@polkadot/wasm-crypto": "0.20.1" }, diff --git a/packages/tezos/package.json b/packages/tezos/package.json index 4472a9fc..a0b67f10 100644 --- a/packages/tezos/package.json +++ b/packages/tezos/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/tezos", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/tezos is a Tezos implementation of the ICoinProtocol interface from @airgap/coinlib-core.", "keywords": [ "airgap", @@ -30,11 +30,11 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/crypto": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0", + "@airgap/coinlib-core": "^0.13.26", + "@airgap/crypto": "^0.13.26", + "@airgap/module-kit": "^0.13.26", "@airgap/sapling-wasm": "0.0.7", - "@airgap/serializer": "^0.13.26-beta.0", + "@airgap/serializer": "^0.13.26", "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 194efdea..5e09d7ab 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/wallet", - "version": "0.13.26-beta.0", + "version": "0.13.26", "description": "The @airgap/wallet package provides interfaces for offline/online wallet functionalities.", "keywords": [ "airgap" @@ -27,8 +27,8 @@ }, "author": "Papers AG (https://papers.ch)", "dependencies": { - "@airgap/coinlib-core": "^0.13.26-beta.0", - "@airgap/module-kit": "^0.13.26-beta.0" + "@airgap/coinlib-core": "^0.13.26", + "@airgap/module-kit": "^0.13.26" }, "nyc": { "include": [