@lucid-evolution/provider 0.1.34 → 0.1.36

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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Provider, ProtocolParameters, Address, Credential, UTxO, Unit, OutRef, RewardAddress, Delegation, DatumHash, Datum, TxHash, Transaction } from '@lucid-evolution/core-types';
1
+ import { Provider, ProtocolParameters, Address, Credential, UTxO, Unit, OutRef, RewardAddress, Delegation, DatumHash, Datum, TxHash, Transaction, Assets, OutputData, UnixTime, Lovelace } from '@lucid-evolution/core-types';
2
2
  import * as effect_Cause from 'effect/Cause';
3
3
  import * as effect_Types from 'effect/Types';
4
4
  import { Effect } from 'effect';
@@ -62,6 +62,58 @@ declare class Kupmios implements Provider {
62
62
  submitTx(cbor: Transaction): Promise<TxHash>;
63
63
  }
64
64
 
65
+ /** Concatentation of txHash + outputIndex */
66
+ type FlatOutRef = string;
67
+ type EmulatorAccount = {
68
+ seedPhrase: string;
69
+ address: Address;
70
+ assets: Assets;
71
+ outputData?: OutputData;
72
+ };
73
+ declare function generateEmulatorAccount(assets: Assets): EmulatorAccount;
74
+ declare class Emulator implements Provider {
75
+ ledger: Record<FlatOutRef, {
76
+ utxo: UTxO;
77
+ spent: boolean;
78
+ }>;
79
+ mempool: Record<FlatOutRef, {
80
+ utxo: UTxO;
81
+ spent: boolean;
82
+ }>;
83
+ /**
84
+ * Only stake key registrations/delegations and rewards are tracked.
85
+ * Other certificates are not tracked.
86
+ */
87
+ chain: Record<RewardAddress, {
88
+ registeredStake: boolean;
89
+ delegation: Delegation;
90
+ }>;
91
+ blockHeight: number;
92
+ slot: number;
93
+ time: UnixTime;
94
+ protocolParameters: ProtocolParameters;
95
+ datumTable: Record<DatumHash, Datum>;
96
+ constructor(accounts: EmulatorAccount[], protocolParameters?: ProtocolParameters);
97
+ now(): UnixTime;
98
+ awaitSlot(length?: number): void;
99
+ awaitBlock(height?: number): void;
100
+ getUtxos(addressOrCredential: Address | Credential): Promise<UTxO[]>;
101
+ getProtocolParameters(): Promise<ProtocolParameters>;
102
+ getDatum(datumHash: DatumHash): Promise<Datum>;
103
+ getUtxosWithUnit(addressOrCredential: Address | Credential, unit: Unit): Promise<UTxO[]>;
104
+ getUtxosByOutRef(outRefs: OutRef[]): Promise<UTxO[]>;
105
+ getUtxoByUnit(unit: string): Promise<UTxO>;
106
+ getDelegation(rewardAddress: RewardAddress): Promise<Delegation>;
107
+ awaitTx(txHash: string): Promise<boolean>;
108
+ /**
109
+ * Emulates the behaviour of the reward distribution at epoch boundaries.
110
+ * Stake keys need to be registered and delegated like on a real chain in order to receive rewards.
111
+ */
112
+ distributeRewards(rewards: Lovelace): void;
113
+ submitTx(tx: Transaction): Promise<TxHash>;
114
+ log(): void;
115
+ }
116
+
65
117
  type MaestroSupportedNetworks = "Mainnet" | "Preprod" | "Preview";
66
118
  interface MaestroConfig {
67
119
  network: MaestroSupportedNetworks;
@@ -140,4 +192,4 @@ declare namespace fetch {
140
192
  export { fetch_FetchError as FetchError, fetch_JsonError as JsonError, fetch_ResponseError as ResponseError, fetch_fetchEffect as fetchEffect };
141
193
  }
142
194
 
143
- export { Blockfrost, fetch as FetchProvider, Koios, Kupmios, KupmiosError, Maestro, type MaestroConfig, type MaestroSupportedNetworks, datumJsonToCbor };
195
+ export { Blockfrost, Emulator, type EmulatorAccount, fetch as FetchProvider, Koios, Kupmios, KupmiosError, Maestro, type MaestroConfig, type MaestroSupportedNetworks, datumJsonToCbor, generateEmulatorAccount };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Provider, ProtocolParameters, Address, Credential, UTxO, Unit, OutRef, RewardAddress, Delegation, DatumHash, Datum, TxHash, Transaction } from '@lucid-evolution/core-types';
1
+ import { Provider, ProtocolParameters, Address, Credential, UTxO, Unit, OutRef, RewardAddress, Delegation, DatumHash, Datum, TxHash, Transaction, Assets, OutputData, UnixTime, Lovelace } from '@lucid-evolution/core-types';
2
2
  import * as effect_Cause from 'effect/Cause';
