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: use cdn hosted assets registry #327

Closed
wants to merge 5 commits into from
Closed
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
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