@meshsdk/core 1.6.0-alpha.2 → 1.6.0-alpha.4
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/dist/common/constants.d.ts +58 -0
- package/dist/common/contracts/evaluator.d.ts +4 -0
- package/dist/common/contracts/fetcher.d.ts +22 -0
- package/dist/common/contracts/index.d.ts +7 -0
- package/dist/common/contracts/initiator.d.ts +8 -0
- package/dist/common/contracts/listener.d.ts +3 -0
- package/dist/common/contracts/signer.d.ts +8 -0
- package/dist/common/contracts/submitter.d.ts +3 -0
- package/dist/common/contracts/uploader.d.ts +3 -0
- package/dist/common/data/index.d.ts +2 -0
- package/dist/common/data/mesh.d.ts +8 -0
- package/dist/common/data/plutus.d.ts +72 -0
- package/dist/common/helpers/generateNonce.d.ts +1 -0
- package/dist/common/helpers/index.d.ts +2 -0
- package/dist/common/helpers/readPlutusData.d.ts +2 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/utils/parser.d.ts +5 -0
- package/dist/common/utils/resolver.d.ts +17 -0
- package/dist/core/CIP2.d.ts +4 -0
- package/dist/core/CIP8.d.ts +15 -0
- package/dist/index.d.ts +12 -0
- package/dist/providers/blockfrost.provider.d.ts +46 -0
- package/dist/providers/index.d.ts +6 -0
- package/dist/providers/infura.provider.d.ts +12 -0
- package/dist/providers/koios.provider.d.ts +27 -0
- package/dist/providers/maestro.provider.d.ts +35 -0
- package/dist/providers/ogmios.provider.d.ts +12 -0
- package/dist/providers/tango.provider.d.ts +25 -0
- package/dist/scripts/forge.script.d.ts +8 -0
- package/dist/scripts/index.d.ts +1 -0
- package/dist/transaction/index.d.ts +2 -0
- package/dist/transaction/meshTxBuilder/index.d.ts +2 -0
- package/dist/transaction/meshTxBuilder/meshTxBuilder.service.d.ts +47 -0
- package/dist/transaction/meshTxBuilder/meshTxBuilderCore.d.ts +320 -0
- package/dist/transaction/meshTxBuilder/type.d.ts +128 -0
- package/dist/transaction/transaction.service.d.ts +150 -0
- package/dist/types/Account.d.ts +5 -0
- package/dist/types/AccountInfo.d.ts +7 -0
- package/dist/types/Action.d.ts +12 -0
- package/dist/types/Asset.d.ts +6 -0
- package/dist/types/AssetExtended.d.ts +8 -0
- package/dist/types/AssetMetadata.d.ts +24 -0
- package/dist/types/BlockInfo.d.ts +17 -0
- package/dist/types/Data.d.ts +4 -0
- package/dist/types/DataSignature.d.ts +4 -0
- package/dist/types/Era.d.ts +1 -0
- package/dist/types/Mint.d.ts +10 -0
- package/dist/types/NativeScript.d.ts +14 -0
- package/dist/types/Network.d.ts +4 -0
- package/dist/types/PlutusScript.d.ts +6 -0
- package/dist/types/PoolParams.d.ts +16 -0
- package/dist/types/Protocol.d.ts +22 -0
- package/dist/types/Recipient.d.ts +11 -0
- package/dist/types/Relay.d.ts +13 -0
- package/dist/types/Token.d.ts +2 -0
- package/dist/types/TransactionInfo.d.ts +11 -0
- package/dist/types/UTxO.d.ts +15 -0
- package/dist/types/Wallet.d.ts +5 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/wallet/app.service.d.ts +36 -0
- package/dist/wallet/browser.service.d.ts +62 -0
- package/dist/wallet/embedded.service.d.ts +20 -0
- package/dist/wallet/index.d.ts +3 -0
- package/package.json +2 -3
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { csl } from '@mesh/core';
|
|
2
|
+
import type { Costmdls } from '@mesh/core';
|
|
3
|
+
import type { Budget, Era, Network, Protocol } from '../types';
|
|
4
|
+
export declare const DEFAULT_REDEEMER_BUDGET: Budget;
|
|
5
|
+
export declare const DEFAULT_PROTOCOL_PARAMETERS: Protocol;
|
|
6
|
+
export declare const HARDENED_KEY_START = 2147483648;
|
|
7
|
+
export declare const LANGUAGE_VERSIONS: {
|
|
8
|
+
V1: csl.Language;
|
|
9
|
+
V2: csl.Language;
|
|
10
|
+
};
|
|
11
|
+
export declare const POLICY_ID_LENGTH = 56;
|
|
12
|
+
export declare const REDEEMER_TAGS: {
|
|
13
|
+
CERT: csl.RedeemerTag;
|
|
14
|
+
MINT: csl.RedeemerTag;
|
|
15
|
+
REWARD: csl.RedeemerTag;
|
|
16
|
+
SPEND: csl.RedeemerTag;
|
|
17
|
+
};
|
|
18
|
+
export declare const SUPPORTED_CLOCKS: Record<Network, [
|
|
19
|
+
epoch: string,
|
|
20
|
+
slot: string,
|
|
21
|
+
systemStart: string,
|
|
22
|
+
epochLength: string
|
|
23
|
+
]>;
|
|
24
|
+
export declare const SUPPORTED_COST_MODELS: Record<Era, Costmdls>;
|
|
25
|
+
export declare const SUPPORTED_LANGUAGE_VIEWS: Record<Era, Partial<Record<keyof typeof LANGUAGE_VERSIONS, string>>>;
|
|
26
|
+
export declare const SUPPORTED_HANDLES: Record<number, string>;
|
|
27
|
+
export declare const SUPPORTED_OGMIOS_LINKS: Record<Network, string>;
|
|
28
|
+
export declare const SUPPORTED_TOKENS: {
|
|
29
|
+
LQ: string;
|
|
30
|
+
MIN: string;
|
|
31
|
+
NTX: string;
|
|
32
|
+
iBTC: string;
|
|
33
|
+
iETH: string;
|
|
34
|
+
iUSD: string;
|
|
35
|
+
MILK: string;
|
|
36
|
+
AGIX: string;
|
|
37
|
+
MELD: string;
|
|
38
|
+
INDY: string;
|
|
39
|
+
CLAY: string;
|
|
40
|
+
MCOS: string;
|
|
41
|
+
DING: string;
|
|
42
|
+
GERO: string;
|
|
43
|
+
NMKR: string;
|
|
44
|
+
PAVIA: string;
|
|
45
|
+
HOSKY: string;
|
|
46
|
+
YUMMI: string;
|
|
47
|
+
C3: string;
|
|
48
|
+
GIMBAL: string;
|
|
49
|
+
SUNDAE: string;
|
|
50
|
+
GREENS: string;
|
|
51
|
+
GENS: string;
|
|
52
|
+
SOCIETY: string;
|
|
53
|
+
DJED: string;
|
|
54
|
+
SHEN: string;
|
|
55
|
+
WMT: string;
|
|
56
|
+
COPI: string;
|
|
57
|
+
};
|
|
58
|
+
export declare const SUPPORTED_WALLETS: string[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AccountInfo, Asset, AssetMetadata, BlockInfo, Protocol, TransactionInfo, UTxO } from '@mesh/types';
|
|
2
|
+
/**
|
|
3
|
+
* Fetcher interface defines end points to query blockchain data.
|
|
4
|
+
*/
|
|
5
|
+
export interface IFetcher {
|
|
6
|
+
fetchAccountInfo(address: string): Promise<AccountInfo>;
|
|
7
|
+
fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
|
|
8
|
+
fetchAssetAddresses(asset: string): Promise<{
|
|
9
|
+
address: string;
|
|
10
|
+
quantity: string;
|
|
11
|
+
}[]>;
|
|
12
|
+
fetchAssetMetadata(asset: string): Promise<AssetMetadata>;
|
|
13
|
+
fetchBlockInfo(hash: string): Promise<BlockInfo>;
|
|
14
|
+
fetchCollectionAssets(policyId: string, cursor?: number | string): Promise<{
|
|
15
|
+
assets: Asset[];
|
|
16
|
+
next: string | number | null;
|
|
17
|
+
}>;
|
|
18
|
+
fetchHandleAddress(handle: string): Promise<string>;
|
|
19
|
+
fetchProtocolParameters(epoch: number): Promise<Protocol>;
|
|
20
|
+
fetchTxInfo(hash: string): Promise<TransactionInfo>;
|
|
21
|
+
fetchUTxOs(hash: string): Promise<UTxO[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Address, TransactionUnspentOutput } from '@mesh/core';
|
|
2
|
+
export interface IInitiator {
|
|
3
|
+
getUsedAddress(): SometimesPromise<Address>;
|
|
4
|
+
getUsedCollateral(limit?: number): SometimesPromise<TransactionUnspentOutput[]>;
|
|
5
|
+
getUsedUTxOs(): SometimesPromise<TransactionUnspentOutput[]>;
|
|
6
|
+
}
|
|
7
|
+
declare type SometimesPromise<T> = Promise<T> | T;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataSignature } from '@mesh/types';
|
|
2
|
+
export interface ISigner {
|
|
3
|
+
signData(address: string, payload: string): SometimesPromise<DataSignature>;
|
|
4
|
+
signTx(unsignedTx: string, partialSign: boolean): SometimesPromise<string>;
|
|
5
|
+
signTxs(unsignedTxs: string[], partialSign: boolean): SometimesPromise<string[]>;
|
|
6
|
+
}
|
|
7
|
+
declare type SometimesPromise<T> = Promise<T> | T;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Data } from '@mesh/types';
|
|
2
|
+
export declare const mConStr: <T extends Data[]>(alternative: number, fields: T) => Data;
|
|
3
|
+
export declare const mConStr0: <T extends Data[]>(fields: T) => Data;
|
|
4
|
+
export declare const mConStr1: <T extends Data[]>(fields: T) => Data;
|
|
5
|
+
export declare const mConStr2: <T extends Data[]>(fields: T) => Data;
|
|
6
|
+
export declare const mMaybeStakingHash: (stakeCredential: string) => Data;
|
|
7
|
+
export declare const mPubKeyAddress: (bytes: string, stakeCredential?: string) => Data;
|
|
8
|
+
export declare const mScriptAddress: (bytes: string, stakeCredential?: string) => Data;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Asset } from '@mesh/types';
|
|
2
|
+
export declare type ConStr<N = any, T = any> = {
|
|
3
|
+
constructor: N;
|
|
4
|
+
fields: T;
|
|
5
|
+
};
|
|
6
|
+
export declare type ConStr0<T = any> = ConStr<0, T>;
|
|
7
|
+
export declare type ConStr1<T = any> = ConStr<1, T>;
|
|
8
|
+
export declare type ConStr2<T = any> = ConStr<2, T>;
|
|
9
|
+
export declare type Bool = ConStr0<[]> | ConStr1<[]>;
|
|
10
|
+
export declare type BuiltinByteString = {
|
|
11
|
+
bytes: string;
|
|
12
|
+
};
|
|
13
|
+
export declare type Integer = {
|
|
14
|
+
int: number;
|
|
15
|
+
};
|
|
16
|
+
export declare type List = {
|
|
17
|
+
list: PlutusData[];
|
|
18
|
+
};
|
|
19
|
+
export declare type ValidatorHash = BuiltinByteString;
|
|
20
|
+
export declare type PaymentPubKeyHash = BuiltinByteString;
|
|
21
|
+
export declare type PubKeyHash = PaymentPubKeyHash;
|
|
22
|
+
export declare type POSIXTime = Integer;
|
|
23
|
+
export declare type CurrencySymbol = BuiltinByteString;
|
|
24
|
+
export declare type TokenName = BuiltinByteString;
|
|
25
|
+
export declare type MaybeStakingHash = ConStr1<[]> | ConStr0<[ConStr0<[ConStr0<[BuiltinByteString]>]>]>;
|
|
26
|
+
export declare type PubKeyAddress = ConStr0<[ConStr0<[PubKeyHash]>, MaybeStakingHash]>;
|
|
27
|
+
export declare type ScriptAddress = ConStr0<[
|
|
28
|
+
ConStr1<[ValidatorHash]>,
|
|
29
|
+
MaybeStakingHash
|
|
30
|
+
]>;
|
|
31
|
+
export declare type AssetClass = ConStr0<[CurrencySymbol, TokenName]>;
|
|
32
|
+
export declare type TxOutRef = ConStr0<[ConStr0<[BuiltinByteString]>, Integer]>;
|
|
33
|
+
export declare type AssocMapItem<K, V> = {
|
|
34
|
+
k: K;
|
|
35
|
+
v: V;
|
|
36
|
+
};
|
|
37
|
+
export declare type DictItem<K, V> = {
|
|
38
|
+
k: K;
|
|
39
|
+
v: V;
|
|
40
|
+
};
|
|
41
|
+
export declare type AssocMap<K, V> = {
|
|
42
|
+
map: AssocMapItem<K, V>[];
|
|
43
|
+
};
|
|
44
|
+
export declare type Dict<K, V> = {
|
|
45
|
+
map: DictItem<K, V>[];
|
|
46
|
+
};
|
|
47
|
+
export declare type Tuple<K, V> = ConStr0<[K, V]>;
|
|
48
|
+
export declare type Value = AssocMap<CurrencySymbol, AssocMap<TokenName, Integer>>;
|
|
49
|
+
export declare type PlutusData = BuiltinByteString | Integer | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | PaymentPubKeyHash | PubKeyHash | POSIXTime | TxOutRef;
|
|
50
|
+
export declare const conStr: <N, T>(constructor: N, fields: T) => ConStr<N, T>;
|
|
51
|
+
export declare const conStr0: <T>(fields: T) => ConStr0<T>;
|
|
52
|
+
export declare const conStr1: <T>(fields: T) => ConStr1<T>;
|
|
53
|
+
export declare const conStr2: <T>(fields: T) => ConStr2<T>;
|
|
54
|
+
export declare const bool: (b: boolean) => Bool;
|
|
55
|
+
export declare const builtinByteString: (bytes: string) => BuiltinByteString;
|
|
56
|
+
export declare const integer: (int: number) => Integer;
|
|
57
|
+
export declare const list: (pList: PlutusData[]) => List;
|
|
58
|
+
export declare const currencySymbol: (bytes: string) => CurrencySymbol;
|
|
59
|
+
export declare const tokenName: (bytes: string) => TokenName;
|
|
60
|
+
export declare const maybeStakingHash: (stakeCredential: string) => MaybeStakingHash;
|
|
61
|
+
export declare const pubKeyAddress: (bytes: string, stakeCredential?: string) => PubKeyAddress;
|
|
62
|
+
export declare const scriptAddress: (bytes: string, stakeCredential?: string) => ScriptAddress;
|
|
63
|
+
export declare const assetClass: (policyId: string, assetName: string) => AssetClass;
|
|
64
|
+
export declare const txOutRef: (txHash: string, index: number) => TxOutRef;
|
|
65
|
+
export declare const paymentPubKeyHash: (bytes: string) => PaymentPubKeyHash;
|
|
66
|
+
export declare const pubKeyHash: (bytes: string) => PubKeyHash;
|
|
67
|
+
export declare const posixTime: (int: number) => POSIXTime;
|
|
68
|
+
export declare const assocMap: <K, V>(itemsMap: [K, V][]) => AssocMap<K, V>;
|
|
69
|
+
export declare const dict: <K, V>(itemsMap: [K, V][]) => AssocMap<K, V>;
|
|
70
|
+
export declare const tuple: <K, V>(key: K, value: V) => Tuple<K, V>;
|
|
71
|
+
export declare const value: (assets: Asset[]) => Value;
|
|
72
|
+
export declare const parsePlutusValueToAssets: (plutusValue: Value) => Asset[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateNonce: (label?: string, length?: number) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './data';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Data, Era, LanguageVersion, NativeScript, Network, PlutusScript } from '@mesh/types';
|
|
2
|
+
export declare const resolveDataHash: (data: Data) => string;
|
|
3
|
+
export declare const resolveEpochNo: (network: Network, milliseconds?: number) => number;
|
|
4
|
+
export declare const resolveFingerprint: (policyId: string, assetName: string) => string;
|
|
5
|
+
export declare const resolveLanguageView: (era: Era, version: LanguageVersion) => string | undefined;
|
|
6
|
+
export declare const resolveNativeScriptHash: (script: NativeScript) => string;
|
|
7
|
+
export declare const resolvePaymentKeyHash: (bech32: string) => string;
|
|
8
|
+
export declare const resolvePlutusScriptAddress: (script: PlutusScript, networkId?: number) => string;
|
|
9
|
+
export declare const resolvePlutusScriptHash: (bech32: string) => string;
|
|
10
|
+
export declare const resolvePoolId: (hash: string) => string;
|
|
11
|
+
export declare const resolvePrivateKey: (words: string[]) => string;
|
|
12
|
+
export declare const resolveScriptRef: (script: PlutusScript | NativeScript) => string;
|
|
13
|
+
export declare const resolveSlotNo: (network: Network, milliseconds?: number) => string;
|
|
14
|
+
export declare const resolveRewardAddress: (bech32: string) => string;
|
|
15
|
+
export declare const resolveStakeKeyHash: (bech32: string) => string;
|
|
16
|
+
export declare const resolveTxFees: (txSize: number, minFeeA?: number, minFeeB?: number) => string;
|
|
17
|
+
export declare const resolveTxHash: (txHex: string) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Protocol, Quantity, Unit, UTxO } from '@mesh/types';
|
|
2
|
+
export declare const keepRelevant: (requestedOutputSet: Map<Unit, Quantity>, initialUTxOSet: UTxO[], minimumLovelaceRequired?: string) => UTxO[];
|
|
3
|
+
export declare const largestFirst: (lovelace: Quantity, initialUTxOSet: UTxO[], includeTxFees?: boolean, { maxTxSize, minFeeA, minFeeB }?: Protocol) => UTxO[];
|
|
4
|
+
export declare const largestFirstMultiAsset: (requestedOutputSet: Map<Unit, Quantity>, initialUTxOSet: UTxO[], includeTxFees?: boolean, parameters?: Protocol) => UTxO[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DataSignature } from '@mesh/types';
|
|
2
|
+
import type { Address, PrivateKey } from '@mesh/core';
|
|
3
|
+
export declare const signMessage: (message: Message, signer: Signer) => {
|
|
4
|
+
coseKey: string;
|
|
5
|
+
coseSign1: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const checkSignature: (message: string, signer: string, { key, signature }: DataSignature) => boolean;
|
|
8
|
+
export declare type Message = {
|
|
9
|
+
payload: string;
|
|
10
|
+
externalAAD?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare type Signer = {
|
|
13
|
+
address: Address;
|
|
14
|
+
key: PrivateKey;
|
|
15
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './common/contracts';
|
|
2
|
+
export * from './common/data';
|
|
3
|
+
export { generateNonce, readPlutusData } from './common/helpers';
|
|
4
|
+
export * from './common/utils/resolver';
|
|
5
|
+
export * from './common/utils/parser';
|
|
6
|
+
export * from './core/CIP2';
|
|
7
|
+
export { checkSignature } from './core/CIP8';
|
|
8
|
+
export * from './providers';
|
|
9
|
+
export * from './scripts';
|
|
10
|
+
export * from './transaction';
|
|
11
|
+
export * from './wallet';
|
|
12
|
+
export * from './types';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { IFetcher, IListener, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
+
import type { AccountInfo, Asset, AssetMetadata, BlockInfo, Protocol, TransactionInfo, UTxO } from '@mesh/types';
|
|
3
|
+
/**
|
|
4
|
+
* [Blockfrost](https://blockfrost.io/) provides restful APIs which allows your app to access information stored on the blockchain.
|
|
5
|
+
*
|
|
6
|
+
* Get started:
|
|
7
|
+
* ```ts
|
|
8
|
+
* const blockfrostProvider = new BlockfrostProvider('<BLOCKFROST_API_KEY>');
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare class BlockfrostProvider implements IFetcher, IListener, ISubmitter {
|
|
12
|
+
private readonly _axiosInstance;
|
|
13
|
+
/**
|
|
14
|
+
* If you are using a privately hosted Blockfrost instance, you can set the URL in the parameter.
|
|
15
|
+
* @param baseUrl The base URL of the instance.
|
|
16
|
+
*/
|
|
17
|
+
constructor(baseUrl: string);
|
|
18
|
+
/**
|
|
19
|
+
* If you are using [Blockfrost](https://blockfrost.io/) hosted instance, you can set the project ID in the parameter.
|
|
20
|
+
* @param projectId The project ID of the instance.
|
|
21
|
+
* @param version The version of the API. Default is 0.
|
|
22
|
+
*/
|
|
23
|
+
constructor(projectId: string, version?: number);
|
|
24
|
+
fetchAccountInfo(address: string): Promise<AccountInfo>;
|
|
25
|
+
private resolveScriptRef;
|
|
26
|
+
private toUTxO;
|
|
27
|
+
fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
|
|
28
|
+
fetchAssetAddresses(asset: string): Promise<{
|
|
29
|
+
address: string;
|
|
30
|
+
quantity: string;
|
|
31
|
+
}[]>;
|
|
32
|
+
fetchAssetMetadata(asset: string): Promise<AssetMetadata>;
|
|
33
|
+
fetchBlockInfo(hash: string): Promise<BlockInfo>;
|
|
34
|
+
fetchCollectionAssets(policyId: string, cursor?: number): Promise<{
|
|
35
|
+
assets: Asset[];
|
|
36
|
+
next: string | number | null;
|
|
37
|
+
}>;
|
|
38
|
+
fetchHandleAddress(handle: string): Promise<string>;
|
|
39
|
+
fetchProtocolParameters(epoch?: number): Promise<Protocol>;
|
|
40
|
+
fetchTxInfo(hash: string): Promise<TransactionInfo>;
|
|
41
|
+
fetchUTxOs(hash: string): Promise<UTxO[]>;
|
|
42
|
+
onTxConfirmed(txHash: string, callback: () => void, limit?: number): void;
|
|
43
|
+
submitTx(tx: string): Promise<string>;
|
|
44
|
+
private fetchPlutusScriptCBOR;
|
|
45
|
+
private fetchNativeScriptJSON;
|
|
46
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IUploader } from '@mesh/common/contracts';
|
|
2
|
+
export declare class InfuraProvider implements IUploader {
|
|
3
|
+
private _axiosInstance;
|
|
4
|
+
constructor(projectId: string, projectSecret: string, options: Partial<CreateInfuraProviderOptions>);
|
|
5
|
+
uploadContent(content: FormData, recursive?: boolean): Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
declare type CreateInfuraProviderOptions = {
|
|
8
|
+
host: string;
|
|
9
|
+
port: number;
|
|
10
|
+
version: number;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IFetcher, IListener, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
+
import type { AccountInfo, Asset, AssetMetadata, BlockInfo, Protocol, TransactionInfo, UTxO } from '@mesh/types';
|
|
3
|
+
export declare class KoiosProvider implements IFetcher, IListener, ISubmitter {
|
|
4
|
+
private readonly _axiosInstance;
|
|
5
|
+
constructor(baseUrl: string);
|
|
6
|
+
constructor(network: 'api' | 'preview' | 'preprod' | 'guild', token: string, version?: number);
|
|
7
|
+
fetchAccountInfo(address: string): Promise<AccountInfo>;
|
|
8
|
+
fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
|
|
9
|
+
fetchAssetAddresses(asset: string): Promise<{
|
|
10
|
+
address: string;
|
|
11
|
+
quantity: string;
|
|
12
|
+
}[]>;
|
|
13
|
+
fetchAssetMetadata(asset: string): Promise<AssetMetadata>;
|
|
14
|
+
fetchBlockInfo(hash: string): Promise<BlockInfo>;
|
|
15
|
+
fetchCollectionAssets(policyId: string, cursor?: number): Promise<{
|
|
16
|
+
assets: Asset[];
|
|
17
|
+
next: string | number | null;
|
|
18
|
+
}>;
|
|
19
|
+
fetchHandleAddress(handle: string): Promise<string>;
|
|
20
|
+
fetchProtocolParameters(epoch: number): Promise<Protocol>;
|
|
21
|
+
fetchTxInfo(hash: string): Promise<TransactionInfo>;
|
|
22
|
+
fetchUTxOs(hash: string): Promise<UTxO[]>;
|
|
23
|
+
onTxConfirmed(txHash: string, callback: () => void, limit?: number): void;
|
|
24
|
+
submitTx(tx: string): Promise<string>;
|
|
25
|
+
private toUTxO;
|
|
26
|
+
private resolveScriptRef;
|
|
27
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IEvaluator, IFetcher, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
+
import type { AccountInfo, Action, Asset, AssetMetadata, BlockInfo, Protocol, TransactionInfo, UTxO } from '@mesh/types';
|
|
3
|
+
export declare type MaestroSupportedNetworks = 'Mainnet' | 'Preprod' | 'Preview';
|
|
4
|
+
export interface MaestroConfig {
|
|
5
|
+
network: MaestroSupportedNetworks;
|
|
6
|
+
apiKey: string;
|
|
7
|
+
turboSubmit?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class MaestroProvider implements IFetcher, ISubmitter, IEvaluator {
|
|
10
|
+
private readonly _axiosInstance;
|
|
11
|
+
private readonly _amountsAsStrings;
|
|
12
|
+
submitUrl: string;
|
|
13
|
+
constructor({ network, apiKey, turboSubmit }: MaestroConfig);
|
|
14
|
+
evaluateTx(cbor: string): Promise<Omit<Action, 'data'>[]>;
|
|
15
|
+
fetchAccountInfo(address: string): Promise<AccountInfo>;
|
|
16
|
+
fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
|
|
17
|
+
fetchAssetAddresses(asset: string): Promise<{
|
|
18
|
+
address: string;
|
|
19
|
+
quantity: string;
|
|
20
|
+
}[]>;
|
|
21
|
+
fetchAssetMetadata(asset: string): Promise<AssetMetadata>;
|
|
22
|
+
fetchBlockInfo(hash: string): Promise<BlockInfo>;
|
|
23
|
+
fetchCollectionAssets(policyId: string, cursor?: string): Promise<{
|
|
24
|
+
assets: Asset[];
|
|
25
|
+
next: string | number | null;
|
|
26
|
+
}>;
|
|
27
|
+
fetchHandleAddress(handle: string): Promise<string>;
|
|
28
|
+
fetchProtocolParameters(epoch?: number): Promise<Protocol>;
|
|
29
|
+
fetchTxInfo(hash: string): Promise<TransactionInfo>;
|
|
30
|
+
fetchUTxOs(hash: string): Promise<UTxO[]>;
|
|
31
|
+
onTxConfirmed(txHash: string, callback: () => void, limit?: number): void;
|
|
32
|
+
submitTx(tx: string): Promise<string>;
|
|
33
|
+
private toUTxO;
|
|
34
|
+
private resolveScript;
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IEvaluator, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
+
import { Action, Network } from '@mesh/types';
|
|
3
|
+
export declare class OgmiosProvider implements IEvaluator, ISubmitter {
|
|
4
|
+
private readonly _baseUrl;
|
|
5
|
+
constructor(baseUrl: string);
|
|
6
|
+
constructor(network: Network);
|
|
7
|
+
evaluateTx(tx: string): Promise<Omit<Action, 'data'>[]>;
|
|
8
|
+
onNextTx(callback: (tx: unknown) => void): Promise<() => void>;
|
|
9
|
+
submitTx(tx: string): Promise<string>;
|
|
10
|
+
private open;
|
|
11
|
+
private send;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IEvaluator, IFetcher, IListener, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
+
import type { AccountInfo, Action, Asset, AssetMetadata, BlockInfo, Protocol, TransactionInfo, UTxO } from '@mesh/types';
|
|
3
|
+
export declare class TangoProvider implements IEvaluator, IFetcher, IListener, ISubmitter {
|
|
4
|
+
private readonly _axiosInstance;
|
|
5
|
+
constructor(network: 'mainnet' | 'testnet', appId: string, appKey: string, version?: number);
|
|
6
|
+
evaluateTx(tx: string): Promise<Omit<Action, 'data'>[]>;
|
|
7
|
+
fetchAccountInfo(address: string): Promise<AccountInfo>;
|
|
8
|
+
fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
|
|
9
|
+
fetchAssetAddresses(asset: string): Promise<{
|
|
10
|
+
address: string;
|
|
11
|
+
quantity: string;
|
|
12
|
+
}[]>;
|
|
13
|
+
fetchAssetMetadata(asset: string): Promise<AssetMetadata>;
|
|
14
|
+
fetchBlockInfo(hash: string): Promise<BlockInfo>;
|
|
15
|
+
fetchCollectionAssets(policyId: string, cursor?: string): Promise<{
|
|
16
|
+
assets: Asset[];
|
|
17
|
+
next: string | number | null;
|
|
18
|
+
}>;
|
|
19
|
+
fetchHandleAddress(handle: string): Promise<string>;
|
|
20
|
+
fetchProtocolParameters(epoch: number): Promise<Protocol>;
|
|
21
|
+
fetchTxInfo(hash: string): Promise<TransactionInfo>;
|
|
22
|
+
fetchUTxOs(hash: string): Promise<UTxO[]>;
|
|
23
|
+
onTxConfirmed(txHash: string, callback: () => void, limit?: number): void;
|
|
24
|
+
submitTx(tx: string): Promise<string>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NativeScript } from '@mesh/types';
|
|
2
|
+
export declare class ForgeScript {
|
|
3
|
+
static withOneSignature(address: string): string;
|
|
4
|
+
static withAtLeastNSignatures(addresses: string[], minimumRequired: number): string;
|
|
5
|
+
static withAnySignature(addresses: string[]): string;
|
|
6
|
+
static withAllSignatures(addresses: string[]): string;
|
|
7
|
+
static fromNativeScript(script: NativeScript): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './forge.script';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { IEvaluator, IFetcher, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
+
import { MeshTxBuilderCore } from './meshTxBuilderCore';
|
|
3
|
+
import { MeshTxBuilderBody } from './type';
|
|
4
|
+
declare type MeshTxBuilderOptions = {
|
|
5
|
+
fetcher?: IFetcher;
|
|
6
|
+
submitter?: ISubmitter;
|
|
7
|
+
evaluator?: IEvaluator;
|
|
8
|
+
isHydra?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* MeshTxBuilder is a lower level api for building transaction
|
|
12
|
+
* @param {IFetcher} [fetcher] an optional parameter for fetching utxo
|
|
13
|
+
* @param {ISubmitter} [submitter] an optional parameter for submitting transaction
|
|
14
|
+
* @param {IEvaluator} [evaluator] an optional parameter for evaluating transaction
|
|
15
|
+
* @param {boolean} [isHydra] an optional parameter for using hydra transaction building for configuring 0 fee in protocol parameters
|
|
16
|
+
*/
|
|
17
|
+
export declare class MeshTxBuilder extends MeshTxBuilderCore {
|
|
18
|
+
private _fetcher?;
|
|
19
|
+
private _submitter?;
|
|
20
|
+
private _evaluator?;
|
|
21
|
+
private queriedTxHashes;
|
|
22
|
+
private queriedUTxOs;
|
|
23
|
+
constructor({ fetcher, submitter, evaluator, isHydra, }: MeshTxBuilderOptions);
|
|
24
|
+
/**
|
|
25
|
+
* It builds the transaction and query the blockchain for missing information
|
|
26
|
+
* @param customizedTx The optional customized transaction body
|
|
27
|
+
* @returns The signed transaction in hex ready to submit / signed by client
|
|
28
|
+
*/
|
|
29
|
+
complete: (customizedTx?: MeshTxBuilderBody) => Promise<this>;
|
|
30
|
+
/**
|
|
31
|
+
* Submit transactions to the blockchain using the fetcher instance
|
|
32
|
+
* @param txHex The signed transaction in hex
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
submitTx: (txHex: string) => Promise<string | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* Get the UTxO information from the blockchain
|
|
38
|
+
* @param TxHash The TxIn object that contains the txHash and txIndex, while missing amount and address information
|
|
39
|
+
*/
|
|
40
|
+
private getUTxOInfo;
|
|
41
|
+
private queryAllTxInfo;
|
|
42
|
+
private completeTxInformation;
|
|
43
|
+
private isInputComplete;
|
|
44
|
+
private isInputInfoComplete;
|
|
45
|
+
private isRefScriptInfoComplete;
|
|
46
|
+
}
|
|
47
|
+
export {};
|