Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update build to support NodeNext #455

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ zombienet/bin/*
# Binaries
/bin/*
!bin/README.md

.tshy
.tshy-build
dist
File renamed without changes.
File renamed without changes.
File renamed without changes.
49 changes: 43 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,30 @@
"name": "@substrate/asset-transfer-api",
"version": "0.4.4",
"description": "",
"main": "lib/index.js",
"type": "module",
"main": "./dist/commonjs/index.js",
"types": "./dist/commonjs/index.d.ts",
"module": "./dist/esm/index.js",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"@paritytech/source": "./src/index.ts",
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
}
},
"scripts": {
"build": "substrate-exec-rimraf ./lib && substrate-exec-tsc",
"build:scripts": "substrate-exec-rimraf scripts/build/ && substrate-exec-tsc --project scripts/tsconfig.json",
"build:examples": "substrate-exec-rimraf examples/build/ && substrate-exec-tsc --project examples/tsconfig.json",
"build:e2e": "substrate-exec-rimraf e2e-tests/build/ && substrate-exec-tsc --project e2e-tests/tsconfig.json",
"clean": "rimraf dist .tshy .tshy-build",
"build": "yarn run clean && tshy",
"build:scripts": "rimraf scripts/build/ && tsc --project scripts/tsconfig.json",
"build:examples": "rimraf examples/build/ && tsc --project examples/tsconfig.json",
"build:e2e": "rimraf e2e-tests/build/ && tsc --project e2e-tests/tsconfig.json",
"start": "node ./lib/index.js",
"start:zombienet-post-script": "yarn build:scripts && node ./scripts/build/testNetworkSetup.js",
"start:zombienet-foreign-assets-script": "yarn build:scripts && node ./scripts/build/testNetworkForeignAssets.js",
Expand Down Expand Up @@ -39,15 +57,34 @@
},
"homepage": "https://github.com/paritytech/asset-transfer-api#readme",
"packageManager": "[email protected]",
"tshy": {
"project": "./tsconfig.build.json",
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts"
},
"sourceDialects": [
"@paritytech/source"
],
"exclude": [
"src/**/*.spec.ts",
"src/**/*.test.ts",
"src/testHelpers"
]
},
"devDependencies": {
"@substrate/dev": "^0.7.1",
"@total-typescript/tsconfig": "^1.0.4",
"@types/cli-progress": "^3",
"ansi-colors": "^4.1.3",
"chalk": "4.1.2",
"cli-progress": "^3.12.0",
"rimraf": "^6.0.1",
"tshy": "^3.0.2",
"typedoc": "^0.26.10",
"typedoc-plugin-missing-exports": "^3.0.0",
"typedoc-theme-hierarchy": "^4.0.0"
"typedoc-theme-hierarchy": "^4.0.0",
"typescript": "^5.6.3"
},
"dependencies": {
"@polkadot/api": "14.1.1",
Expand Down
34 changes: 17 additions & 17 deletions src/AssetTransferApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { Weight } from '@polkadot/types/interfaces';
import type { ISubmittableResult } from '@polkadot/types/types';

import { AssetTransferApi } from './AssetTransferApi';
import { AssetTransferApi } from './AssetTransferApi.js';
import {
limitedReserveTransferAssets,
limitedTeleportAssets,
transferAssets,
transferMultiasset,
transferMultiassets,
transferMultiassetWithFee,
} from './createXcmCalls';
import { XcmPalletName } from './createXcmCalls/util/establishXcmPallet';
import type { XTokensBaseArgs } from './createXcmCalls/xTokens/types';
import { Registry } from './registry';
import { adjustedMockBifrostParachainApi } from './testHelpers/adjustedMockBifrostParachainApi';
import { adjustedMockMoonriverParachainApi } from './testHelpers/adjustedMockMoonriverParachainApi';
import { adjustedMockMoonriverNoXTokensParachainApi } from './testHelpers/adjustedMockMoonriverParachainNoXTokens';
import { adjustedMockRelayApiNoLimitedReserveTransferAssets } from './testHelpers/adjustedMockRelayApiNoLimitedReserveTransferAssets';
import { adjustedMockRelayApi } from './testHelpers/adjustedMockRelayApiV9420';
import { adjustedMockSystemApi } from './testHelpers/adjustedMockSystemApiV1004000';
import { adjustedMockSystemApiV1016000 } from './testHelpers/adjustedMockSystemApiV1016000';
import { mockDryRunCallResult } from './testHelpers/mockDryRunCallResult';
import { mockSystemApi } from './testHelpers/mockSystemApi';
import { mockWeightInfo } from './testHelpers/mockWeightInfo';
import { AssetCallType, Direction, ResolvedCallInfo, UnsignedTransaction, XcmBaseArgs, XcmDirection } from './types';
import { AssetType } from './types';
} from './createXcmCalls/index.js';
import { XcmPalletName } from './createXcmCalls/util/establishXcmPallet.js';
import type { XTokensBaseArgs } from './createXcmCalls/xTokens/types.js';
import { Registry } from './registry/index.js';
import { adjustedMockBifrostParachainApi } from './testHelpers/adjustedMockBifrostParachainApi.js';
import { adjustedMockMoonriverParachainApi } from './testHelpers/adjustedMockMoonriverParachainApi.js';
import { adjustedMockMoonriverNoXTokensParachainApi } from './testHelpers/adjustedMockMoonriverParachainNoXTokens.js';
import { adjustedMockRelayApiNoLimitedReserveTransferAssets } from './testHelpers/adjustedMockRelayApiNoLimitedReserveTransferAssets.js';
import { adjustedMockRelayApi } from './testHelpers/adjustedMockRelayApiV9420.js';
import { adjustedMockSystemApi } from './testHelpers/adjustedMockSystemApiV1004000.js';
import { adjustedMockSystemApiV1016000 } from './testHelpers/adjustedMockSystemApiV1016000.js';
import { mockDryRunCallResult } from './testHelpers/mockDryRunCallResult.js';
import { mockSystemApi } from './testHelpers/mockSystemApi.js';
import { mockWeightInfo } from './testHelpers/mockWeightInfo.js';
import { AssetCallType, Direction, ResolvedCallInfo, UnsignedTransaction, XcmBaseArgs, XcmDirection } from './types.js';
import { AssetType } from './types.js';

const mockSubmittableExt = mockSystemApi.registry.createType(
'Extrinsic',
Expand Down
72 changes: 36 additions & 36 deletions src/AssetTransferApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import type {
import type { AnyJson, AnyTuple, ISubmittableResult } from '@polkadot/types/types';
import type { Result, u128 } from '@polkadot/types-codec';

import { CDN_URL, RELAY_CHAIN_IDS, RELAY_CHAIN_NAMES, SYSTEM_PARACHAINS_NAMES } from './consts';
import * as assets from './createCalls/assets';
import * as balances from './createCalls/balances';
import * as foreignAssets from './createCalls/foreignAssets';
import * as poolAssets from './createCalls/poolAssets';
import * as tokens from './createCalls/tokens';
import { CDN_URL, RELAY_CHAIN_IDS, RELAY_CHAIN_NAMES, SYSTEM_PARACHAINS_NAMES } from './consts.js';
import * as assets from './createCalls/assets/index.js';
import * as balances from './createCalls/balances/index.js';
import * as foreignAssets from './createCalls/foreignAssets/index.js';
import * as poolAssets from './createCalls/poolAssets/index.js';
import * as tokens from './createCalls/tokens/index.js';
import {
claimAssets,
limitedReserveTransferAssets,
Expand All @@ -32,24 +32,24 @@ import {
transferMultiasset,
transferMultiassets,
transferMultiassetWithFee,
} from './createXcmCalls';
import { CreateXcmCallOpts } from './createXcmCalls/types';
import { establishXcmPallet, XcmPalletName } from './createXcmCalls/util/establishXcmPallet';
import { XTokensBaseArgs } from './createXcmCalls/xTokens/types';
import { UnionXcmMultiLocation, XcmVersionedAssetId } from './createXcmTypes/types';
import { assetIdIsLocation } from './createXcmTypes/util/assetIdIsLocation';
import { assetIdsContainRelayAsset } from './createXcmTypes/util/assetIdsContainsRelayAsset';
import { chainDestIsBridge } from './createXcmTypes/util/chainDestIsBridge';
import { createXcmVersionedAssetId } from './createXcmTypes/util/createXcmVersionedAssetId';
import { getAssetId } from './createXcmTypes/util/getAssetId';
import { getGlobalConsensusSystemName } from './createXcmTypes/util/getGlobalConsensusSystemName';
import { getPaysWithFeeOriginAssetLocationFromRegistry } from './createXcmTypes/util/getPaysWithFeeOriginAssetLocationFromRegistry';
import { isParachain } from './createXcmTypes/util/isParachain';
import { isParachainPrimaryNativeAsset } from './createXcmTypes/util/isParachainPrimaryNativeAsset';
import { isRelayNativeAsset } from './createXcmTypes/util/isRelayNativeAsset';
import { isSystemChain } from './createXcmTypes/util/isSystemChain';
import { multiLocationAssetIsParachainsNativeAsset } from './createXcmTypes/util/multiLocationAssetIsParachainsNativeAsset';
import { parseLocationStrToLocation } from './createXcmTypes/util/parseLocationStrToLocation';
} from './createXcmCalls/index.js';
import { CreateXcmCallOpts } from './createXcmCalls/types.js';
import { establishXcmPallet, XcmPalletName } from './createXcmCalls/util/establishXcmPallet.js';
import { XTokensBaseArgs } from './createXcmCalls/xTokens/types.js';
import { UnionXcmMultiLocation, XcmVersionedAssetId } from './createXcmTypes/types.js';
import { assetIdIsLocation } from './createXcmTypes/util/assetIdIsLocation.js';
import { assetIdsContainRelayAsset } from './createXcmTypes/util/assetIdsContainsRelayAsset.js';
import { chainDestIsBridge } from './createXcmTypes/util/chainDestIsBridge.js';
import { createXcmVersionedAssetId } from './createXcmTypes/util/createXcmVersionedAssetId.js';
import { getAssetId } from './createXcmTypes/util/getAssetId.js';
import { getGlobalConsensusSystemName } from './createXcmTypes/util/getGlobalConsensusSystemName.js';
import { getPaysWithFeeOriginAssetLocationFromRegistry } from './createXcmTypes/util/getPaysWithFeeOriginAssetLocationFromRegistry.js';
import { isParachain } from './createXcmTypes/util/isParachain.js';
import { isParachainPrimaryNativeAsset } from './createXcmTypes/util/isParachainPrimaryNativeAsset.js';
import { isRelayNativeAsset } from './createXcmTypes/util/isRelayNativeAsset.js';
import { isSystemChain } from './createXcmTypes/util/isSystemChain.js';
import { multiLocationAssetIsParachainsNativeAsset } from './createXcmTypes/util/multiLocationAssetIsParachainsNativeAsset.js';
import { parseLocationStrToLocation } from './createXcmTypes/util/parseLocationStrToLocation.js';
import {
BaseError,
BaseErrorsEnum,
Expand All @@ -60,12 +60,12 @@ import {
checkLocalSystemParachainInput,
checkXcmTxInputs,
checkXcmVersion,
} from './errors';
import { LocalTxType } from './errors/checkLocalTxInput/types';
import { checkClaimAssetsInputs } from './errors/checkXcmTxInputs';
import { Registry } from './registry';
import { ChainInfoKeys, ChainInfoRegistry } from './registry/types';
import { sanitizeAddress } from './sanitize/sanitizeAddress';
} from './errors/index.js';
import { LocalTxType } from './errors/checkLocalTxInput/types.js';
import { checkClaimAssetsInputs } from './errors/checkXcmTxInputs.js';
import { Registry } from './registry/index.js';
import { ChainInfoKeys, ChainInfoRegistry } from './registry/types.js';
import { sanitizeAddress } from './sanitize/sanitizeAddress.js';
import {
AssetCallType,
AssetTransferApiOpts,
Expand All @@ -92,12 +92,12 @@ import {
type XcmPalletTxMethodTransactionMap,
type XTokensCallSignature,
type XTokensTxMethodTransactionMap,
} from './types';
import { callExistsInRuntime } from './util/callExistsInRuntime';
import { deepEqual } from './util/deepEqual';
import { resolveMultiLocation } from './util/resolveMultiLocation';
import { sanitizeKeys } from './util/sanitizeKeys';
import { validateNumber } from './validate';
} from './types.js';
import { callExistsInRuntime } from './util/callExistsInRuntime.js';
import { deepEqual } from './util/deepEqual.js';
import { resolveMultiLocation } from './util/resolveMultiLocation.js';
import { sanitizeKeys } from './util/sanitizeKeys.js';
import { validateNumber } from './validate/index.js';

/**
* Holds open an api connection to a specified chain within the ApiPromise in order to help
Expand Down
4 changes: 2 additions & 2 deletions src/config/disabledOpts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

import { BaseError, BaseErrorsEnum } from '../errors/BaseError';
import { Format, TransferArgsOpts } from '../types';
import { BaseError, BaseErrorsEnum } from '../errors/BaseError.js';
import { Format, TransferArgsOpts } from '../types.js';

interface DisabledOptionsInfo {
disabled: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/constructApiPromise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ApiPromise } from '@polkadot/api';
import type { ApiOptions } from '@polkadot/api/types';
import { WsProvider } from '@polkadot/rpc-provider';

import { fetchSafeXcmVersion } from './createXcmCalls/util/fetchSafeXcmVersion';
import { fetchSafeXcmVersion } from './createXcmCalls/util/fetchSafeXcmVersion.js';

/**
* Return value for `constructApiPromise`
Expand Down
2 changes: 1 addition & 1 deletion src/consts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

import { detectJsEnv } from './util/detectJsEvn';
import { detectJsEnv } from './util/detectJsEvn.js';

/**
* List of all known relay chains.
Expand Down
6 changes: 3 additions & 3 deletions src/createCalls/assets/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

export { transfer } from './transfer';
export { transferAll } from './transferAll';
export { transferKeepAlive } from './transferKeepAlive';
export { transfer } from './transfer.js';
export { transferAll } from './transferAll.js';
export { transferKeepAlive } from './transferKeepAlive.js';
4 changes: 2 additions & 2 deletions src/createCalls/assets/transfer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

import { mockSystemApi } from '../../testHelpers/mockSystemApi';
import { transfer } from './transfer';
import { mockSystemApi } from '../../testHelpers/mockSystemApi.js';
import { transfer } from './transfer.js';

describe('assets::transfer', () => {
it('Should construct a valid transfer extrinsic', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/createCalls/assets/transferAll.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024 Parity Technologies (UK) Ltd.

import { mockSystemApi } from '../../testHelpers/mockSystemApi';
import { transferAll } from './transferAll';
import { mockSystemApi } from '../../testHelpers/mockSystemApi.js';
import { transferAll } from './transferAll.js';

describe('assets::transferAll', () => {
it('Should construct a valid assets pallet transferAll extrinsic', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/createCalls/assets/transferKeepAlive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

import { mockSystemApi } from '../../testHelpers/mockSystemApi';
import { transferKeepAlive } from './transferKeepAlive';
import { mockSystemApi } from '../../testHelpers/mockSystemApi.js';
import { transferKeepAlive } from './transferKeepAlive.js';

describe('assets::transfer', () => {
it('Should construct a valid transfer extrinsic', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/createCalls/balances/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

export { transfer } from './transfer';
export { transferAll } from './transferAll';
export { transferKeepAlive } from './transferKeepAlive';
export { transfer } from './transfer.js';
export { transferAll } from './transferAll.js';
export { transferKeepAlive } from './transferKeepAlive.js';
4 changes: 2 additions & 2 deletions src/createCalls/balances/transfer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

import { mockSystemApi } from '../../testHelpers/mockSystemApi';
import { transfer } from './transfer';
import { mockSystemApi } from '../../testHelpers/mockSystemApi.js';
import { transfer } from './transfer.js';

describe('balances::transfer', () => {
it('Should construct a valid transfer extrinsic', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/createCalls/balances/transferAll.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024 Parity Technologies (UK) Ltd.

import { mockSystemApi } from '../../testHelpers/mockSystemApi';
import { transferAll } from './transferAll';
import { mockSystemApi } from '../../testHelpers/mockSystemApi.js';
import { transferAll } from './transferAll.js';

describe('balances::transferAll', () => {
it('Should construct a valid balances pallet transferAll extrinsic', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/createCalls/balances/transferKeepAlive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

import { mockSystemApi } from '../../testHelpers/mockSystemApi';
import { transferKeepAlive } from './transferKeepAlive';
import { mockSystemApi } from '../../testHelpers/mockSystemApi.js';
import { transferKeepAlive } from './transferKeepAlive.js';

describe('balances::transfer', () => {
it('Should construct a valid transfer extrinsic', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/createCalls/foreignAssets/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

export { transfer } from './transfer';
export { transferAll } from './transferAll';
export { transferKeepAlive } from './transferKeepAlive';
export { transfer } from './transfer.js';
export { transferAll } from './transferAll.js';
export { transferKeepAlive } from './transferKeepAlive.js';
6 changes: 3 additions & 3 deletions src/createCalls/foreignAssets/transfer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

import type { UnionXcmMultiLocation } from '../../createXcmTypes/types';
import { mockSystemApi } from '../../testHelpers/mockSystemApi';
import { transfer } from './transfer';
import type { UnionXcmMultiLocation } from '../../createXcmTypes/types.js';
import { mockSystemApi } from '../../testHelpers/mockSystemApi.js';
import { transfer } from './transfer.js';

describe('foreignAssets::transfer', () => {
it('Should construct a valid foreignAsset transfer extrinsic', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/createCalls/foreignAssets/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { ApiPromise } from '@polkadot/api';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ISubmittableResult } from '@polkadot/types/types';

import type { UnionXcmMultiLocation } from '../../createXcmTypes/types';
import type { UnionXcmMultiLocation } from '../../createXcmTypes/types.js';

export const transfer = (
api: ApiPromise,
Expand Down
6 changes: 3 additions & 3 deletions src/createCalls/foreignAssets/transferAll.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2024 Parity Technologies (UK) Ltd.

import { UnionXcmMultiLocation } from '../../createXcmTypes/types';
import { mockSystemApi } from '../../testHelpers/mockSystemApi';
import { transferAll } from './transferAll';
import { UnionXcmMultiLocation } from '../../createXcmTypes/types.js';
import { mockSystemApi } from '../../testHelpers/mockSystemApi.js';
import { transferAll } from './transferAll.js';

describe('foreignAssets::transferAll', () => {
it('Should construct a valid foreignAssets pallet transferAll extrinsic', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/createCalls/foreignAssets/transferAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { ApiPromise } from '@polkadot/api';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ISubmittableResult } from '@polkadot/types/types';

import { UnionXcmMultiLocation } from '../../createXcmTypes/types';
import { UnionXcmMultiLocation } from '../../createXcmTypes/types.js';

export const transferAll = (
api: ApiPromise,
Expand Down
6 changes: 3 additions & 3 deletions src/createCalls/foreignAssets/transferKeepAlive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

import type { UnionXcmMultiLocation } from '../../createXcmTypes/types';
import { mockSystemApi } from '../../testHelpers/mockSystemApi';
import { transferKeepAlive } from './transferKeepAlive';
import type { UnionXcmMultiLocation } from '../../createXcmTypes/types.js';
import { mockSystemApi } from '../../testHelpers/mockSystemApi.js';
import { transferKeepAlive } from './transferKeepAlive.js';

describe('foreignAssets::transfer', () => {
it('Should construct a valid foreignAssets transferKeepAlive extrinsic', () => {
Expand Down
Loading
Loading