@moonbeam-network/xcm-utils 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/README.md +3 -0
- package/build/cjs/package.json +43 -0
- package/build/cjs/src/api/index.d.ts +1 -0
- package/build/cjs/src/api/index.js +18 -0
- package/build/cjs/src/api/index.js.map +1 -0
- package/build/cjs/src/api/polkadot.api.d.ts +2 -0
- package/build/cjs/src/api/polkadot.api.js +33 -0
- package/build/cjs/src/api/polkadot.api.js.map +1 -0
- package/build/cjs/src/handlers/createExtrinsicEventHandler.d.ts +3 -0
- package/build/cjs/src/handlers/createExtrinsicEventHandler.js +46 -0
- package/build/cjs/src/handlers/createExtrinsicEventHandler.js.map +1 -0
- package/build/cjs/src/handlers/createTxEventHandler.d.ts +3 -0
- package/build/cjs/src/handlers/createTxEventHandler.js +33 -0
- package/build/cjs/src/handlers/createTxEventHandler.js.map +1 -0
- package/build/cjs/src/handlers/handlers.interfaces.d.ts +23 -0
- package/build/cjs/src/handlers/handlers.interfaces.js +10 -0
- package/build/cjs/src/handlers/handlers.interfaces.js.map +1 -0
- package/build/cjs/src/handlers/index.d.ts +3 -0
- package/build/cjs/src/handlers/index.js +20 -0
- package/build/cjs/src/handlers/index.js.map +1 -0
- package/build/cjs/src/index.d.ts +2 -0
- package/build/cjs/src/index.js +19 -0
- package/build/cjs/src/index.js.map +1 -0
- package/build/cjs/tsconfig.cjs.json +10 -0
- package/build/cjs/tsconfig.json +9 -0
- package/build/mjs/package.json +43 -0
- package/build/mjs/src/api/index.d.ts +1 -0
- package/build/mjs/src/api/index.js +18 -0
- package/build/mjs/src/api/index.js.map +1 -0
- package/build/mjs/src/api/polkadot.api.d.ts +2 -0
- package/build/mjs/src/api/polkadot.api.js +33 -0
- package/build/mjs/src/api/polkadot.api.js.map +1 -0
- package/build/mjs/src/handlers/createExtrinsicEventHandler.d.ts +3 -0
- package/build/mjs/src/handlers/createExtrinsicEventHandler.js +46 -0
- package/build/mjs/src/handlers/createExtrinsicEventHandler.js.map +1 -0
- package/build/mjs/src/handlers/createTxEventHandler.d.ts +3 -0
- package/build/mjs/src/handlers/createTxEventHandler.js +33 -0
- package/build/mjs/src/handlers/createTxEventHandler.js.map +1 -0
- package/build/mjs/src/handlers/handlers.interfaces.d.ts +23 -0
- package/build/mjs/src/handlers/handlers.interfaces.js +10 -0
- package/build/mjs/src/handlers/handlers.interfaces.js.map +1 -0
- package/build/mjs/src/handlers/index.d.ts +3 -0
- package/build/mjs/src/handlers/index.js +20 -0
- package/build/mjs/src/handlers/index.js.map +1 -0
- package/build/mjs/src/index.d.ts +2 -0
- package/build/mjs/src/index.js +19 -0
- package/build/mjs/src/index.js.map +1 -0
- package/build/mjs/tsconfig.cjs.json +10 -0
- package/build/mjs/tsconfig.json +9 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2022 PureStake
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@moonbeam-network/xcm-utils",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"author": "PureStake",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"directory": "packages/utils",
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/PureStake/xcm-sdk.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"moonbeam",
|
|
13
|
+
"moonriver",
|
|
14
|
+
"xcm",
|
|
15
|
+
"utils"
|
|
16
|
+
],
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/PureStake/xcm-sdk/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://docs.moonbeam.network/builders/xcm/xcm-sdk/xcm-sdk/",
|
|
21
|
+
"files": [
|
|
22
|
+
"build"
|
|
23
|
+
],
|
|
24
|
+
"type": "commonjs",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./build/mjs/src/index.d.ts",
|
|
29
|
+
"default": "./build/mjs/src/index.js"
|
|
30
|
+
},
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./build/cjs/src/index.d.ts",
|
|
33
|
+
"default": "./build/cjs/src/index.js"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"types": "./build/cjs/src/index.d.ts",
|
|
38
|
+
"main": "./build/cjs/src/index.js",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@polkadot/api": "^9.5.2",
|
|
41
|
+
"lru-cache": "^7.14.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './polkadot.api';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./polkadot.api"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPolkadotApi = void 0;
|
|
7
|
+
const api_1 = require("@polkadot/api");
|
|
8
|
+
const lru_cache_1 = __importDefault(require("lru-cache"));
|
|
9
|
+
const tenMin = 10 * 60 * 1000;
|
|
10
|
+
const cache = new lru_cache_1.default({
|
|
11
|
+
max: 20,
|
|
12
|
+
ttl: tenMin,
|
|
13
|
+
updateAgeOnGet: true,
|
|
14
|
+
ttlAutopurge: true,
|
|
15
|
+
dispose: async (promise) => {
|
|
16
|
+
const api = await promise;
|
|
17
|
+
if (api.isConnected) {
|
|
18
|
+
api.disconnect();
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
async function getPolkadotApi(ws) {
|
|
23
|
+
const promise = cache.get(ws) ||
|
|
24
|
+
api_1.ApiPromise.create({
|
|
25
|
+
provider: new api_1.WsProvider(ws),
|
|
26
|
+
});
|
|
27
|
+
cache.set(ws, promise);
|
|
28
|
+
const api = await promise;
|
|
29
|
+
await api.isReady;
|
|
30
|
+
return api;
|
|
31
|
+
}
|
|
32
|
+
exports.getPolkadotApi = getPolkadotApi;
|
|
33
|
+
//# sourceMappingURL=polkadot.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polkadot.api.js","sourceRoot":"","sources":["../../../../src/api/polkadot.api.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAuD;AACvD,0DAA4B;AAE5B,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE9B,MAAM,KAAK,GAAG,IAAI,mBAAG,CAA8B;IACjD,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,MAAM;IACX,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK,EAAE,OAA4B,EAAE,EAAE;QAC9C,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC;QAE1B,IAAI,GAAG,CAAC,WAAW,EAAE;YACnB,GAAG,CAAC,UAAU,EAAE,CAAC;SAClB;IACH,CAAC;CACF,CAAC,CAAC;AAEI,KAAK,UAAU,cAAc,CAAC,EAAU;IAC7C,MAAM,OAAO,GACX,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACb,gBAAU,CAAC,MAAM,CAAC;YAChB,QAAQ,EAAE,IAAI,gBAAU,CAAC,EAAE,CAAC;SAC7B,CAAC,CAAC;IAEL,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAEvB,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC;IAE1B,MAAM,GAAG,CAAC,OAAO,CAAC;IAElB,OAAO,GAAG,CAAC;AACb,CAAC;AAdD,wCAcC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ISubmittableResult } from '@polkadot/types/types';
|
|
2
|
+
import { ExtrinsicEventsCallback } from './handlers.interfaces';
|
|
3
|
+
export declare function createExtrinsicEventHandler(pallet: string, successEvent: string, cb: ExtrinsicEventsCallback): ({ events, status, txHash }: ISubmittableResult) => void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createExtrinsicEventHandler = void 0;
|
|
4
|
+
const handlers_interfaces_1 = require("./handlers.interfaces");
|
|
5
|
+
function createExtrinsicEventHandler(pallet, successEvent, cb) {
|
|
6
|
+
return ({ events = [], status, txHash }) => {
|
|
7
|
+
const hash = txHash.toHex();
|
|
8
|
+
if (status.isReady) {
|
|
9
|
+
cb({ status: handlers_interfaces_1.ExtrinsicStatus.Sent, txHash: hash });
|
|
10
|
+
}
|
|
11
|
+
if (status.isInBlock) {
|
|
12
|
+
const block = status.asInBlock.toString();
|
|
13
|
+
events.forEach(({ event: { data, method, section } }) => {
|
|
14
|
+
if (section === pallet && method === successEvent) {
|
|
15
|
+
if (method === 'Attempted') {
|
|
16
|
+
const eventData = data.at(0);
|
|
17
|
+
if (eventData.isIncomplete) {
|
|
18
|
+
cb({
|
|
19
|
+
status: handlers_interfaces_1.ExtrinsicStatus.Failed,
|
|
20
|
+
blockHash: block,
|
|
21
|
+
txHash: hash,
|
|
22
|
+
message: eventData.asIncomplete.toHuman().join('; '),
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
cb({
|
|
28
|
+
status: handlers_interfaces_1.ExtrinsicStatus.Success,
|
|
29
|
+
blockHash: block,
|
|
30
|
+
txHash: hash,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (section === 'system' && method === 'ExtrinsicFailed') {
|
|
34
|
+
cb({
|
|
35
|
+
status: handlers_interfaces_1.ExtrinsicStatus.Failed,
|
|
36
|
+
blockHash: block,
|
|
37
|
+
txHash: hash,
|
|
38
|
+
message: data.join('; '),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
exports.createExtrinsicEventHandler = createExtrinsicEventHandler;
|
|
46
|
+
//# sourceMappingURL=createExtrinsicEventHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createExtrinsicEventHandler.js","sourceRoot":"","sources":["../../../../src/handlers/createExtrinsicEventHandler.ts"],"names":[],"mappings":";;;AACA,+DAG+B;AAE/B,SAAgB,2BAA2B,CACzC,MAAc,EACd,YAAoB,EACpB,EAA2B;IAE3B,OAAO,CAAC,EAAE,MAAM,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAsB,EAAE,EAAE;QAC7D,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAE5B,IAAI,MAAM,CAAC,OAAO,EAAE;YAClB,EAAE,CAAC,EAAE,MAAM,EAAE,qCAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;SACpD;QAED,IAAI,MAAM,CAAC,SAAS,EAAE;YACpB,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;YAE1C,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE;gBACtD,IAAI,OAAO,KAAK,MAAM,IAAI,MAAM,KAAK,YAAY,EAAE;oBACjD,IAAI,MAAM,KAAK,WAAW,EAAE;wBAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAQ,CAAC;wBAEpC,IAAI,SAAS,CAAC,YAAY,EAAE;4BAC1B,EAAE,CAAC;gCACD,MAAM,EAAE,qCAAe,CAAC,MAAM;gCAC9B,SAAS,EAAE,KAAK;gCAChB,MAAM,EAAE,IAAI;gCACZ,OAAO,EAAE,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;6BACrD,CAAC,CAAC;4BAEH,OAAO;yBACR;qBACF;oBAED,EAAE,CAAC;wBACD,MAAM,EAAE,qCAAe,CAAC,OAAO;wBAC/B,SAAS,EAAE,KAAK;wBAChB,MAAM,EAAE,IAAI;qBACb,CAAC,CAAC;iBACJ;gBAED,IAAI,OAAO,KAAK,QAAQ,IAAI,MAAM,KAAK,iBAAiB,EAAE;oBACxD,EAAE,CAAC;wBACD,MAAM,EAAE,qCAAe,CAAC,MAAM;wBAC9B,SAAS,EAAE,KAAK;wBAChB,MAAM,EAAE,IAAI;wBACZ,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;qBACzB,CAAC,CAAC;iBACJ;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC;AAlDD,kEAkDC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Signer as EthersSigner } from 'ethers';
|
|
2
|
+
import { ExtrinsicEventsCallback, Hash } from './handlers.interfaces';
|
|
3
|
+
export declare function createTxEventHandler(ethersSigner: EthersSigner, txHash: Hash, cb: ExtrinsicEventsCallback, skipSentEvent?: boolean): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTxEventHandler = void 0;
|
|
4
|
+
const handlers_interfaces_1 = require("./handlers.interfaces");
|
|
5
|
+
async function createTxEventHandler(ethersSigner, txHash, cb, skipSentEvent = false) {
|
|
6
|
+
if (!ethersSigner.provider) {
|
|
7
|
+
throw new Error('options.ethersSigner has not provider');
|
|
8
|
+
}
|
|
9
|
+
if (!skipSentEvent) {
|
|
10
|
+
cb({ status: handlers_interfaces_1.ExtrinsicStatus.Sent, txHash });
|
|
11
|
+
}
|
|
12
|
+
const tx = await ethersSigner.provider.getTransactionReceipt(txHash);
|
|
13
|
+
if (!tx) {
|
|
14
|
+
setTimeout(() => createTxEventHandler(ethersSigner, txHash, cb, true), 2000);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (tx.status === 1) {
|
|
18
|
+
cb({
|
|
19
|
+
status: handlers_interfaces_1.ExtrinsicStatus.Success,
|
|
20
|
+
blockHash: tx.blockHash,
|
|
21
|
+
txHash,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
cb({
|
|
26
|
+
status: handlers_interfaces_1.ExtrinsicStatus.Failed,
|
|
27
|
+
blockHash: tx.blockHash,
|
|
28
|
+
txHash,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.createTxEventHandler = createTxEventHandler;
|
|
33
|
+
//# sourceMappingURL=createTxEventHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTxEventHandler.js","sourceRoot":"","sources":["../../../../src/handlers/createTxEventHandler.ts"],"names":[],"mappings":";;;AACA,+DAI+B;AAExB,KAAK,UAAU,oBAAoB,CACxC,YAA0B,EAC1B,MAAY,EACZ,EAA2B,EAC3B,aAAa,GAAG,KAAK;IAErB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;KAC1D;IAED,IAAI,CAAC,aAAa,EAAE;QAClB,EAAE,CAAC,EAAE,MAAM,EAAE,qCAAe,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;KAC9C;IAED,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAErE,IAAI,CAAC,EAAE,EAAE;QACP,UAAU,CACR,GAAG,EAAE,CAAC,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,EAC1D,IAAI,CACL,CAAC;QACF,OAAO;KACR;IAED,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;QACnB,EAAE,CAAC;YACD,MAAM,EAAE,qCAAe,CAAC,OAAO;YAC/B,SAAS,EAAE,EAAE,CAAC,SAAS;YACvB,MAAM;SACP,CAAC,CAAC;KACJ;SAAM;QACL,EAAE,CAAC;YACD,MAAM,EAAE,qCAAe,CAAC,MAAM;YAC9B,SAAS,EAAE,EAAE,CAAC,SAAS;YACvB,MAAM;SACP,CAAC,CAAC;KACJ;AACH,CAAC;AArCD,oDAqCC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare type Hash = string;
|
|
2
|
+
export declare type ExtrinsicEventsCallback = (event: ExtrinsicEvent) => void;
|
|
3
|
+
export declare type ExtrinsicEvent = ExtrinsicFailedEvent | ExtrinsicSentEvent | ExtrinsicSuccessEvent;
|
|
4
|
+
export interface ExtrinsicFailedEvent {
|
|
5
|
+
blockHash: Hash;
|
|
6
|
+
message?: string;
|
|
7
|
+
status: ExtrinsicStatus.Failed;
|
|
8
|
+
txHash: Hash;
|
|
9
|
+
}
|
|
10
|
+
export interface ExtrinsicSentEvent {
|
|
11
|
+
status: ExtrinsicStatus.Sent;
|
|
12
|
+
txHash: Hash;
|
|
13
|
+
}
|
|
14
|
+
export interface ExtrinsicSuccessEvent {
|
|
15
|
+
blockHash: Hash;
|
|
16
|
+
status: ExtrinsicStatus.Success;
|
|
17
|
+
txHash: Hash;
|
|
18
|
+
}
|
|
19
|
+
export declare enum ExtrinsicStatus {
|
|
20
|
+
Failed = "Failed",
|
|
21
|
+
Sent = "Sent",
|
|
22
|
+
Success = "Success"
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtrinsicStatus = void 0;
|
|
4
|
+
var ExtrinsicStatus;
|
|
5
|
+
(function (ExtrinsicStatus) {
|
|
6
|
+
ExtrinsicStatus["Failed"] = "Failed";
|
|
7
|
+
ExtrinsicStatus["Sent"] = "Sent";
|
|
8
|
+
ExtrinsicStatus["Success"] = "Success";
|
|
9
|
+
})(ExtrinsicStatus = exports.ExtrinsicStatus || (exports.ExtrinsicStatus = {}));
|
|
10
|
+
//# sourceMappingURL=handlers.interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.interfaces.js","sourceRoot":"","sources":["../../../../src/handlers/handlers.interfaces.ts"],"names":[],"mappings":";;;AA2BA,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,gCAAa,CAAA;IACb,sCAAmB,CAAA;AACrB,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./createExtrinsicEventHandler"), exports);
|
|
18
|
+
__exportStar(require("./createTxEventHandler"), exports);
|
|
19
|
+
__exportStar(require("./handlers.interfaces"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/handlers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,yDAAuC;AACvC,wDAAsC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api"), exports);
|
|
18
|
+
__exportStar(require("./handlers"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,6CAA2B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@moonbeam-network/xcm-utils",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"author": "PureStake",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"directory": "packages/utils",
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/PureStake/xcm-sdk.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"moonbeam",
|
|
13
|
+
"moonriver",
|
|
14
|
+
"xcm",
|
|
15
|
+
"utils"
|
|
16
|
+
],
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/PureStake/xcm-sdk/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://docs.moonbeam.network/builders/xcm/xcm-sdk/xcm-sdk/",
|
|
21
|
+
"files": [
|
|
22
|
+
"build"
|
|
23
|
+
],
|
|
24
|
+
"type": "commonjs",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./build/mjs/src/index.d.ts",
|
|
29
|
+
"default": "./build/mjs/src/index.js"
|
|
30
|
+
},
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./build/cjs/src/index.d.ts",
|
|
33
|
+
"default": "./build/cjs/src/index.js"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"types": "./build/cjs/src/index.d.ts",
|
|
38
|
+
"main": "./build/cjs/src/index.js",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@polkadot/api": "^9.5.2",
|
|
41
|
+
"lru-cache": "^7.14.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './polkadot.api';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./polkadot.api"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPolkadotApi = void 0;
|
|
7
|
+
const api_1 = require("@polkadot/api");
|
|
8
|
+
const lru_cache_1 = __importDefault(require("lru-cache"));
|
|
9
|
+
const tenMin = 10 * 60 * 1000;
|
|
10
|
+
const cache = new lru_cache_1.default({
|
|
11
|
+
max: 20,
|
|
12
|
+
ttl: tenMin,
|
|
13
|
+
updateAgeOnGet: true,
|
|
14
|
+
ttlAutopurge: true,
|
|
15
|
+
dispose: async (promise) => {
|
|
16
|
+
const api = await promise;
|
|
17
|
+
if (api.isConnected) {
|
|
18
|
+
api.disconnect();
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
async function getPolkadotApi(ws) {
|
|
23
|
+
const promise = cache.get(ws) ||
|
|
24
|
+
api_1.ApiPromise.create({
|
|
25
|
+
provider: new api_1.WsProvider(ws),
|
|
26
|
+
});
|
|
27
|
+
cache.set(ws, promise);
|
|
28
|
+
const api = await promise;
|
|
29
|
+
await api.isReady;
|
|
30
|
+
return api;
|
|
31
|
+
}
|
|
32
|
+
exports.getPolkadotApi = getPolkadotApi;
|
|
33
|
+
//# sourceMappingURL=polkadot.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polkadot.api.js","sourceRoot":"","sources":["../../../../src/api/polkadot.api.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAuD;AACvD,0DAA4B;AAE5B,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE9B,MAAM,KAAK,GAAG,IAAI,mBAAG,CAA8B;IACjD,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,MAAM;IACX,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK,EAAE,OAA4B,EAAE,EAAE;QAC9C,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC;QAE1B,IAAI,GAAG,CAAC,WAAW,EAAE;YACnB,GAAG,CAAC,UAAU,EAAE,CAAC;SAClB;IACH,CAAC;CACF,CAAC,CAAC;AAEI,KAAK,UAAU,cAAc,CAAC,EAAU;IAC7C,MAAM,OAAO,GACX,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACb,gBAAU,CAAC,MAAM,CAAC;YAChB,QAAQ,EAAE,IAAI,gBAAU,CAAC,EAAE,CAAC;SAC7B,CAAC,CAAC;IAEL,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAEvB,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC;IAE1B,MAAM,GAAG,CAAC,OAAO,CAAC;IAElB,OAAO,GAAG,CAAC;AACb,CAAC;AAdD,wCAcC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ISubmittableResult } from '@polkadot/types/types';
|
|
2
|
+
import { ExtrinsicEventsCallback } from './handlers.interfaces';
|
|
3
|
+
export declare function createExtrinsicEventHandler(pallet: string, successEvent: string, cb: ExtrinsicEventsCallback): ({ events, status, txHash }: ISubmittableResult) => void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createExtrinsicEventHandler = void 0;
|
|
4
|
+
const handlers_interfaces_1 = require("./handlers.interfaces");
|
|
5
|
+
function createExtrinsicEventHandler(pallet, successEvent, cb) {
|
|
6
|
+
return ({ events = [], status, txHash }) => {
|
|
7
|
+
const hash = txHash.toHex();
|
|
8
|
+
if (status.isReady) {
|
|
9
|
+
cb({ status: handlers_interfaces_1.ExtrinsicStatus.Sent, txHash: hash });
|
|
10
|
+
}
|
|
11
|
+
if (status.isInBlock) {
|
|
12
|
+
const block = status.asInBlock.toString();
|
|
13
|
+
events.forEach(({ event: { data, method, section } }) => {
|
|
14
|
+
if (section === pallet && method === successEvent) {
|
|
15
|
+
if (method === 'Attempted') {
|
|
16
|
+
const eventData = data.at(0);
|
|
17
|
+
if (eventData.isIncomplete) {
|
|
18
|
+
cb({
|
|
19
|
+
status: handlers_interfaces_1.ExtrinsicStatus.Failed,
|
|
20
|
+
blockHash: block,
|
|
21
|
+
txHash: hash,
|
|
22
|
+
message: eventData.asIncomplete.toHuman().join('; '),
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
cb({
|
|
28
|
+
status: handlers_interfaces_1.ExtrinsicStatus.Success,
|
|
29
|
+
blockHash: block,
|
|
30
|
+
txHash: hash,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (section === 'system' && method === 'ExtrinsicFailed') {
|
|
34
|
+
cb({
|
|
35
|
+
status: handlers_interfaces_1.ExtrinsicStatus.Failed,
|
|
36
|
+
blockHash: block,
|
|
37
|
+
txHash: hash,
|
|
38
|
+
message: data.join('; '),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
exports.createExtrinsicEventHandler = createExtrinsicEventHandler;
|
|
46
|
+
//# sourceMappingURL=createExtrinsicEventHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createExtrinsicEventHandler.js","sourceRoot":"","sources":["../../../../src/handlers/createExtrinsicEventHandler.ts"],"names":[],"mappings":";;;AACA,+DAG+B;AAE/B,SAAgB,2BAA2B,CACzC,MAAc,EACd,YAAoB,EACpB,EAA2B;IAE3B,OAAO,CAAC,EAAE,MAAM,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAsB,EAAE,EAAE;QAC7D,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAE5B,IAAI,MAAM,CAAC,OAAO,EAAE;YAClB,EAAE,CAAC,EAAE,MAAM,EAAE,qCAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;SACpD;QAED,IAAI,MAAM,CAAC,SAAS,EAAE;YACpB,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;YAE1C,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE;gBACtD,IAAI,OAAO,KAAK,MAAM,IAAI,MAAM,KAAK,YAAY,EAAE;oBACjD,IAAI,MAAM,KAAK,WAAW,EAAE;wBAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAQ,CAAC;wBAEpC,IAAI,SAAS,CAAC,YAAY,EAAE;4BAC1B,EAAE,CAAC;gCACD,MAAM,EAAE,qCAAe,CAAC,MAAM;gCAC9B,SAAS,EAAE,KAAK;gCAChB,MAAM,EAAE,IAAI;gCACZ,OAAO,EAAE,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;6BACrD,CAAC,CAAC;4BAEH,OAAO;yBACR;qBACF;oBAED,EAAE,CAAC;wBACD,MAAM,EAAE,qCAAe,CAAC,OAAO;wBAC/B,SAAS,EAAE,KAAK;wBAChB,MAAM,EAAE,IAAI;qBACb,CAAC,CAAC;iBACJ;gBAED,IAAI,OAAO,KAAK,QAAQ,IAAI,MAAM,KAAK,iBAAiB,EAAE;oBACxD,EAAE,CAAC;wBACD,MAAM,EAAE,qCAAe,CAAC,MAAM;wBAC9B,SAAS,EAAE,KAAK;wBAChB,MAAM,EAAE,IAAI;wBACZ,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;qBACzB,CAAC,CAAC;iBACJ;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC;AAlDD,kEAkDC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Signer as EthersSigner } from 'ethers';
|
|
2
|
+
import { ExtrinsicEventsCallback, Hash } from './handlers.interfaces';
|
|
3
|
+
export declare function createTxEventHandler(ethersSigner: EthersSigner, txHash: Hash, cb: ExtrinsicEventsCallback, skipSentEvent?: boolean): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTxEventHandler = void 0;
|
|
4
|
+
const handlers_interfaces_1 = require("./handlers.interfaces");
|
|
5
|
+
async function createTxEventHandler(ethersSigner, txHash, cb, skipSentEvent = false) {
|
|
6
|
+
if (!ethersSigner.provider) {
|
|
7
|
+
throw new Error('options.ethersSigner has not provider');
|
|
8
|
+
}
|
|
9
|
+
if (!skipSentEvent) {
|
|
10
|
+
cb({ status: handlers_interfaces_1.ExtrinsicStatus.Sent, txHash });
|
|
11
|
+
}
|
|
12
|
+
const tx = await ethersSigner.provider.getTransactionReceipt(txHash);
|
|
13
|
+
if (!tx) {
|
|
14
|
+
setTimeout(() => createTxEventHandler(ethersSigner, txHash, cb, true), 2000);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (tx.status === 1) {
|
|
18
|
+
cb({
|
|
19
|
+
status: handlers_interfaces_1.ExtrinsicStatus.Success,
|
|
20
|
+
blockHash: tx.blockHash,
|
|
21
|
+
txHash,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
cb({
|
|
26
|
+
status: handlers_interfaces_1.ExtrinsicStatus.Failed,
|
|
27
|
+
blockHash: tx.blockHash,
|
|
28
|
+
txHash,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.createTxEventHandler = createTxEventHandler;
|
|
33
|
+
//# sourceMappingURL=createTxEventHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTxEventHandler.js","sourceRoot":"","sources":["../../../../src/handlers/createTxEventHandler.ts"],"names":[],"mappings":";;;AACA,+DAI+B;AAExB,KAAK,UAAU,oBAAoB,CACxC,YAA0B,EAC1B,MAAY,EACZ,EAA2B,EAC3B,aAAa,GAAG,KAAK;IAErB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;KAC1D;IAED,IAAI,CAAC,aAAa,EAAE;QAClB,EAAE,CAAC,EAAE,MAAM,EAAE,qCAAe,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;KAC9C;IAED,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAErE,IAAI,CAAC,EAAE,EAAE;QACP,UAAU,CACR,GAAG,EAAE,CAAC,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,EAC1D,IAAI,CACL,CAAC;QACF,OAAO;KACR;IAED,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;QACnB,EAAE,CAAC;YACD,MAAM,EAAE,qCAAe,CAAC,OAAO;YAC/B,SAAS,EAAE,EAAE,CAAC,SAAS;YACvB,MAAM;SACP,CAAC,CAAC;KACJ;SAAM;QACL,EAAE,CAAC;YACD,MAAM,EAAE,qCAAe,CAAC,MAAM;YAC9B,SAAS,EAAE,EAAE,CAAC,SAAS;YACvB,MAAM;SACP,CAAC,CAAC;KACJ;AACH,CAAC;AArCD,oDAqCC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare type Hash = string;
|
|
2
|
+
export declare type ExtrinsicEventsCallback = (event: ExtrinsicEvent) => void;
|
|
3
|
+
export declare type ExtrinsicEvent = ExtrinsicFailedEvent | ExtrinsicSentEvent | ExtrinsicSuccessEvent;
|
|
4
|
+
export interface ExtrinsicFailedEvent {
|
|
5
|
+
blockHash: Hash;
|
|
6
|
+
message?: string;
|
|
7
|
+
status: ExtrinsicStatus.Failed;
|
|
8
|
+
txHash: Hash;
|
|
9
|
+
}
|
|
10
|
+
export interface ExtrinsicSentEvent {
|
|
11
|
+
status: ExtrinsicStatus.Sent;
|
|
12
|
+
txHash: Hash;
|
|
13
|
+
}
|
|
14
|
+
export interface ExtrinsicSuccessEvent {
|
|
15
|
+
blockHash: Hash;
|
|
16
|
+
status: ExtrinsicStatus.Success;
|
|
17
|
+
txHash: Hash;
|
|
18
|
+
}
|
|
19
|
+
export declare enum ExtrinsicStatus {
|
|
20
|
+
Failed = "Failed",
|
|
21
|
+
Sent = "Sent",
|
|
22
|
+
Success = "Success"
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtrinsicStatus = void 0;
|
|
4
|
+
var ExtrinsicStatus;
|
|
5
|
+
(function (ExtrinsicStatus) {
|
|
6
|
+
ExtrinsicStatus["Failed"] = "Failed";
|
|
7
|
+
ExtrinsicStatus["Sent"] = "Sent";
|
|
8
|
+
ExtrinsicStatus["Success"] = "Success";
|
|
9
|
+
})(ExtrinsicStatus = exports.ExtrinsicStatus || (exports.ExtrinsicStatus = {}));
|
|
10
|
+
//# sourceMappingURL=handlers.interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.interfaces.js","sourceRoot":"","sources":["../../../../src/handlers/handlers.interfaces.ts"],"names":[],"mappings":";;;AA2BA,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,gCAAa,CAAA;IACb,sCAAmB,CAAA;AACrB,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./createExtrinsicEventHandler"), exports);
|
|
18
|
+
__exportStar(require("./createTxEventHandler"), exports);
|
|
19
|
+
__exportStar(require("./handlers.interfaces"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/handlers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,yDAAuC;AACvC,wDAAsC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api"), exports);
|
|
18
|
+
__exportStar(require("./handlers"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,6CAA2B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@moonbeam-network/xcm-utils",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"author": "PureStake",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"directory": "packages/utils",
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/PureStake/xcm-sdk.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"moonbeam",
|
|
13
|
+
"moonriver",
|
|
14
|
+
"xcm",
|
|
15
|
+
"utils"
|
|
16
|
+
],
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/PureStake/xcm-sdk/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://docs.moonbeam.network/builders/xcm/xcm-sdk/xcm-sdk/",
|
|
21
|
+
"files": [
|
|
22
|
+
"build"
|
|
23
|
+
],
|
|
24
|
+
"type": "commonjs",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./build/mjs/src/index.d.ts",
|
|
29
|
+
"default": "./build/mjs/src/index.js"
|
|
30
|
+
},
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./build/cjs/src/index.d.ts",
|
|
33
|
+
"default": "./build/cjs/src/index.js"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"types": "./build/cjs/src/index.d.ts",
|
|
38
|
+
"main": "./build/cjs/src/index.js",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@polkadot/api": "^9.5.2",
|
|
41
|
+
"lru-cache": "^7.14.0"
|
|
42
|
+
}
|
|
43
|
+
}
|