@meshsdk/core 1.5.24 → 1.5.28
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/README.md +3 -30
- package/dist/index.d.mts +129 -0
- package/dist/index.d.ts +129 -11
- package/dist/index.js +149 -0
- package/dist/index.mjs +91 -0
- package/package.json +30 -71
- package/dist/common/constants.d.ts +0 -58
- package/dist/common/contracts/evaluator.d.ts +0 -4
- package/dist/common/contracts/fetcher.d.ts +0 -22
- package/dist/common/contracts/index.d.ts +0 -7
- package/dist/common/contracts/initiator.d.ts +0 -8
- package/dist/common/contracts/listener.d.ts +0 -3
- package/dist/common/contracts/signer.d.ts +0 -8
- package/dist/common/contracts/submitter.d.ts +0 -3
- package/dist/common/contracts/uploader.d.ts +0 -3
- package/dist/common/decorators.d.ts +0 -19
- package/dist/common/helpers/generateNonce.d.ts +0 -1
- package/dist/common/helpers/index.d.ts +0 -4
- package/dist/common/helpers/mergeSignatures.d.ts +0 -3
- package/dist/common/helpers/readPlutusData.d.ts +0 -2
- package/dist/common/helpers/readTransaction.d.ts +0 -2
- package/dist/common/types/Account.d.ts +0 -5
- package/dist/common/types/AccountInfo.d.ts +0 -7
- package/dist/common/types/Action.d.ts +0 -12
- package/dist/common/types/Asset.d.ts +0 -7
- package/dist/common/types/AssetExtended.d.ts +0 -8
- package/dist/common/types/AssetMetadata.d.ts +0 -24
- package/dist/common/types/BlockInfo.d.ts +0 -17
- package/dist/common/types/Data.d.ts +0 -4
- package/dist/common/types/DataSignature.d.ts +0 -4
- package/dist/common/types/Era.d.ts +0 -1
- package/dist/common/types/Mint.d.ts +0 -10
- package/dist/common/types/NativeScript.d.ts +0 -14
- package/dist/common/types/Network.d.ts +0 -4
- package/dist/common/types/PlutusScript.d.ts +0 -6
- package/dist/common/types/PoolParams.d.ts +0 -16
- package/dist/common/types/Protocol.d.ts +0 -22
- package/dist/common/types/Recipient.d.ts +0 -11
- package/dist/common/types/Relay.d.ts +0 -13
- package/dist/common/types/Token.d.ts +0 -2
- package/dist/common/types/TransactionInfo.d.ts +0 -11
- package/dist/common/types/UTxO.d.ts +0 -15
- package/dist/common/types/Wallet.d.ts +0 -5
- package/dist/common/types/index.d.ts +0 -22
- package/dist/common/utils/builder.d.ts +0 -18
- package/dist/common/utils/converter.d.ts +0 -27
- package/dist/common/utils/deserializer.d.ts +0 -19
- package/dist/common/utils/index.d.ts +0 -5
- package/dist/common/utils/parser.d.ts +0 -5
- package/dist/common/utils/resolver.d.ts +0 -19
- package/dist/core/CIP14.d.ts +0 -2
- package/dist/core/CIP1852.d.ts +0 -4
- package/dist/core/CIP1853.d.ts +0 -1
- package/dist/core/CIP1855.d.ts +0 -1
- package/dist/core/CIP2.d.ts +0 -4
- package/dist/core/CIP25.d.ts +0 -19
- package/dist/core/CIP27.d.ts +0 -4
- package/dist/core/CIP8.d.ts +0 -15
- package/dist/core/CPS-009.d.ts +0 -2
- package/dist/core/CSL.d.ts +0 -147
- package/dist/core/index.d.ts +0 -9
- package/dist/core.cjs +0 -8
- package/dist/core.js +0 -5333
- package/dist/providers/blockfrost.provider.d.ts +0 -46
- package/dist/providers/index.d.ts +0 -6
- package/dist/providers/infura.provider.d.ts +0 -12
- package/dist/providers/koios.provider.d.ts +0 -27
- package/dist/providers/maestro.provider.d.ts +0 -35
- package/dist/providers/ogmios.provider.d.ts +0 -12
- package/dist/providers/tango.provider.d.ts +0 -25
- package/dist/providers/yaci.provider.d.ts +0 -32
- package/dist/scripts/forge.script.d.ts +0 -8
- package/dist/scripts/index.d.ts +0 -1
- package/dist/transaction/index.d.ts +0 -2
- package/dist/transaction/meshTxBuilder/index.d.ts +0 -2
- package/dist/transaction/meshTxBuilder/meshTxBuilder.service.d.ts +0 -47
- package/dist/transaction/meshTxBuilder/meshTxBuilder.spec.d.ts +0 -1
- package/dist/transaction/meshTxBuilder/meshTxBuilderCore.d.ts +0 -321
- package/dist/transaction/meshTxBuilder/type.d.ts +0 -146
- package/dist/transaction/transaction.service.d.ts +0 -157
- package/dist/transaction/transaction.service.spec.d.ts +0 -1
- package/dist/wallet/app.service.d.ts +0 -45
- package/dist/wallet/app.service.spec.d.ts +0 -1
- package/dist/wallet/browser.service.d.ts +0 -218
- package/dist/wallet/browser.service.spec.d.ts +0 -1
- package/dist/wallet/embedded.service.d.ts +0 -21
- package/dist/wallet/embedded.service.spec.d.ts +0 -1
- package/dist/wallet/index.d.ts +0 -4
- package/dist/wallet/mesh.service.d.ts +0 -188
- package/dist/wallet/mina.service.d.ts +0 -11
- package/dist/wallet/mina.service.spec.d.ts +0 -1
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Asset, Budget, Data, LanguageVersion, PlutusScript, UTxO, PoolParams } from '@mesh/common/types';
|
|
2
|
-
export declare type MeshTxBuilderBody = {
|
|
3
|
-
inputs: TxIn[];
|
|
4
|
-
outputs: Output[];
|
|
5
|
-
extraInputs: UTxO[];
|
|
6
|
-
selectionThreshold: number;
|
|
7
|
-
collaterals: PubKeyTxIn[];
|
|
8
|
-
requiredSignatures: string[];
|
|
9
|
-
referenceInputs: RefTxIn[];
|
|
10
|
-
mints: MintItem[];
|
|
11
|
-
changeAddress: string;
|
|
12
|
-
metadata: Metadata[];
|
|
13
|
-
validityRange: ValidityRange;
|
|
14
|
-
certificates: Certificate[];
|
|
15
|
-
signingKey: string[];
|
|
16
|
-
};
|
|
17
|
-
export declare type TxIn = PubKeyTxIn | SimpleScriptTxIn | ScriptTxIn;
|
|
18
|
-
export declare type PubKeyTxIn = {
|
|
19
|
-
type: 'PubKey';
|
|
20
|
-
txIn: TxInParameter;
|
|
21
|
-
};
|
|
22
|
-
export declare type TxInParameter = {
|
|
23
|
-
txHash: string;
|
|
24
|
-
txIndex: number;
|
|
25
|
-
amount?: Asset[];
|
|
26
|
-
address?: string;
|
|
27
|
-
};
|
|
28
|
-
export declare type SimpleScriptTxIn = {
|
|
29
|
-
type: 'SimpleScript';
|
|
30
|
-
txIn: TxInParameter;
|
|
31
|
-
simpleScriptTxIn: SimpleScriptTxInParameter;
|
|
32
|
-
};
|
|
33
|
-
export declare type SimpleScriptTxInParameter = {
|
|
34
|
-
scriptSource?: {
|
|
35
|
-
type: 'Provided';
|
|
36
|
-
script: string;
|
|
37
|
-
} | {
|
|
38
|
-
type: 'Inline';
|
|
39
|
-
txInInfo: SimpleScriptSourceInfo;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
export declare type SimpleScriptSourceInfo = {
|
|
43
|
-
txHash: string;
|
|
44
|
-
txIndex: number;
|
|
45
|
-
};
|
|
46
|
-
export declare type ScriptTxIn = {
|
|
47
|
-
type: 'Script';
|
|
48
|
-
txIn: TxInParameter;
|
|
49
|
-
scriptTxIn: ScriptTxInParameter;
|
|
50
|
-
};
|
|
51
|
-
export declare type ScriptTxInParameter = {
|
|
52
|
-
scriptSource?: {
|
|
53
|
-
type: 'Provided';
|
|
54
|
-
script: PlutusScript;
|
|
55
|
-
} | {
|
|
56
|
-
type: 'Inline';
|
|
57
|
-
txInInfo: ScriptSourceInfo;
|
|
58
|
-
};
|
|
59
|
-
datumSource?: {
|
|
60
|
-
type: 'Provided';
|
|
61
|
-
data: BuilderData;
|
|
62
|
-
} | {
|
|
63
|
-
type: 'Inline';
|
|
64
|
-
txHash: string;
|
|
65
|
-
txIndex: number;
|
|
66
|
-
};
|
|
67
|
-
redeemer?: Redeemer;
|
|
68
|
-
};
|
|
69
|
-
export declare type ScriptSourceInfo = {
|
|
70
|
-
txHash: string;
|
|
71
|
-
txIndex: number;
|
|
72
|
-
spendingScriptHash?: string;
|
|
73
|
-
version: LanguageVersion;
|
|
74
|
-
};
|
|
75
|
-
export declare type RefTxIn = {
|
|
76
|
-
txHash: string;
|
|
77
|
-
txIndex: number;
|
|
78
|
-
};
|
|
79
|
-
export declare type Output = {
|
|
80
|
-
address: string;
|
|
81
|
-
amount: Asset[];
|
|
82
|
-
datum?: {
|
|
83
|
-
type: 'Hash' | 'Inline';
|
|
84
|
-
data: BuilderData;
|
|
85
|
-
};
|
|
86
|
-
referenceScript?: PlutusScript;
|
|
87
|
-
};
|
|
88
|
-
export declare type MintItem = {
|
|
89
|
-
type: 'Plutus' | 'Native';
|
|
90
|
-
policyId: string;
|
|
91
|
-
assetName: string;
|
|
92
|
-
amount: string;
|
|
93
|
-
redeemer?: Redeemer;
|
|
94
|
-
scriptSource?: {
|
|
95
|
-
type: 'Provided';
|
|
96
|
-
script: PlutusScript;
|
|
97
|
-
} | {
|
|
98
|
-
type: 'Reference Script';
|
|
99
|
-
txHash: string;
|
|
100
|
-
txIndex: number;
|
|
101
|
-
version: LanguageVersion;
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
export declare type ValidityRange = {
|
|
105
|
-
invalidBefore?: number;
|
|
106
|
-
invalidHereafter?: number;
|
|
107
|
-
};
|
|
108
|
-
export declare type BuilderData = {
|
|
109
|
-
type: 'Mesh';
|
|
110
|
-
content: Data;
|
|
111
|
-
} | {
|
|
112
|
-
type: 'JSON';
|
|
113
|
-
content: string;
|
|
114
|
-
} | {
|
|
115
|
-
type: 'CBOR';
|
|
116
|
-
content: string;
|
|
117
|
-
};
|
|
118
|
-
export declare type Redeemer = {
|
|
119
|
-
data: BuilderData;
|
|
120
|
-
exUnits: Budget;
|
|
121
|
-
};
|
|
122
|
-
export declare type Metadata = {
|
|
123
|
-
tag: string;
|
|
124
|
-
metadata: object;
|
|
125
|
-
};
|
|
126
|
-
export declare type Certificate = {
|
|
127
|
-
type: 'RegisterPool';
|
|
128
|
-
poolParams: PoolParams;
|
|
129
|
-
} | {
|
|
130
|
-
type: 'RegisterStake';
|
|
131
|
-
stakeKeyHash: string;
|
|
132
|
-
} | {
|
|
133
|
-
type: 'DelegateStake';
|
|
134
|
-
stakeKeyHash: string;
|
|
135
|
-
poolId: string;
|
|
136
|
-
} | {
|
|
137
|
-
type: 'DeregisterStake';
|
|
138
|
-
stakeKeyHash: string;
|
|
139
|
-
} | {
|
|
140
|
-
type: 'RetirePool';
|
|
141
|
-
poolId: string;
|
|
142
|
-
epoch: number;
|
|
143
|
-
};
|
|
144
|
-
export declare type RequiredWith<T, K extends keyof T> = Required<T> & {
|
|
145
|
-
[P in K]: Required<T[P]>;
|
|
146
|
-
};
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { IInitiator } from '@mesh/common/contracts';
|
|
2
|
-
import type { Action, Asset, Data, Era, Mint, Protocol, NativeScript, PlutusScript, PoolParams, Recipient, Token, UTxO } from '@mesh/common/types';
|
|
3
|
-
export declare class Transaction {
|
|
4
|
-
private _changeAddress?;
|
|
5
|
-
private _txOutputs;
|
|
6
|
-
private _recipients;
|
|
7
|
-
private _totalBurns;
|
|
8
|
-
private _totalMints;
|
|
9
|
-
private readonly _era?;
|
|
10
|
-
private readonly _initiator?;
|
|
11
|
-
private readonly _mintBuilder;
|
|
12
|
-
private readonly _protocolParameters;
|
|
13
|
-
private readonly _txBuilder;
|
|
14
|
-
private readonly _txCertificates;
|
|
15
|
-
private readonly _txInputsBuilder;
|
|
16
|
-
private readonly _txWithdrawals;
|
|
17
|
-
constructor(options?: Partial<CreateTxOptions>);
|
|
18
|
-
static attachMetadata(cborTx: string, cborTxMetadata: string, era?: Era): string;
|
|
19
|
-
static deattachMetadata(cborTx: string): string;
|
|
20
|
-
static maskMetadata(cborTx: string, era?: Era): string;
|
|
21
|
-
static readMetadata(cborTx: string): string;
|
|
22
|
-
static writeMetadata(cborTx: string, cborTxMetadata: string, era?: Era): string;
|
|
23
|
-
get size(): number;
|
|
24
|
-
build(): Promise<string>;
|
|
25
|
-
burnAsset(forgeScript: string | PlutusScript | UTxO, asset: Asset, redeemer?: Partial<Action>): Transaction;
|
|
26
|
-
delegateStake(rewardAddress: string, poolId: string): Transaction;
|
|
27
|
-
deregisterStake(rewardAddress: string): Transaction;
|
|
28
|
-
mintAsset(forgeScript: string | PlutusScript | UTxO, mint: Mint, redeemer?: Partial<Action>): Transaction;
|
|
29
|
-
redeemValue(options: {
|
|
30
|
-
value: UTxO;
|
|
31
|
-
script: PlutusScript | UTxO;
|
|
32
|
-
datum?: Data | UTxO;
|
|
33
|
-
redeemer?: Action;
|
|
34
|
-
}): Transaction;
|
|
35
|
-
registerStake(rewardAddress: string): Transaction;
|
|
36
|
-
registerPool(params: PoolParams): Transaction;
|
|
37
|
-
retirePool(poolId: string, epochNo: number): Transaction;
|
|
38
|
-
/**
|
|
39
|
-
* Adds an output to the transaction.
|
|
40
|
-
*
|
|
41
|
-
* @param recipient The recipient of the output.
|
|
42
|
-
* @param assets The assets to send.
|
|
43
|
-
* @returns The transaction builder.
|
|
44
|
-
* @see {@link https://meshjs.dev/apis/transaction#sendAssets}
|
|
45
|
-
*/
|
|
46
|
-
sendAssets(recipient: Recipient, assets: Asset[]): Transaction;
|
|
47
|
-
/**
|
|
48
|
-
* Adds a transaction output to the transaction.
|
|
49
|
-
*
|
|
50
|
-
* @param {Recipient} recipient The recipient of the transaction.
|
|
51
|
-
* @param {string} lovelace The amount of lovelace to send.
|
|
52
|
-
* @returns {Transaction} The Transaction object.
|
|
53
|
-
* @see {@link https://meshjs.dev/apis/transaction#sendAda}
|
|
54
|
-
*/
|
|
55
|
-
sendLovelace(recipient: Recipient, lovelace: string): Transaction;
|
|
56
|
-
/**
|
|
57
|
-
* Adds stable coins transaction output to the transaction.
|
|
58
|
-
* @param {Recipient} recipient The recipient of the transaction.
|
|
59
|
-
* @param {Token} ticker The ticker of the token to send.
|
|
60
|
-
* @param {string} amount The amount of the token to send.
|
|
61
|
-
* @returns {Transaction} The Transaction object.
|
|
62
|
-
* @see {@link https://meshjs.dev/apis/transaction#sendToken}
|
|
63
|
-
*/
|
|
64
|
-
sendToken(recipient: Recipient, ticker: Token, amount: string): Transaction;
|
|
65
|
-
/**
|
|
66
|
-
* Adds an output to the transaction.
|
|
67
|
-
*
|
|
68
|
-
* @param {Recipient} recipient The recipient of the output.
|
|
69
|
-
* @param {UTxO} value The UTxO value of the output.
|
|
70
|
-
* @returns {Transaction} The Transaction object.
|
|
71
|
-
*/
|
|
72
|
-
sendValue(recipient: Recipient, value: UTxO): Transaction;
|
|
73
|
-
/**
|
|
74
|
-
* Sets the change address for the transaction.
|
|
75
|
-
*
|
|
76
|
-
* @param {string} changeAddress The change address.
|
|
77
|
-
* @returns {Transaction} The Transaction object.
|
|
78
|
-
*/
|
|
79
|
-
setChangeAddress(changeAddress: string): Transaction;
|
|
80
|
-
/**
|
|
81
|
-
* Sets the collateral for the transaction.
|
|
82
|
-
*
|
|
83
|
-
* @param {UTxO[]} collateral - Set the UTxO for collateral.
|
|
84
|
-
* @returns {Transaction} The Transaction object.
|
|
85
|
-
*/
|
|
86
|
-
setCollateral(collateral: UTxO[]): Transaction;
|
|
87
|
-
/**
|
|
88
|
-
* Add a JSON metadata entry to the transaction.
|
|
89
|
-
*
|
|
90
|
-
* @param {number} key The key to use for the metadata entry.
|
|
91
|
-
* @param {unknown} value The value to use for the metadata entry.
|
|
92
|
-
* @returns {Transaction} The Transaction object.
|
|
93
|
-
* @see {@link https://meshjs.dev/apis/transaction#setMetadata}
|
|
94
|
-
*/
|
|
95
|
-
setMetadata(key: number, value: unknown): Transaction;
|
|
96
|
-
/**
|
|
97
|
-
* Sets the required signers for the transaction.
|
|
98
|
-
*
|
|
99
|
-
* @param {string[]} addresses The addresses of the required signers.
|
|
100
|
-
* @returns {Transaction} The Transaction object.
|
|
101
|
-
*/
|
|
102
|
-
setRequiredSigners(addresses: string[]): Transaction;
|
|
103
|
-
/**
|
|
104
|
-
* Sets the native script for the transaction.
|
|
105
|
-
* @param {NativeScript} script The native script to spend from.
|
|
106
|
-
* @param {UTxO} utxo The UTxO attached to the script.
|
|
107
|
-
* @returns {Transaction} The Transaction object.
|
|
108
|
-
*/
|
|
109
|
-
setNativeScriptInput(script: NativeScript, utxo: UTxO): Transaction;
|
|
110
|
-
/**
|
|
111
|
-
* Sets the start slot for the transaction.
|
|
112
|
-
*
|
|
113
|
-
* @param {string} slot The start slot for the transaction.
|
|
114
|
-
* @returns {Transaction} The Transaction object.
|
|
115
|
-
* @see {@link https://meshjs.dev/apis/transaction#setTimeLimit}
|
|
116
|
-
*/
|
|
117
|
-
setTimeToStart(slot: string): Transaction;
|
|
118
|
-
/**
|
|
119
|
-
* Set the time to live for the transaction.
|
|
120
|
-
*
|
|
121
|
-
* @param {string} slot The slot number to expire the transaction at.
|
|
122
|
-
* @returns {Transaction} The Transaction object.
|
|
123
|
-
* @see {@link https://meshjs.dev/apis/transaction#setTimeLimit}
|
|
124
|
-
*/
|
|
125
|
-
setTimeToExpire(slot: string): Transaction;
|
|
126
|
-
/**
|
|
127
|
-
* Sets the inputs for the transaction.
|
|
128
|
-
*
|
|
129
|
-
* @param {UTxO[]} inputs The inputs to set.
|
|
130
|
-
* @returns {Transaction} The transaction.
|
|
131
|
-
*/
|
|
132
|
-
setTxInputs(inputs: UTxO[]): Transaction;
|
|
133
|
-
/**
|
|
134
|
-
* Sets the reference inputs for the transaction.
|
|
135
|
-
*
|
|
136
|
-
* @param {UTxO[]} inputs The reference inputs to set.
|
|
137
|
-
* @returns {Transaction} The transaction.
|
|
138
|
-
*/
|
|
139
|
-
setTxRefInputs(inputs: UTxO[]): Transaction;
|
|
140
|
-
withdrawRewards(rewardAddress: string, lovelace: string): Transaction;
|
|
141
|
-
private addBurnInputsIfNeeded;
|
|
142
|
-
private addChangeAddress;
|
|
143
|
-
private addCollateralIfNeeded;
|
|
144
|
-
private addRequiredSignersIfNeeded;
|
|
145
|
-
private addTxInputsAsNeeded;
|
|
146
|
-
private forgeAssetsIfNeeded;
|
|
147
|
-
private filterAvailableUTxOs;
|
|
148
|
-
private addMintOutputs;
|
|
149
|
-
private notVisited;
|
|
150
|
-
private setTxOutput;
|
|
151
|
-
}
|
|
152
|
-
declare type CreateTxOptions = {
|
|
153
|
-
initiator: IInitiator;
|
|
154
|
-
parameters: Protocol;
|
|
155
|
-
era: Era;
|
|
156
|
-
};
|
|
157
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { csl } from '@mesh/core';
|
|
2
|
-
import { IFetcher, IInitiator, ISigner, ISubmitter } from '@mesh/common/contracts';
|
|
3
|
-
import type { Address, TransactionUnspentOutput } from '@mesh/core';
|
|
4
|
-
import type { DataSignature } from '@mesh/common/types';
|
|
5
|
-
export declare type AppWalletKeyType = {
|
|
6
|
-
type: 'root';
|
|
7
|
-
bech32: string;
|
|
8
|
-
} | {
|
|
9
|
-
type: 'cli';
|
|
10
|
-
payment: string;
|
|
11
|
-
stake?: string;
|
|
12
|
-
} | {
|
|
13
|
-
type: 'mnemonic';
|
|
14
|
-
words: string[];
|
|
15
|
-
};
|
|
16
|
-
export declare type CreateAppWalletOptions = {
|
|
17
|
-
networkId: number;
|
|
18
|
-
fetcher?: IFetcher;
|
|
19
|
-
submitter?: ISubmitter;
|
|
20
|
-
key: AppWalletKeyType;
|
|
21
|
-
};
|
|
22
|
-
export declare class AppWallet implements IInitiator, ISigner, ISubmitter {
|
|
23
|
-
private readonly _fetcher?;
|
|
24
|
-
private readonly _submitter?;
|
|
25
|
-
private readonly _wallet;
|
|
26
|
-
constructor(options: CreateAppWalletOptions);
|
|
27
|
-
getBaseAddress(accountIndex?: number, keyIndex?: number): string;
|
|
28
|
-
getPaymentAddress(accountIndex?: number, keyIndex?: number): string;
|
|
29
|
-
getRewardAddress(accountIndex?: number, keyIndex?: number): string;
|
|
30
|
-
getUsedAddress(accountIndex?: number, keyIndex?: number): Address;
|
|
31
|
-
getUsedCollateral(_limit?: number): Promise<TransactionUnspentOutput[]>;
|
|
32
|
-
getUsedUTxOs(accountIndex?: number): Promise<TransactionUnspentOutput[]>;
|
|
33
|
-
signData(address: string, payload: string, accountIndex?: number, keyIndex?: number): DataSignature;
|
|
34
|
-
signTx(unsignedTx: string, partialSign?: boolean, accountIndex?: number, keyIndex?: number): Promise<string>;
|
|
35
|
-
signTxSync(unsignedTx: string, partialSign?: boolean, accountIndex?: number, keyIndex?: number): string;
|
|
36
|
-
signTxs(unsignedTxs: string[], partialSign: boolean): Promise<string[]>;
|
|
37
|
-
submitTx(tx: string): Promise<string>;
|
|
38
|
-
static brew(strength?: number): string[];
|
|
39
|
-
/**
|
|
40
|
-
* development: browser wallets apis
|
|
41
|
-
*/
|
|
42
|
-
getUtxos(): Promise<TransactionUnspentOutput[]>;
|
|
43
|
-
getCollateral(): Promise<csl.TransactionUnspentOutput>;
|
|
44
|
-
getUsedAddresses(): Promise<string[]>;
|
|
45
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { IInitiator, ISigner, ISubmitter } from '@mesh/common/contracts';
|
|
2
|
-
import type { Address, TransactionUnspentOutput } from '@mesh/core';
|
|
3
|
-
import type { Asset, AssetExtended, DataSignature, UTxO, Wallet } from '@mesh/common/types';
|
|
4
|
-
/**
|
|
5
|
-
* These wallets APIs are in accordance to CIP-30, which defines the API for dApps to communicate with the user's wallet. Additional utility functions provided for developers that are useful for building dApps.
|
|
6
|
-
*
|
|
7
|
-
* ```javascript
|
|
8
|
-
* // import BrowserWallet
|
|
9
|
-
* import { BrowserWallet } from '@meshsdk/core';
|
|
10
|
-
*
|
|
11
|
-
* // connect to a wallet
|
|
12
|
-
* const wallet = await BrowserWallet.enable('eternl');
|
|
13
|
-
*
|
|
14
|
-
* // get assets in wallet
|
|
15
|
-
* const assets = await wallet.getAssets();
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
19
|
-
readonly _walletInstance: WalletInstance;
|
|
20
|
-
readonly _walletName: string;
|
|
21
|
-
walletInstance: WalletInstance;
|
|
22
|
-
private constructor();
|
|
23
|
-
/**
|
|
24
|
-
* Returns a list of wallets installed on user's device. Each wallet is an object with the following properties:
|
|
25
|
-
* - A name is provided to display wallet's name on the user interface.
|
|
26
|
-
* - A version is provided to display wallet's version on the user interface.
|
|
27
|
-
* - An icon is provided to display wallet's icon on the user interface.
|
|
28
|
-
*
|
|
29
|
-
* @returns a list of wallet names
|
|
30
|
-
*/
|
|
31
|
-
static getInstalledWallets(): Wallet[];
|
|
32
|
-
/**
|
|
33
|
-
* This is the entrypoint to start communication with the user's wallet. The wallet should request the user's permission to connect the web page to the user's wallet, and if permission has been granted, the wallet will be returned and exposing the full API for the dApp to use.
|
|
34
|
-
*
|
|
35
|
-
* Query BrowserWallet.getInstalledWallets() to get a list of available wallets, then provide the wallet name for which wallet the user would like to connect with.
|
|
36
|
-
*
|
|
37
|
-
* @param walletName
|
|
38
|
-
* @returns WalletInstance
|
|
39
|
-
*/
|
|
40
|
-
static enable(walletName: string): Promise<BrowserWallet>;
|
|
41
|
-
/**
|
|
42
|
-
* Returns a list of assets in the wallet. This API will return every assets in the wallet. Each asset is an object with the following properties:
|
|
43
|
-
* - A unit is provided to display asset's name on the user interface.
|
|
44
|
-
* - A quantity is provided to display asset's quantity on the user interface.
|
|
45
|
-
*
|
|
46
|
-
* @returns a list of assets and their quantities
|
|
47
|
-
*/
|
|
48
|
-
getBalance(): Promise<Asset[]>;
|
|
49
|
-
/**
|
|
50
|
-
* Returns an address owned by the wallet that should be used as a change address to return leftover assets during transaction creation back to the connected wallet.
|
|
51
|
-
*
|
|
52
|
-
* @returns an address
|
|
53
|
-
*/
|
|
54
|
-
getChangeAddress(): Promise<string>;
|
|
55
|
-
/**
|
|
56
|
-
* This function shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only UTXOs).
|
|
57
|
-
*
|
|
58
|
-
* If this cannot be attained, an error message with an explanation of the blocking problem shall be returned. NOTE: wallets are free to return UTXOs that add up to a greater total ADA value than requested in the amount parameter, but wallets must never return any result where UTXOs would sum up to a smaller total ADA value, instead in a case like that an error message must be returned.
|
|
59
|
-
*
|
|
60
|
-
* @param limit
|
|
61
|
-
* @returns a list of UTXOs
|
|
62
|
-
*/
|
|
63
|
-
getCollateral(limit?: number): Promise<UTxO[]>;
|
|
64
|
-
/**
|
|
65
|
-
* Returns the network ID of the currently connected account. 0 is testnet and 1 is mainnet but other networks can possibly be returned by wallets. Those other network ID values are not governed by CIP-30. This result will stay the same unless the connected account has changed.
|
|
66
|
-
*
|
|
67
|
-
* @returns network ID
|
|
68
|
-
*/
|
|
69
|
-
getNetworkId(): Promise<number>;
|
|
70
|
-
/**
|
|
71
|
-
* Returns a list of reward addresses owned by the wallet. A reward address is a stake address that is used to receive rewards from staking, generally starts from `stake` prefix.
|
|
72
|
-
*
|
|
73
|
-
* @returns a list of reward addresses
|
|
74
|
-
*/
|
|
75
|
-
getRewardAddresses(): Promise<string[]>;
|
|
76
|
-
/**
|
|
77
|
-
* Returns a list of unused addresses controlled by the wallet.
|
|
78
|
-
*
|
|
79
|
-
* @returns a list of unused addresses
|
|
80
|
-
*/
|
|
81
|
-
getUnusedAddresses(): Promise<string[]>;
|
|
82
|
-
/**
|
|
83
|
-
* Returns a list of used addresses controlled by the wallet.
|
|
84
|
-
*
|
|
85
|
-
* @returns a list of used addresses
|
|
86
|
-
*/
|
|
87
|
-
getUsedAddresses(): Promise<string[]>;
|
|
88
|
-
/**
|
|
89
|
-
* Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
|
|
90
|
-
*
|
|
91
|
-
* @param amount
|
|
92
|
-
* @returns a list of UTXOs
|
|
93
|
-
*/
|
|
94
|
-
getUtxos(amount?: Asset[] | undefined): Promise<UTxO[]>;
|
|
95
|
-
/**
|
|
96
|
-
* This endpoint utilizes the [CIP-8 - Message Signing](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0030) to sign arbitrary data, to verify the data was signed by the owner of the private key.
|
|
97
|
-
*
|
|
98
|
-
* Here, we get the first wallet's address with wallet.getUsedAddresses(), alternativelly you can use reward addresses (getRewardAddresses()) too. It's really up to you as the developer which address you want to use in your application.
|
|
99
|
-
*
|
|
100
|
-
* @param address
|
|
101
|
-
* @param payload
|
|
102
|
-
* @returns a signature
|
|
103
|
-
*/
|
|
104
|
-
signData(address: string, payload: string): Promise<DataSignature>;
|
|
105
|
-
/**
|
|
106
|
-
* Requests user to sign the provided transaction (tx). The wallet should ask the user for permission, and if given, try to sign the supplied body and return a signed transaction. partialSign should be true if the transaction provided requires multiple signatures.
|
|
107
|
-
*
|
|
108
|
-
* @param unsignedTx
|
|
109
|
-
* @param partialSign
|
|
110
|
-
* @returns a signed transaction in CBOR
|
|
111
|
-
*/
|
|
112
|
-
signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
|
|
113
|
-
/**
|
|
114
|
-
* Experimental feature - sign multiple transactions at once (Supported wallet(s): Typhon)
|
|
115
|
-
*
|
|
116
|
-
* @param unsignedTxs - array of unsigned transactions in CborHex string
|
|
117
|
-
* @param partialSign - if the transactions are signed partially
|
|
118
|
-
* @returns array of signed transactions CborHex string
|
|
119
|
-
*/
|
|
120
|
-
signTxs(unsignedTxs: string[], partialSign?: boolean): Promise<string[]>;
|
|
121
|
-
/**
|
|
122
|
-
* Submits the signed transaction to the blockchain network.
|
|
123
|
-
*
|
|
124
|
-
* As wallets should already have this ability to submit transaction, we allow dApps to request that a transaction be sent through it. If the wallet accepts the transaction and tries to send it, it shall return the transaction ID for the dApp to track. The wallet can return error messages or failure if there was an error in sending it.
|
|
125
|
-
*
|
|
126
|
-
* @param tx
|
|
127
|
-
* @returns a transaction hash
|
|
128
|
-
*/
|
|
129
|
-
submitTx(tx: string): Promise<string>;
|
|
130
|
-
/**
|
|
131
|
-
* Get a used address of type Address from the wallet.
|
|
132
|
-
*
|
|
133
|
-
* This is used in transaction building.
|
|
134
|
-
*
|
|
135
|
-
* @returns an Address object
|
|
136
|
-
*/
|
|
137
|
-
getUsedAddress(): Promise<Address>;
|
|
138
|
-
/**
|
|
139
|
-
* Get a list of UTXOs to be used as collateral inputs for transactions with plutus script inputs.
|
|
140
|
-
*
|
|
141
|
-
* This is used in transaction building.
|
|
142
|
-
*
|
|
143
|
-
* @returns a list of UTXOs
|
|
144
|
-
*/
|
|
145
|
-
getUsedCollateral(limit?: number): Promise<TransactionUnspentOutput[]>;
|
|
146
|
-
/**
|
|
147
|
-
* Get a list of UTXOs to be used for transaction building.
|
|
148
|
-
*
|
|
149
|
-
* This is used in transaction building.
|
|
150
|
-
*
|
|
151
|
-
* @returns a list of UTXOs
|
|
152
|
-
*/
|
|
153
|
-
getUsedUTxOs(amount?: Asset[] | undefined): Promise<TransactionUnspentOutput[]>;
|
|
154
|
-
/**
|
|
155
|
-
* A helper function to get the assets in the wallet.
|
|
156
|
-
*
|
|
157
|
-
* @returns a list of assets
|
|
158
|
-
*/
|
|
159
|
-
getAssets(): Promise<AssetExtended[]>;
|
|
160
|
-
/**
|
|
161
|
-
* A helper function to get the lovelace balance in the wallet.
|
|
162
|
-
*
|
|
163
|
-
* @returns lovelace balance
|
|
164
|
-
*/
|
|
165
|
-
getLovelace(): Promise<string>;
|
|
166
|
-
/**
|
|
167
|
-
* A helper function to get the assets of a specific policy ID in the wallet.
|
|
168
|
-
*
|
|
169
|
-
* @param policyId
|
|
170
|
-
* @returns a list of assets
|
|
171
|
-
*/
|
|
172
|
-
getPolicyIdAssets(policyId: string): Promise<AssetExtended[]>;
|
|
173
|
-
/**
|
|
174
|
-
* A helper function to get the policy IDs of all the assets in the wallet.
|
|
175
|
-
*
|
|
176
|
-
* @returns a list of policy IDs
|
|
177
|
-
*/
|
|
178
|
-
getPolicyIds(): Promise<string[]>;
|
|
179
|
-
private static resolveInstance;
|
|
180
|
-
}
|
|
181
|
-
declare global {
|
|
182
|
-
interface Window {
|
|
183
|
-
cardano: Cardano;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
declare type Cardano = {
|
|
187
|
-
[key: string]: {
|
|
188
|
-
name: string;
|
|
189
|
-
icon: string;
|
|
190
|
-
apiVersion: string;
|
|
191
|
-
enable: () => Promise<WalletInstance>;
|
|
192
|
-
};
|
|
193
|
-
};
|
|
194
|
-
declare type TransactionSignatureRequest = {
|
|
195
|
-
cbor: string;
|
|
196
|
-
partialSign: boolean;
|
|
197
|
-
};
|
|
198
|
-
declare type WalletInstance = {
|
|
199
|
-
experimental: ExperimentalFeatures;
|
|
200
|
-
getBalance(): Promise<string>;
|
|
201
|
-
getChangeAddress(): Promise<string>;
|
|
202
|
-
getNetworkId(): Promise<number>;
|
|
203
|
-
getRewardAddresses(): Promise<string[]>;
|
|
204
|
-
getUnusedAddresses(): Promise<string[]>;
|
|
205
|
-
getUsedAddresses(): Promise<string[]>;
|
|
206
|
-
getUtxos(amount: string | undefined): Promise<string[] | undefined>;
|
|
207
|
-
signData(address: string, payload: string): Promise<DataSignature>;
|
|
208
|
-
signTx(tx: string, partialSign: boolean): Promise<string>;
|
|
209
|
-
signTxs?(txs: TransactionSignatureRequest[]): Promise<string[]>;
|
|
210
|
-
signTxs?(txs: string[], partialSign: boolean): Promise<string[]>;
|
|
211
|
-
submitTx(tx: string): Promise<string>;
|
|
212
|
-
};
|
|
213
|
-
declare type ExperimentalFeatures = {
|
|
214
|
-
getCollateral(): Promise<string[] | undefined>;
|
|
215
|
-
signTxs?(txs: TransactionSignatureRequest[]): Promise<string[]>;
|
|
216
|
-
signTxs?(txs: string[], partialSign: boolean): Promise<string[]>;
|
|
217
|
-
};
|
|
218
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Vkeywitnesses } from '@mesh/core';
|
|
2
|
-
import type { Account, DataSignature, UTxO } from '@mesh/common/types';
|
|
3
|
-
export declare class EmbeddedWallet {
|
|
4
|
-
private readonly _networkId;
|
|
5
|
-
private readonly _encryptedSecret;
|
|
6
|
-
constructor(_networkId: number, _encryptedSecret: string | [string, string]);
|
|
7
|
-
getAccount(accountIndex: number, password: string, keyIndex?: number): Account;
|
|
8
|
-
signData(accountIndex: number, password: string, address: string, payload: string, keyIndex?: number): DataSignature;
|
|
9
|
-
signTx(accountIndex: number, password: string, utxos: UTxO[], unsignedTx: string, partialSign: boolean, keyIndex?: number): Vkeywitnesses;
|
|
10
|
-
addPaymentKey(accountIndex: number, password: string, unsignedTx: string, signatures: Vkeywitnesses, keyIndex?: number): Vkeywitnesses;
|
|
11
|
-
static encryptMnemonic(words: string[], password: string): string;
|
|
12
|
-
static encryptPrivateKey(bech32: string, password: string): string;
|
|
13
|
-
static encryptSigningKeys(cborPaymentKey: string, cborStakeKey: string, password: string): [string, string];
|
|
14
|
-
static generateMnemonic(strength?: number): string[];
|
|
15
|
-
private accountContext;
|
|
16
|
-
private static decrypt;
|
|
17
|
-
private static encrypt;
|
|
18
|
-
private static resolveAddress;
|
|
19
|
-
private static resolveKeys;
|
|
20
|
-
private static resolveSigners;
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/wallet/index.d.ts
DELETED