@effectstream/midnight-contracts 0.100.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/README.md +134 -0
- package/package.json +42 -0
- package/src/build-wallet.ts +101 -0
- package/src/constants.ts +20 -0
- package/src/deploy.ts +296 -0
- package/src/get-wallet-info.ts +995 -0
- package/src/midnight-env.ts +90 -0
- package/src/mnemonicToSeed.ts +19 -0
- package/src/mod.ts +29 -0
- package/src/providers.ts +116 -0
- package/src/read-contract.ts +439 -0
- package/src/types.ts +75 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { ZswapSecretKeys, DustSecretKey } from "@midnight-ntwrk/ledger-v8";
|
|
2
|
+
import type { WalletFacade } from "@midnight-ntwrk/wallet-sdk-facade";
|
|
3
|
+
import type { UnshieldedKeystore } from "@midnight-ntwrk/wallet-sdk-unshielded-wallet";
|
|
4
|
+
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Types
|
|
7
|
+
// ============================================================================
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for deploying a Midnight contract
|
|
12
|
+
*/
|
|
13
|
+
export interface DeployConfig {
|
|
14
|
+
/** Name of the contract directory (e.g., "contract-counter", "contract-eip-20") */
|
|
15
|
+
contractName: string;
|
|
16
|
+
/** Base filename for contract address (e.g., "contract-counter.json"); a network suffix is appended */
|
|
17
|
+
contractFileName: string;
|
|
18
|
+
/** The Contract class to deploy */
|
|
19
|
+
// deno-lint-ignore no-explicit-any
|
|
20
|
+
contractClass: any;
|
|
21
|
+
/** Witness definitions */
|
|
22
|
+
// deno-lint-ignore no-explicit-any
|
|
23
|
+
witnesses: any;
|
|
24
|
+
/** On-chain private state ID */
|
|
25
|
+
privateStateId: string;
|
|
26
|
+
/** Initial private state object */
|
|
27
|
+
// deno-lint-ignore no-explicit-any
|
|
28
|
+
initialPrivateState: any;
|
|
29
|
+
/** Optional deployment arguments array */
|
|
30
|
+
// deno-lint-ignore no-explicit-any
|
|
31
|
+
deployArgs?: any[];
|
|
32
|
+
/** Optional private state store name (defaults to contractName-based value) */
|
|
33
|
+
privateStateStoreName?: string;
|
|
34
|
+
/** Optional base directory override for finding contracts */
|
|
35
|
+
baseDir?: string;
|
|
36
|
+
/** Optional flag to extract wallet address info (for contracts that need initialOwner) */
|
|
37
|
+
extractWalletAddress?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Network endpoint URLs for connecting to Midnight infrastructure
|
|
42
|
+
*/
|
|
43
|
+
export interface NetworkUrls {
|
|
44
|
+
/** Optional network ID override */
|
|
45
|
+
id?: string;
|
|
46
|
+
/** GraphQL indexer HTTP endpoint (default: http://127.0.0.1:8088/api/v3/graphql)*/
|
|
47
|
+
indexer?: string;
|
|
48
|
+
/** GraphQL indexer WebSocket endpoint (default: ws://127.0.0.1:8088/api/v3/graphql/ws)*/
|
|
49
|
+
indexerWS?: string;
|
|
50
|
+
/** Midnight node RPC endpoint (default: http://127.0.0.1:9944)*/
|
|
51
|
+
node?: string;
|
|
52
|
+
/** Proof server HTTP endpoint (default: http://127.0.0.1:6300)*/
|
|
53
|
+
proofServer?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// WalletResult is now imported from get-wallet-info.ts
|
|
57
|
+
|
|
58
|
+
/** Initial owner structure for contracts that need wallet address */
|
|
59
|
+
export interface InitialOwner {
|
|
60
|
+
is_left: boolean;
|
|
61
|
+
left: { bytes: Uint8Array };
|
|
62
|
+
right: { bytes: Uint8Array };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
export interface WalletResult {
|
|
67
|
+
wallet: WalletFacade;
|
|
68
|
+
zswapSecretKeys: ZswapSecretKeys;
|
|
69
|
+
walletZswapSecretKeys: ZswapSecretKeys;
|
|
70
|
+
dustSecretKey: DustSecretKey;
|
|
71
|
+
walletDustSecretKey: DustSecretKey;
|
|
72
|
+
dustAddress: string;
|
|
73
|
+
unshieldedAddress: string;
|
|
74
|
+
unshieldedKeystore: UnshieldedKeystore;
|
|
75
|
+
}
|