@lucid-evolution/provider 0.0.1
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/index.cjs +838 -0
- package/dist/index.d.cts +83 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.js +798 -0
- package/package.json +30 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Provider, ProtocolParameters, Address, Credential, UTxO, Unit, OutRef, RewardAddress, Delegation, DatumHash, Datum, TxHash, Transaction } from '@lucid-evolution/core-types';
|
|
2
|
+
|
|
3
|
+
declare class Blockfrost implements Provider {
|
|
4
|
+
url: string;
|
|
5
|
+
projectId: string;
|
|
6
|
+
constructor(url: string, projectId?: string);
|
|
7
|
+
getProtocolParameters(): Promise<ProtocolParameters>;
|
|
8
|
+
getUtxos(addressOrCredential: Address | Credential): Promise<UTxO[]>;
|
|
9
|
+
getUtxosWithUnit(addressOrCredential: Address | Credential, unit: Unit): Promise<UTxO[]>;
|
|
10
|
+
getUtxoByUnit(unit: Unit): Promise<UTxO>;
|
|
11
|
+
getUtxosByOutRef(outRefs: OutRef[]): Promise<UTxO[]>;
|
|
12
|
+
getDelegation(rewardAddress: RewardAddress): Promise<Delegation>;
|
|
13
|
+
getDatum(datumHash: DatumHash): Promise<Datum>;
|
|
14
|
+
awaitTx(txHash: TxHash, checkInterval?: number): Promise<boolean>;
|
|
15
|
+
submitTx(tx: Transaction): Promise<TxHash>;
|
|
16
|
+
private blockfrostUtxosToUtxos;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* This function is temporarily needed only, until Blockfrost returns the datum natively in Cbor.
|
|
20
|
+
* The conversion is ambigious, that's why it's better to get the datum directly in Cbor.
|
|
21
|
+
*/
|
|
22
|
+
declare function datumJsonToCbor(json: DatumJson): Datum;
|
|
23
|
+
type DatumJson = {
|
|
24
|
+
int?: number;
|
|
25
|
+
bytes?: string;
|
|
26
|
+
list?: Array<DatumJson>;
|
|
27
|
+
map?: Array<{
|
|
28
|
+
k: unknown;
|
|
29
|
+
v: unknown;
|
|
30
|
+
}>;
|
|
31
|
+
fields?: Array<DatumJson>;
|
|
32
|
+
[constructor: string]: unknown;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
declare class Kupmios implements Provider {
|
|
36
|
+
kupoUrl: string;
|
|
37
|
+
ogmiosUrl: string;
|
|
38
|
+
/**
|
|
39
|
+
* @param kupoUrl: http(s)://localhost:1442
|
|
40
|
+
* @param ogmiosUrl: ws(s)://localhost:1337
|
|
41
|
+
*/
|
|
42
|
+
constructor(kupoUrl: string, ogmiosUrl: string);
|
|
43
|
+
getProtocolParameters(): Promise<ProtocolParameters>;
|
|
44
|
+
getUtxos(addressOrCredential: Address | Credential): Promise<UTxO[]>;
|
|
45
|
+
getUtxosWithUnit(addressOrCredential: Address | Credential, unit: Unit): Promise<UTxO[]>;
|
|
46
|
+
getUtxoByUnit(unit: Unit): Promise<UTxO>;
|
|
47
|
+
getUtxosByOutRef(outRefs: Array<OutRef>): Promise<UTxO[]>;
|
|
48
|
+
getDelegation(rewardAddress: RewardAddress): Promise<Delegation>;
|
|
49
|
+
getDatum(datumHash: DatumHash): Promise<Datum>;
|
|
50
|
+
awaitTx(txHash: TxHash, checkInterval?: number): Promise<boolean>;
|
|
51
|
+
submitTx(tx: Transaction): Promise<TxHash>;
|
|
52
|
+
private kupmiosUtxosToUtxos;
|
|
53
|
+
private ogmiosWsp;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type MaestroSupportedNetworks = "Mainnet" | "Preprod" | "Preview";
|
|
57
|
+
interface MaestroConfig {
|
|
58
|
+
network: MaestroSupportedNetworks;
|
|
59
|
+
apiKey: string;
|
|
60
|
+
turboSubmit?: boolean;
|
|
61
|
+
}
|
|
62
|
+
declare class Maestro implements Provider {
|
|
63
|
+
url: string;
|
|
64
|
+
apiKey: string;
|
|
65
|
+
turboSubmit: boolean;
|
|
66
|
+
constructor({ network, apiKey, turboSubmit }: MaestroConfig);
|
|
67
|
+
getProtocolParameters(): Promise<ProtocolParameters>;
|
|
68
|
+
private getUtxosInternal;
|
|
69
|
+
getUtxos(addressOrCredential: Address | Credential): Promise<UTxO[]>;
|
|
70
|
+
getUtxosWithUnit(addressOrCredential: Address | Credential, unit: Unit): Promise<UTxO[]>;
|
|
71
|
+
getUtxoByUnit(unit: Unit): Promise<UTxO>;
|
|
72
|
+
getUtxosByOutRef(outRefs: OutRef[]): Promise<UTxO[]>;
|
|
73
|
+
getDelegation(rewardAddress: RewardAddress): Promise<Delegation>;
|
|
74
|
+
getDatum(datumHash: DatumHash): Promise<Datum>;
|
|
75
|
+
awaitTx(txHash: TxHash, checkInterval?: number): Promise<boolean>;
|
|
76
|
+
submitTx(tx: Transaction): Promise<TxHash>;
|
|
77
|
+
private commonHeaders;
|
|
78
|
+
private requireAmountsAsStrings;
|
|
79
|
+
private maestroUtxoToUtxo;
|
|
80
|
+
private getAllPagesData;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { Blockfrost, Kupmios, Maestro, type MaestroConfig, type MaestroSupportedNetworks, datumJsonToCbor };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Provider, ProtocolParameters, Address, Credential, UTxO, Unit, OutRef, RewardAddress, Delegation, DatumHash, Datum, TxHash, Transaction } from '@lucid-evolution/core-types';
|
|
2
|
+
|
|
3
|
+
declare class Blockfrost implements Provider {
|
|
4
|
+
url: string;
|
|
5
|
+
projectId: string;
|
|
6
|
+
constructor(url: string, projectId?: string);
|
|
7
|
+
getProtocolParameters(): Promise<ProtocolParameters>;
|
|
8
|
+
getUtxos(addressOrCredential: Address | Credential): Promise<UTxO[]>;
|
|
9
|
+
getUtxosWithUnit(addressOrCredential: Address | Credential, unit: Unit): Promise<UTxO[]>;
|
|
10
|
+
getUtxoByUnit(unit: Unit): Promise<UTxO>;
|
|
11
|
+
getUtxosByOutRef(outRefs: OutRef[]): Promise<UTxO[]>;
|
|
12
|
+
getDelegation(rewardAddress: RewardAddress): Promise<Delegation>;
|
|
13
|
+
getDatum(datumHash: DatumHash): Promise<Datum>;
|
|
14
|
+
awaitTx(txHash: TxHash, checkInterval?: number): Promise<boolean>;
|
|
15
|
+
submitTx(tx: Transaction): Promise<TxHash>;
|
|
16
|
+
private blockfrostUtxosToUtxos;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* This function is temporarily needed only, until Blockfrost returns the datum natively in Cbor.
|
|
20
|
+
* The conversion is ambigious, that's why it's better to get the datum directly in Cbor.
|
|
21
|
+
*/
|
|
22
|
+
declare function datumJsonToCbor(json: DatumJson): Datum;
|
|
23
|
+
type DatumJson = {
|
|
24
|
+
int?: number;
|
|
25
|
+
bytes?: string;
|
|
26
|
+
list?: Array<DatumJson>;
|
|
27
|
+
map?: Array<{
|
|
28
|
+
k: unknown;
|
|
29
|
+
v: unknown;
|
|
30
|
+
}>;
|
|
31
|
+
fields?: Array<DatumJson>;
|
|
32
|
+
[constructor: string]: unknown;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
declare class Kupmios implements Provider {
|
|
36
|
+
kupoUrl: string;
|
|
37
|
+
ogmiosUrl: string;
|
|
38
|
+
/**
|
|
39
|
+
* @param kupoUrl: http(s)://localhost:1442
|
|
40
|
+
* @param ogmiosUrl: ws(s)://localhost:1337
|
|
41
|
+
*/
|
|
42
|
+
constructor(kupoUrl: string, ogmiosUrl: string);
|
|
43
|
+
getProtocolParameters(): Promise<ProtocolParameters>;
|
|
44
|
+
getUtxos(addressOrCredential: Address | Credential): Promise<UTxO[]>;
|
|
45
|
+
getUtxosWithUnit(addressOrCredential: Address | Credential, unit: Unit): Promise<UTxO[]>;
|
|
46
|
+
getUtxoByUnit(unit: Unit): Promise<UTxO>;
|
|
47
|
+
getUtxosByOutRef(outRefs: Array<OutRef>): Promise<UTxO[]>;
|
|
48
|
+
getDelegation(rewardAddress: RewardAddress): Promise<Delegation>;
|
|
49
|
+
getDatum(datumHash: DatumHash): Promise<Datum>;
|
|
50
|
+
awaitTx(txHash: TxHash, checkInterval?: number): Promise<boolean>;
|
|
51
|
+
submitTx(tx: Transaction): Promise<TxHash>;
|
|
52
|
+
private kupmiosUtxosToUtxos;
|
|
53
|
+
private ogmiosWsp;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type MaestroSupportedNetworks = "Mainnet" | "Preprod" | "Preview";
|
|
57
|
+
interface MaestroConfig {
|
|
58
|
+
network: MaestroSupportedNetworks;
|
|
59
|
+
apiKey: string;
|
|
60
|
+
turboSubmit?: boolean;
|
|
61
|
+
}
|
|
62
|
+
declare class Maestro implements Provider {
|
|
63
|
+
url: string;
|
|
64
|
+
apiKey: string;
|
|
65
|
+
turboSubmit: boolean;
|
|
66
|
+
constructor({ network, apiKey, turboSubmit }: MaestroConfig);
|
|
67
|
+
getProtocolParameters(): Promise<ProtocolParameters>;
|
|
68
|
+
private getUtxosInternal;
|
|
69
|
+
getUtxos(addressOrCredential: Address | Credential): Promise<UTxO[]>;
|
|
70
|
+
getUtxosWithUnit(addressOrCredential: Address | Credential, unit: Unit): Promise<UTxO[]>;
|
|
71
|
+
getUtxoByUnit(unit: Unit): Promise<UTxO>;
|
|
72
|
+
getUtxosByOutRef(outRefs: OutRef[]): Promise<UTxO[]>;
|
|
73
|
+
getDelegation(rewardAddress: RewardAddress): Promise<Delegation>;
|
|
74
|
+
getDatum(datumHash: DatumHash): Promise<Datum>;
|
|
75
|
+
awaitTx(txHash: TxHash, checkInterval?: number): Promise<boolean>;
|
|
76
|
+
submitTx(tx: Transaction): Promise<TxHash>;
|
|
77
|
+
private commonHeaders;
|
|
78
|
+
private requireAmountsAsStrings;
|
|
79
|
+
private maestroUtxoToUtxo;
|
|
80
|
+
private getAllPagesData;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { Blockfrost, Kupmios, Maestro, type MaestroConfig, type MaestroSupportedNetworks, datumJsonToCbor };
|