diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz index 84b0055..d9f078a 100644 Binary files a/.yarn/install-state.gz and b/.yarn/install-state.gz differ diff --git a/README.md b/README.md index 627fd9e..eb27e8f 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,14 @@ Run the following command to install the necessary dependencies: yarn # Please use yarn to install dependencies due to the use of Yarn Workspace ``` -### Running Foundational Tests +### Maintaining dependencies across packages +The packages are referring each other by source code, so when one is updated, the new version will be used by other packages. For example, ./packages/sdk/package.json has the following dependency: +``` +"@oak-network/adapter": "../adapter", +"@oak-network/config": "../config" +``` + +### Running Functional Tests By default, the tests are configured to target your local development environment. Before running any commands, please follow the steps in the [Quickstart: run Local Network with Zombienet](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9946#/accounts) guide to build and run a local relay chain and parachain. Once the Turing Dev network is running, you should be able to see it on [polkadot.js.org/apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9946#/accounts). diff --git a/packages/adapter/package.json b/packages/adapter/package.json index c3ecd84..9260b93 100644 --- a/packages/adapter/package.json +++ b/packages/adapter/package.json @@ -8,10 +8,12 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@oak-network/config": "workspace:^1.0.0", + "@oak-network/config": "../config", "@polkadot/api": "^10.9.1", + "@polkadot/keyring": "^12.6.1", "@polkadot/types": "^10.11.1", "@polkadot/util": "^12.6.1", + "@polkadot/util-crypto": "^12.6.1", "bn.js": "^5.2.1", "lodash": "^4.17.21", "web3-validator": "^2.0.3" diff --git a/packages/adapter/src/chains/oak.ts b/packages/adapter/src/chains/oak.ts index 926c31c..9ffd695 100644 --- a/packages/adapter/src/chains/oak.ts +++ b/packages/adapter/src/chains/oak.ts @@ -6,11 +6,23 @@ import type { SubmittableExtrinsic, AddressOrPair } from "@polkadot/api/types"; import type { u32, u128, Option } from "@polkadot/types"; import type { WeightV2 } from "@polkadot/types/interfaces"; import type { KeyringPair } from "@polkadot/keyring/types"; -import { Weight, XcmInstructionNetworkType } from "@oak-network/config"; +import { + Weight, + XcmInstructionNetworkType, + Chain, + XToken, +} from "@oak-network/config"; +import { ISubmittableResult } from "@polkadot/types/types"; import { ChainAdapter } from "./chainAdapter"; -import { getDerivativeAccountV2, sendExtrinsic } from "../util"; -import { SendExtrinsicResult } from "../types"; +import { + getDerivativeAccountV2, + isValidAddress, + sendExtrinsic, + getDecimalBN, +} from "../util"; +import { AccountType, SendExtrinsicResult } from "../types"; import { WEIGHT_REF_TIME_PER_SECOND } from "../constants"; +import { InvalidAddress } from "../errors"; export interface AutomationPriceTriggerParams { chain: string; @@ -105,6 +117,61 @@ export class OakAdapter extends ChainAdapter { .div(WEIGHT_REF_TIME_PER_SECOND); } + /** + * + * @param destConfig + * @param token The key of the Asset such as "tur", or "sdn" + * @param recipient + * @param amount + * @returns + */ + public transferMultiasset( + destConfig: Chain, + token: string, + recipient: string, + amount: string | number, + ): + | SubmittableExtrinsic<"promise", ISubmittableResult> + | SubmittableExtrinsic<"rxjs", ISubmittableResult> + | undefined { + const asset = _.find(this.chainConfig.assets, (item) => item.key === token); + if (_.isUndefined(asset)) throw new Error(`Asset ${token} not found`); + + const amountBN = new BN(amount).mul(getDecimalBN(asset.decimals)); + + const accountId = destConfig.isEthereum + ? { [AccountType.AccountKey20]: { key: recipient, network: null } } + : { [AccountType.AccountId32]: { id: recipient, network: null } }; + + if (!isValidAddress(recipient, destConfig.isEthereum)) { + throw new InvalidAddress(recipient); + } + + // const weightLimit: XcmV3WeightLimit = { isUnlimited: true }; + + return this.api?.tx.xTokens.transferMultiasset( + { + V3: { + fun: { Fungible: amountBN }, + id: { Concrete: asset.location }, + }, + }, + { + V3: { + interior: { + X2: [{ Parachain: destConfig.paraId }, accountId], + }, + parents: 1, + }, + }, + "Unlimited", + ); + } + + public getAssetBySymbol(symbol: string): XToken | undefined { + return _.find(this.chainConfig.assets, (asset) => asset.symbol === symbol); + } + /** * Execute a cross-chain transfer * @param destination The location of the destination chain @@ -125,6 +192,11 @@ export class OakAdapter extends ChainAdapter { if (_.isUndefined(key)) throw new Error("chainConfig.key not set"); const api = this.getApi(); + // if isEthereum accountId20: {key: recipient, network: null} + // if (!validateAddress(address, useAccountKey20 ? "ethereum" : "substract")) { + // throw new InvalidAddress(address); + // } + const extrinsic = api.tx.xTokens.transferMultiasset( { V3: { diff --git a/packages/adapter/src/util.ts b/packages/adapter/src/util.ts index 7f759d0..169c638 100644 --- a/packages/adapter/src/util.ts +++ b/packages/adapter/src/util.ts @@ -5,7 +5,13 @@ import { KeyringPair } from "@polkadot/keyring/types"; import type { SubmittableExtrinsic } from "@polkadot/api/types"; import type { HexString } from "@polkadot/util/types"; import { TypeRegistry } from "@polkadot/types"; -import { blake2AsU8a } from "@polkadot/util-crypto"; +import { + blake2AsU8a, + encodeAddress, + decodeAddress, +} from "@polkadot/util-crypto"; +import { isAddress as isEthereumAddress } from "web3-validator"; +import BN from "bn.js"; import { AccountType, SendExtrinsicResult } from "./types"; /** @@ -58,7 +64,7 @@ export const sendExtrinsic = async ( ); if (status.isFinalized) { - resolve({ events, blockHash: status.asFinalized.toString() }); + resolve({ blockHash: status.asFinalized.toString(), events }); } } }, @@ -80,13 +86,13 @@ export const getDerivativeAccountV2 = ( { locationType = "XcmV2MultiLocation", network = "Any" } = {}, ): HexString => { const account = - hexToU8a(accountId).length == 20 - ? { AccountKey20: { network, key: accountId } } - : { AccountId32: { network, id: accountId } }; + hexToU8a(accountId).length === 20 + ? { AccountKey20: { key: accountId, network } } + : { AccountId32: { id: accountId, network } }; const location = { - parents: 1, interior: { X2: [{ Parachain: paraId }, account] }, + parents: 1, }; const multilocation = api.createType(locationType, location); const toHash = new Uint8Array([ @@ -111,7 +117,7 @@ export const getDerivativeAccountV3 = ( deriveAccountType: AccountType = AccountType.AccountId32, ): HexString => { const accountType = - hexToU8a(accountId).length == 20 ? "AccountKey20" : "AccountId32"; + hexToU8a(accountId).length === 20 ? "AccountKey20" : "AccountId32"; const decodedAddress = hexToU8a(accountId); // Calculate Hash Component @@ -148,9 +154,9 @@ export const getDerivativeAccountV3 = ( export function convertAbsoluteLocationToRelative(absoluteLocation: any): any { const { interior } = absoluteLocation; const key = _.keys(interior)[0] as string; - const sectionCount = parseInt(key.substring(1)); + const sectionCount = parseInt(key.substring(1), 10); if (sectionCount === 1) { - return { parents: 0, interior: "Here" }; + return { interior: "Here", parents: 0 }; } const newInterior: Record = {}; const newArray = interior[key].filter( @@ -160,5 +166,31 @@ export function convertAbsoluteLocationToRelative(absoluteLocation: any): any { const newXKey = `X${newArray.length}`; newInterior[newXKey] = newArray.length === 1 ? newArray[0] : newArray; } - return { parents: 0, interior: newInterior }; + return { interior: newInterior, parents: 0 }; +} + +function isSubstrateAddress(address: string) { + try { + encodeAddress(decodeAddress(address)); + + return true; + } catch (e) { + // ignore error + } + + return false; +} + +export function isValidAddress(address: string, isEthereum: boolean) { + return isEthereum ? isEthereumAddress(address) : isSubstrateAddress(address); +} + +/** + * Return a BN object for the power of 10, for example getDecimalBN(10) returns new BN(10,000,000,000) + * @param {*} decimals The decimals number of a token + */ +export function getDecimalBN(decimals: number | string) { + const base = new BN(10, 10); + const power = new BN(decimals, 10); + return base.pow(power); } diff --git a/packages/config/package.json b/packages/config/package.json index 1b56864..bc46892 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -4,6 +4,14 @@ "license": "Apache-2.0", "main": "./build/index.js", "scripts": { - "build": "tsc" + "build": "tsc --build", + "clean": "tsc --build --clean" + }, + "devDependencies": { + "@types/bn.js": "^5", + "typescript": "^5.3.2" + }, + "dependencies": { + "bn.js": "^5.2.1" } } diff --git a/packages/config/src/chains/dev.ts b/packages/config/src/chains/dev.ts index 8edb8db..e747737 100644 --- a/packages/config/src/chains/dev.ts +++ b/packages/config/src/chains/dev.ts @@ -4,57 +4,60 @@ import { createChain } from "./types/Chain"; import { DevTokens } from "../tokens"; const shibuya = createChain({ - key: "shibuya", - name: "Shibuya", - assets: [{ asset: DevTokens.sby, isNative: true }], - endpoint: "ws://127.0.0.1:9948", - relayChain: "local", - xcm: { - network: "rococo", - instructionWeight: new Weight(new BN("1000000000"), new BN(64 * 1024)), - }, + assets: [{ asset: DevTokens.sby, isNative: true }], + endpoint: "ws://127.0.0.1:9948", + isEthereum: true, + key: "shibuya", + name: "Shibuya", + relayChain: "local", + xcm: { + instructionWeight: new Weight(new BN("1000000000"), new BN(64 * 1024)), + network: "rococo", + }, }); const turingLocal = createChain({ - key: "turing-local", - name: "Turing Local", - assets: [ - { asset: DevTokens.tur, isNative: true }, - { asset: DevTokens.sby, isNative: false }, - ], - endpoint: "ws://127.0.0.1:9946", - relayChain: "local", - xcm: { - network: "rococo", - instructionWeight: new Weight(new BN("1000000000"), new BN(0)), - }, + assets: [ + { asset: DevTokens.tur, isNative: true }, + { asset: DevTokens.sby, isNative: false }, + ], + endpoint: "ws://127.0.0.1:9946", + key: "turing-local", + name: "Turing Local", + relayChain: "local", + xcm: { + instructionWeight: new Weight(new BN("1000000000"), new BN(0)), + network: "rococo", + }, }); const mangataLocal = createChain({ - key: "mangata-local", - name: "Mangata Local", - assets: [ - { asset: DevTokens.mgr, isNative: true }, - { asset: DevTokens.tur, isNative: false }, - ], - endpoint: "ws://127.0.0.1:9947", - relayChain: "local", - xcm: { - network: "rococo", - instructionWeight: new Weight(new BN("150000000"), new BN("0")), - }, + assets: [ + { asset: DevTokens.mgr, isNative: true }, + { asset: DevTokens.tur, isNative: false }, + ], + endpoint: "ws://127.0.0.1:9947", + key: "mangata-local", + name: "Mangata Local", + relayChain: "local", + xcm: { + instructionWeight: new Weight(new BN("150000000"), new BN("0")), + network: "rococo", + }, }); const moonbaseLocal = createChain({ - key: "moonbase-local", - name: "Moonbase Local", - assets: [{ asset: DevTokens.moonbaseLocal, isNative: true }], - endpoint: "ws://127.0.0.1:9949", - relayChain: "local", - xcm: { - network: "rococo", - instructionWeight: new Weight(new BN("250000000"), new BN("10000")), - }, - }); + assets: [{ asset: DevTokens.moonbaseLocal, isNative: true }], + endpoint: "ws://127.0.0.1:9949", + isEthereum: true, + key: "moonbase-local", + name: "Moonbase Local", + relayChain: "local", + xcm: { + instructionWeight: new Weight(new BN("250000000"), new BN("10000")), + network: "rococo", + }, +}); -export default { turingLocal, shibuya, mangataLocal, moonbaseLocal }; +// eslint-disable-next-line import/no-default-export +export default { mangataLocal, moonbaseLocal, shibuya, turingLocal }; diff --git a/packages/config/src/chains/index.ts b/packages/config/src/chains/index.ts index f7697a6..73d1517 100644 --- a/packages/config/src/chains/index.ts +++ b/packages/config/src/chains/index.ts @@ -14,4 +14,5 @@ export { PolkadotChains, Weight, }; + export type { Chain, XcmConfig }; diff --git a/packages/config/src/chains/kusama.ts b/packages/config/src/chains/kusama.ts index 84503ac..ed82dae 100644 --- a/packages/config/src/chains/kusama.ts +++ b/packages/config/src/chains/kusama.ts @@ -4,62 +4,65 @@ import { createChain } from "./types/Chain"; import { KusamaTokens } from "../tokens"; const shiden = createChain({ - key: "shiden", - name: "Shiden Network", - assets: [{ asset: KusamaTokens.sdn, isNative: true }], - endpoint: "wss://shiden-rpc.dwellir.com", - relayChain: "kusama", - xcm: { - network: "kusama", - instructionWeight: new Weight(new BN("1000000000"), new BN(64 * 1024)), - }, + assets: [{ asset: KusamaTokens.sdn, isNative: true }], + endpoint: "wss://shiden-rpc.dwellir.com", + isEthereum: true, + key: "shiden", + name: "Shiden Network", + relayChain: "kusama", + xcm: { + instructionWeight: new Weight(new BN("1000000000"), new BN(64 * 1024)), + network: "kusama", + }, }); const turing = createChain({ - key: "turing", - name: "Turing Network", - assets: [ - { asset: KusamaTokens.tur, isNative: true }, - { asset: KusamaTokens.sdn, isNative: false }, - { asset: KusamaTokens.movr, isNative: false }, - { asset: KusamaTokens.mgx, isNative: false }, - ], - endpoint: "wss://rpc.turing.oak.tech", - relayChain: "kusama", - xcm: { - network: "kusama", - instructionWeight: new Weight(new BN("1000000000"), new BN(0)), - }, + assets: [ + { asset: KusamaTokens.tur, isNative: true }, + { asset: KusamaTokens.sdn, isNative: false }, + { asset: KusamaTokens.movr, isNative: false }, + { asset: KusamaTokens.mgx, isNative: false }, + ], + endpoint: "wss://rpc.turing.oak.tech", + key: "turing", + name: "Turing Network", + relayChain: "kusama", + xcm: { + instructionWeight: new Weight(new BN("1000000000"), new BN(0)), + network: "kusama", + }, }); const mangata = createChain({ - key: "mangata", - name: "Mangata", - assets: [ - { asset: KusamaTokens.mgx, isNative: true }, - { asset: KusamaTokens.tur, isNative: false }, - ], - endpoint: "wss://kusama-rpc.mangata.online", - relayChain: "kusama", - xcm: { - network: "kusama", - instructionWeight: new Weight(new BN("150000000"), new BN("0")), - }, + assets: [ + { asset: KusamaTokens.mgx, isNative: true }, + { asset: KusamaTokens.xcTur, isNative: false }, + ], + endpoint: "wss://kusama-rpc.mangata.online", + key: "mangata", + name: "Mangata", + relayChain: "kusama", + xcm: { + instructionWeight: new Weight(new BN("150000000"), new BN("0")), + network: "kusama", + }, }); const moonriver = createChain({ - key: "moonriver", - name: "Moonriver", - assets: [ - { asset: KusamaTokens.movr, isNative: true }, - { asset: KusamaTokens.tur, isNative: false }, - ], - endpoint: "wss://wss.api.moonriver.moonbeam.network", - relayChain: "kusama", - xcm: { - network: "kusama", - instructionWeight: new Weight(new BN("250000000"), new BN("10000")), - }, + assets: [ + { asset: KusamaTokens.movr, isNative: true }, + { asset: KusamaTokens.xcTur, isNative: false }, + ], + endpoint: "wss://wss.api.moonriver.moonbeam.network", + isEthereum: true, + key: "moonriver", + name: "Moonriver", + relayChain: "kusama", + xcm: { + instructionWeight: new Weight(new BN("250000000"), new BN("10000")), + network: "kusama", + }, }); -export default { turing, shiden, mangata, moonriver }; +// eslint-disable-next-line import/no-default-export +export default { mangata, moonriver, shiden, turing }; diff --git a/packages/config/src/chains/moonbase.ts b/packages/config/src/chains/moonbase.ts index 7f351ec..cb2784e 100644 --- a/packages/config/src/chains/moonbase.ts +++ b/packages/config/src/chains/moonbase.ts @@ -4,30 +4,32 @@ import { createChain } from "./types/Chain"; import { MoonbaseTokens } from "../tokens"; const turingMoonbase = createChain({ - key: "turing-moonbase", - name: "Moonbase Turing", - assets: [{ asset: MoonbaseTokens.tur, isNative: true }], - endpoint: "ws://167.99.226.24:8846", - relayChain: "moonbase-alpha-relay", - xcm: { - network: "rococo", - instructionWeight: new Weight(new BN("1000000000"), new BN(0)), - }, + assets: [{ asset: MoonbaseTokens.tur, isNative: true }], + endpoint: "ws://167.99.226.24:8846", + key: "turing-moonbase", + name: "Moonbase Turing", + relayChain: "moonbase-alpha-relay", + xcm: { + instructionWeight: new Weight(new BN("1000000000"), new BN(0)), + network: "moonbase-alpha-relay", + }, }); const moonbaseAlpha = createChain({ - key: "moonbase-alpha", - name: "Moonbase Alpha", - assets: [ - { asset: MoonbaseTokens.dev, isNative: true }, - { asset: MoonbaseTokens.tur, isNative: false }, - ], - endpoint: "wss://wss.api.moonbase.moonbeam.network", - relayChain: "moonbase-alpha-relay", - xcm: { - network: "rococo", - instructionWeight: new Weight(new BN("250000000"), new BN("10000")), - }, + assets: [ + { asset: MoonbaseTokens.dev, isNative: true }, + { asset: MoonbaseTokens.tur, isNative: false }, + ], + endpoint: "wss://wss.api.moonbase.moonbeam.network", + isEthereum: true, + key: "moonbase-alpha", + name: "Moonbase Alpha", + relayChain: "moonbase-alpha-relay", + xcm: { + instructionWeight: new Weight(new BN("250000000"), new BN("10000")), + network: "moonbase-alpha-relay", + }, }); -export default { turingMoonbase, moonbaseAlpha }; +// eslint-disable-next-line import/no-default-export +export default { moonbaseAlpha, turingMoonbase }; diff --git a/packages/config/src/chains/rococo.ts b/packages/config/src/chains/rococo.ts index da5d95d..ef9c482 100644 --- a/packages/config/src/chains/rococo.ts +++ b/packages/config/src/chains/rococo.ts @@ -4,43 +4,47 @@ import { createChain } from "./types/Chain"; import { RococoTokens } from "../tokens"; const rocstar = createChain({ - key: "rocstar", - name: "Rocstar", - assets: [{ asset: RococoTokens.rstr, isNative: true }], - endpoint: "wss://rocstar.astar.network", - relayChain: "rococo", - xcm: { - network: "rococo", - instructionWeight: new Weight(new BN("1000000000"), new BN(64 * 1024)), - }, + assets: [{ asset: RococoTokens.rstr, isNative: true }], + endpoint: "wss://rocstar.astar.network", + isEthereum: true, + key: "rocstar", + name: "Rocstar", + relayChain: "rococo", + xcm: { + instructionWeight: new Weight(new BN("1000000000"), new BN(64 * 1024)), + network: "rococo", + }, }); const mangataRococo = createChain({ - key: "mangata-rococo", - name: "Mangata Rococo", - assets: [{ asset: RococoTokens.mgr, isNative: true }, { asset: RococoTokens.tur, isNative: false }], - endpoint: "wss://collator-01-ws-rococo.mangata.online", - relayChain: "rococo", - xcm: { - network: "rococo", - instructionWeight: new Weight(new BN("150000000"), new BN("0")), - }, - }); - + assets: [ + { asset: RococoTokens.mgr, isNative: true }, + { asset: RococoTokens.tur, isNative: false }, + ], + endpoint: "wss://collator-01-ws-rococo.mangata.online", + key: "mangata-rococo", + name: "Mangata Rococo", + relayChain: "rococo", + xcm: { + instructionWeight: new Weight(new BN("150000000"), new BN("0")), + network: "rococo", + }, +}); const turingStaging = createChain({ - key: "turing-staging", - name: "Turing Staging", - assets: [ - { asset: RococoTokens.tur, isNative: true }, - { asset: RococoTokens.rstr, isNative: false }, - ], - endpoint: "wss://rpc.turing-staging.oak.tech", - relayChain: "rococo", - xcm: { - network: "rococo", - instructionWeight: new Weight(new BN("1000000000"), new BN(0)), - }, + assets: [ + { asset: RococoTokens.tur, isNative: true }, + { asset: RococoTokens.rstr, isNative: false }, + ], + endpoint: "wss://rpc.turing-staging.oak.tech", + key: "turing-staging", + name: "Turing Staging", + relayChain: "rococo", + xcm: { + instructionWeight: new Weight(new BN("1000000000"), new BN(0)), + network: "rococo", + }, }); -export default { mangataRococo, turingStaging, rocstar }; +// eslint-disable-next-line import/no-default-export +export default { mangataRococo, rocstar, turingStaging }; diff --git a/packages/config/src/chains/types/Chain.ts b/packages/config/src/chains/types/Chain.ts index bda8b2f..6bd66c3 100644 --- a/packages/config/src/chains/types/Chain.ts +++ b/packages/config/src/chains/types/Chain.ts @@ -5,9 +5,9 @@ import { RelayChainType } from "./RelayChainType"; import { XcmInstructionNetworkType } from "./XcmInstructionNetworkType"; interface XcmConfig { - network: RelayChainType; - instructionWeight: Weight; instructionNetworkType?: XcmInstructionNetworkType; + instructionWeight: Weight; + network: RelayChainType; } type AssetInfo = { @@ -16,60 +16,67 @@ type AssetInfo = { }; interface ChainConstructorParams { - key: string; - name: string; assets: XToken[]; endpoint: string; + isEthereum?: boolean; + key: string; + name: string; relayChain: RelayChainType; xcm: XcmConfig; } class Chain { - key: string; - readonly assets: XToken[]; readonly endpoint: string; - paraId: number | undefined; + isEthereum: boolean; - ss58Prefix: number | undefined; + key: string; name: string | undefined; + paraId: number | undefined; + relayChain: RelayChainType; + ss58Prefix: number | undefined; + xcm: XcmConfig; constructor({ - key, - name, assets, endpoint, + isEthereum = false, // Set default value to false + key, + name, relayChain, xcm, }: ChainConstructorParams) { - this.key = key; - this.name = name; this.assets = assets; this.endpoint = endpoint; + this.isEthereum = isEthereum; + this.key = key; + this.name = name; this.relayChain = relayChain; this.xcm = xcm; } } function createChain(config: { - key: string; - name: string; assets: AssetInfo[]; endpoint: string; + isEthereum?: boolean; + key: string; + name: string; relayChain: RelayChainType; xcm: XcmConfig; }): Chain { - const { key, name, assets, endpoint, relayChain, xcm } = config; + const { assets, endpoint, isEthereum, key, name, relayChain, xcm } = config; return new Chain({ assets: assets.map((asset) => new XToken(asset)), endpoint, + isEthereum, key, name, relayChain, diff --git a/packages/config/src/tokens/kusama.ts b/packages/config/src/tokens/kusama.ts index 3c6c620..76529a5 100644 --- a/packages/config/src/tokens/kusama.ts +++ b/packages/config/src/tokens/kusama.ts @@ -7,10 +7,17 @@ const tur = createToken({ parachainId: 2114, symbol: "TUR", }); +const xcTur = createToken({ + decimals: 10, + key: "xcTur", + network: "kusama", + parachainId: 2114, + symbol: "xcTUR", +}); // TODO: movr is not defined in the original file; need to double check its value const movr = createToken({ - decimals: 10, + decimals: 18, key: "movr", network: "kusama", parachainId: 2023, @@ -39,4 +46,4 @@ const mgx = createToken({ }); // eslint-disable-next-line import/no-default-export -export default { mgx, movr, sdn, tur }; +export default { mgx, movr, sdn, tur, xcTur }; diff --git a/packages/sdk/package.json b/packages/sdk/package.json index c5b7433..d64cbd7 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -8,8 +8,8 @@ "clean": "tsc --build --clean" }, "dependencies": { - "@oak-network/adapter": "workspace:^0.1.5", - "@oak-network/config": "workspace:^1.0.0", + "@oak-network/adapter": "../adapter", + "@oak-network/config": "../config", "@polkadot/util": "^12.6.1", "bn.js": "^5.2.1", "lodash": "^4.17.21" diff --git a/yarn.lock b/yarn.lock index e0c8ed4..86547fa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2141,14 +2141,31 @@ __metadata: languageName: node linkType: hard -"@oak-network/adapter@workspace:^0.1.5, @oak-network/adapter@workspace:packages/adapter": +"@oak-network/adapter@file:../adapter::locator=%40oak-network%2Fsdk%40workspace%3Apackages%2Fsdk": + version: 0.1.5 + resolution: "@oak-network/adapter@file:../adapter#../adapter::hash=ecc28a&locator=%40oak-network%2Fsdk%40workspace%3Apackages%2Fsdk" + dependencies: + "@oak-network/config": ../config + "@polkadot/api": "npm:^10.9.1" + "@polkadot/types": "npm:^10.11.1" + "@polkadot/util": "npm:^12.6.1" + bn.js: "npm:^5.2.1" + lodash: "npm:^4.17.21" + web3-validator: "npm:^2.0.3" + checksum: a1afde68adb00eb0de2475634bf8c8bdd20e29b7d3393919bf2d5eeba65678286299f590c8f9880cc20ed491a60136a5da00b886d2a1a329b7405a8386f17492 + languageName: node + linkType: hard + +"@oak-network/adapter@workspace:packages/adapter": version: 0.0.0-use.local resolution: "@oak-network/adapter@workspace:packages/adapter" dependencies: - "@oak-network/config": "workspace:^1.0.0" + "@oak-network/config": ../config "@polkadot/api": "npm:^10.9.1" + "@polkadot/keyring": "npm:^12.6.1" "@polkadot/types": "npm:^10.11.1" "@polkadot/util": "npm:^12.6.1" + "@polkadot/util-crypto": "npm:^12.6.1" bn.js: "npm:^5.2.1" lodash: "npm:^4.17.21" typescript: "npm:^5.3.2" @@ -2167,10 +2184,39 @@ __metadata: languageName: unknown linkType: soft -"@oak-network/config@workspace:^1.0.0, @oak-network/config@workspace:packages/config": +"@oak-network/config@file:../config::locator=%40oak-network%2Fadapter%40file%3A..%2Fadapter%23..%2Fadapter%3A%3Ahash%3Decc28a%26locator%3D%2540oak-network%252Fsdk%2540workspace%253Apackages%252Fsdk": + version: 1.0.0 + resolution: "@oak-network/config@file:../config#../config::hash=3e308e&locator=%40oak-network%2Fadapter%40file%3A..%2Fadapter%23..%2Fadapter%3A%3Ahash%3Decc28a%26locator%3D%2540oak-network%252Fsdk%2540workspace%253Apackages%252Fsdk" + dependencies: + bn.js: "npm:^5.2.1" + checksum: f7cadb8234522b04f8f9cf2196236059cc806ac74b923e052d9aae4adf3d1e14338ec0fdc529c07f647d711836e3913cd26416bbaa040872e972da2887ea7b85 + languageName: node + linkType: hard + +"@oak-network/config@file:../config::locator=%40oak-network%2Fadapter%40workspace%3Apackages%2Fadapter": + version: 1.0.0 + resolution: "@oak-network/config@file:../config#../config::hash=3e308e&locator=%40oak-network%2Fadapter%40workspace%3Apackages%2Fadapter" + dependencies: + bn.js: "npm:^5.2.1" + checksum: f7cadb8234522b04f8f9cf2196236059cc806ac74b923e052d9aae4adf3d1e14338ec0fdc529c07f647d711836e3913cd26416bbaa040872e972da2887ea7b85 + languageName: node + linkType: hard + +"@oak-network/config@file:../config::locator=%40oak-network%2Fsdk%40workspace%3Apackages%2Fsdk": + version: 1.0.0 + resolution: "@oak-network/config@file:../config#../config::hash=3e308e&locator=%40oak-network%2Fsdk%40workspace%3Apackages%2Fsdk" + dependencies: + bn.js: "npm:^5.2.1" + checksum: f7cadb8234522b04f8f9cf2196236059cc806ac74b923e052d9aae4adf3d1e14338ec0fdc529c07f647d711836e3913cd26416bbaa040872e972da2887ea7b85 + languageName: node + linkType: hard + +"@oak-network/config@workspace:packages/config": version: 0.0.0-use.local resolution: "@oak-network/config@workspace:packages/config" dependencies: + "@types/bn.js": "npm:^5" + bn.js: "npm:^5.2.1" typescript: "npm:^5.3.2" languageName: unknown linkType: soft @@ -2179,8 +2225,8 @@ __metadata: version: 0.0.0-use.local resolution: "@oak-network/sdk@workspace:packages/sdk" dependencies: - "@oak-network/adapter": "workspace:^0.1.5" - "@oak-network/config": "workspace:^1.0.0" + "@oak-network/adapter": ../adapter + "@oak-network/config": ../config "@polkadot/util": "npm:^12.6.1" bn.js: "npm:^5.2.1" lodash: "npm:^4.17.21" @@ -2812,7 +2858,7 @@ __metadata: languageName: node linkType: hard -"@types/bn.js@npm:^5.1.5": +"@types/bn.js@npm:^5, @types/bn.js@npm:^5.1.5": version: 5.1.5 resolution: "@types/bn.js@npm:5.1.5" dependencies: