Skip to content

Commit

Permalink
remove asset transfer api registry package
Browse files Browse the repository at this point in the history
update registry to pull the latest registry data from the CDN
  • Loading branch information
marshacb committed Nov 17, 2023
1 parent 3b45e58 commit b5d606b
Show file tree
Hide file tree
Showing 56 changed files with 4,334 additions and 4,309 deletions.
5 changes: 4 additions & 1 deletion examples/paraToParaParachainPrimaryNativeReserveTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://phala.api.onfinality.io/public-ws');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);
let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
Expand Down
5 changes: 4 additions & 1 deletion examples/paraToParaTransferMultiAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://moonriver.public.blastapi.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);
let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
Expand Down
5 changes: 4 additions & 1 deletion examples/paraToParaTransferMultiAssetWithFee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://moonriver.public.blastapi.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);
let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
Expand Down
5 changes: 4 additions & 1 deletion examples/paraToParaTransferMultiAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://moonriver.public.blastapi.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);
let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
Expand Down
5 changes: 4 additions & 1 deletion examples/paraToRelayTransferMultiAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://moonriver.public.blastapi.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);
let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
Expand Down
5 changes: 4 additions & 1 deletion examples/paraToSystemParachainPrimaryNative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://moonriver.public.blastapi.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);
let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
Expand Down
5 changes: 4 additions & 1 deletion examples/paraToSystemTransferMultiAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://moonriver.public.blastapi.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);
let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
Expand Down
5 changes: 4 additions & 1 deletion examples/paraToSystemTransferMultiAssetWithFee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://moonriver.public.blastapi.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);
let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
Expand Down
5 changes: 4 additions & 1 deletion examples/paraToSystemTransferMultiAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://moonriver.public.blastapi.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);
let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
Expand Down
5 changes: 4 additions & 1 deletion examples/relayToPara.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://kusama-rpc.polkadot.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);
let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
Expand Down
5 changes: 4 additions & 1 deletion examples/relayToSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://westend-rpc.polkadot.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);
let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
Expand Down
6 changes: 5 additions & 1 deletion examples/rococoAssetHubToRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -21,7 +22,10 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, safeXcmVersion } = await constructApiPromise('wss://rococo-asset-hub-rpc.polkadot.io');
const assetApi = new AssetTransferApi(api, 'asset-hub-rococo', safeXcmVersion);
const specName = 'asset-hub-rococo';
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);

let callInfo: TxResult<'call'>;
try {
Expand Down
5 changes: 4 additions & 1 deletion examples/submittable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Keyring } from '@polkadot/keyring';
import { cryptoWaitReady } from '@polkadot/util-crypto';

import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -18,7 +19,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('ws://127.0.0.1:9944');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);

// When declaring this type it will ensure that the inputted `format` matches it or the type checker will error.
let callInfo: TxResult<'submittable'>;
Expand Down
5 changes: 4 additions & 1 deletion examples/systemToPara.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://kusama-asset-hub-rpc.polkadot.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);

let callInfo: TxResult<'call'>;
try {
Expand Down
27 changes: 16 additions & 11 deletions examples/systemToParaLpToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,20 +17,24 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://westmint-rpc.polkadot.io');
const injectedRegistry = {
westend: {
'2023': {
tokens: ['TST'],
assetsInfo: {},
foreignAssetsInfo: {},
specName: 'testing',
poolPairsInfo: {},
const assetRegistry = await parseRegistry({
injectedRegistry: {
polkadot: {},
kusama: {},
westend: {
'2023': {
tokens: ['TST'],
assetsInfo: {},
foreignAssetsInfo: {},
specName: 'testing',
poolPairsInfo: {},
},
},
rococo: {},
},
};
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, {
injectedRegistry,
});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);

let callInfo: TxResult<'call'>;
try {
Expand Down
5 changes: 4 additions & 1 deletion examples/systemToParaPaysWithFeeOrigin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -18,7 +19,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://kusama-asset-hub-rpc.polkadot.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);

let callInfo: TxResult<'payload'>;
try {
Expand Down
5 changes: 4 additions & 1 deletion examples/systemToParaReserveTransferForeignAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -17,7 +18,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://kusama-asset-hub-rpc.polkadot.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);

let callInfo: TxResult<'call'>;
try {
Expand Down
5 changes: 4 additions & 1 deletion examples/systemToParaTeleportForeignAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -17,7 +18,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://kusama-asset-hub-rpc.polkadot.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);

let callInfo: TxResult<'call'>;
try {
Expand Down
5 changes: 4 additions & 1 deletion examples/systemToRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* import { AssetTransferApi, constructApiPromise } from '@substrate/asset-transfer-api'
*/
import { AssetTransferApi, constructApiPromise } from '../src';
import { parseRegistry, Registry } from '../src/registry';
import { TxResult } from '../src/types';
import { GREEN, PURPLE, RESET } from './colors';

Expand All @@ -16,7 +17,9 @@ import { GREEN, PURPLE, RESET } from './colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://westmint-rpc.polkadot.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
const assetRegistry = await parseRegistry({});
const registry = new Registry(specName, assetRegistry);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, registry);

let callInfo: TxResult<'call'>;
try {
Expand Down
Loading

0 comments on commit b5d606b

Please sign in to comment.