3
3
  import * as effect_Types from 'effect/Types';
4
4
  import { Effect } from 'effect';
@@ -62,6 +62,58 @@ declare class Kupmios implements Provider {
62
62
  submitTx(cbor: Transaction): Promise<TxHash>;
63
63
  }
64
64
 
65
+ /** Concatentation of txHash + outputIndex */
66
+ type FlatOutRef = string;
67
+ type EmulatorAccount = {
68
+ seedPhrase: string;
69
+ address: Address;
70
+ assets: Assets;
71
+ outputData?: OutputData;
72
+ };
73
+ declare function generateEmulatorAccount(assets: Assets): EmulatorAccount;
74
+ declare class Emulator implements Provider {
75
+ ledger: Record<FlatOutRef, {
76
+ utxo: UTxO;
77
+ spent: boolean;
78
+ }>;
79
+ mempool: Record<FlatOutRef, {
80
+ utxo: UTxO;
81
+ spent: boolean;
82
+ }>;
83
+ /**
84
+ * Only stake key registrations/delegations and rewards are tracked.
85
+ * Other certificates are not tracked.
86
+ */
87
+ chain: Record<RewardAddress, {
88
+ registeredStake: boolean;
89
+ delegation: Delegation;
90
+ }>;
91
+ blockHeight: number;
92
+ slot: number;
93
+ time: UnixTime;
94
+ protocolParameters: ProtocolParameters;
95
+ datumTable: Record<DatumHash, Datum>;
96
+ constructor(accounts: EmulatorAccount[], protocolParameters?: ProtocolParameters);
97
+ now(): UnixTime;
98
+ awaitSlot(length?: number): void;
99
+ awaitBlock(height?: number): void;
100
+ getUtxos(addressOrCredential: Address | Credential): Promise<UTxO[]>;
101
+ getProtocolParameters(): Promise<ProtocolParameters>;
102
+ getDatum(datumHash: DatumHash): Promise<Datum>;
103
+ getUtxosWithUnit(addressOrCredential: Address | Credential, unit: Unit): Promise<UTxO[]>;
104
+ getUtxosByOutRef(outRefs: OutRef[]): Promise<UTxO[]>;
105
+ getUtxoByUnit(unit: string): Promise<UTxO>;
106
+ getDelegation(rewardAddress: RewardAddress): Promise<Delegation>;
107
+ awaitTx(txHash: string): Promise<boolean>;
108
+ /**
109
+ * Emulates the behaviour of the reward distribution at epoch boundaries.
110
+ * Stake keys need to be registered and delegated like on a real chain in order to receive rewards.
111
+ */
112
+ distributeRewards(rewards: Lovelace): void;
113
+ submitTx(tx: Transaction): Promise<TxHash>;
114
+ log(): void;
115
+ }
116
+
65
117
  type MaestroSupportedNetworks = "Mainnet" | "Preprod" | "Preview";
66
118
  interface MaestroConfig {
67
119
  network: MaestroSupportedNetworks;
@@ -140,4 +192,4 @@ declare namespace fetch {
140
192
  export { fetch_FetchError as FetchError, fetch_JsonError as JsonError, fetch_ResponseError as ResponseError, fetch_fetchEffect as fetchEffect };
141
193
  }
142
194
 
143
- export { Blockfrost, fetch as FetchProvider, Koios, Kupmios, KupmiosError, Maestro, type MaestroConfig, type MaestroSupportedNetworks, datumJsonToCbor };
195
+ export { Blockfrost, Emulator, type EmulatorAccount, fetch as FetchProvider, Koios, Kupmios, KupmiosError, Maestro, type MaestroConfig, type MaestroSupportedNetworks, datumJsonToCbor, generateEmulatorAccount };