@layerzerolabs/test-utils-stellar 0.2.122
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/LICENSE +23 -0
- package/README.md +108 -0
- package/dist/4UKUSHEU.js +30 -0
- package/dist/4UKUSHEU.js.map +1 -0
- package/dist/7DZ4SVEO.js +46 -0
- package/dist/7DZ4SVEO.js.map +1 -0
- package/dist/CYINPPER.js +293 -0
- package/dist/CYINPPER.js.map +1 -0
- package/dist/DNRE4ENZ.js +56 -0
- package/dist/DNRE4ENZ.js.map +1 -0
- package/dist/GAGBEOCZ.js +25 -0
- package/dist/GAGBEOCZ.js.map +1 -0
- package/dist/PMDPSIA2.js +149 -0
- package/dist/PMDPSIA2.js.map +1 -0
- package/dist/TYAJMKGY.js +183 -0
- package/dist/TYAJMKGY.js.map +1 -0
- package/dist/VRABOZPX.js +364 -0
- package/dist/VRABOZPX.js.map +1 -0
- package/dist/VUOMXK5T.js +6 -0
- package/dist/VUOMXK5T.js.map +1 -0
- package/dist/ZWKXKZVT.js +394 -0
- package/dist/ZWKXKZVT.js.map +1 -0
- package/dist/client.d.ts +17 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +4 -0
- package/dist/client.js.map +1 -0
- package/dist/deploy.d.ts +43 -0
- package/dist/deploy.d.ts.map +1 -0
- package/dist/deploy.js +4 -0
- package/dist/deploy.js.map +1 -0
- package/dist/env.d.ts +45 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +5 -0
- package/dist/env.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/localnet-global-setup.d.ts +7 -0
- package/dist/localnet-global-setup.d.ts.map +1 -0
- package/dist/localnet-global-setup.js +6 -0
- package/dist/localnet-global-setup.js.map +1 -0
- package/dist/localnet.d.ts +37 -0
- package/dist/localnet.d.ts.map +1 -0
- package/dist/localnet.js +5 -0
- package/dist/localnet.js.map +1 -0
- package/dist/protocol-global-setup.d.ts +58 -0
- package/dist/protocol-global-setup.d.ts.map +1 -0
- package/dist/protocol-global-setup.js +7 -0
- package/dist/protocol-global-setup.js.map +1 -0
- package/dist/scan.d.ts +59 -0
- package/dist/scan.d.ts.map +1 -0
- package/dist/scan.js +4 -0
- package/dist/scan.js.map +1 -0
- package/dist/secp256k1.d.ts +23 -0
- package/dist/secp256k1.d.ts.map +1 -0
- package/dist/secp256k1.js +4 -0
- package/dist/secp256k1.js.map +1 -0
- package/dist/utils.d.ts +54 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +5 -0
- package/dist/utils.js.map +1 -0
- package/package.json +50 -0
- package/src/client.ts +37 -0
- package/src/deploy.ts +316 -0
- package/src/env.ts +104 -0
- package/src/index.ts +40 -0
- package/src/localnet-global-setup.ts +30 -0
- package/src/localnet.ts +406 -0
- package/src/protocol-global-setup.ts +747 -0
- package/src/scan.ts +255 -0
- package/src/secp256k1.ts +59 -0
- package/src/utils.ts +642 -0
package/dist/env.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"env.js"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { createClient } from './client.js';
|
|
2
|
+
export { deployAssetSac, deployContract, deployNativeSac, deployZroToken, uploadWasm, } from './deploy.js';
|
|
3
|
+
export { createStellarTestEnv, type CreateStellarTestEnvOptions, type StellarTestEnv, } from './env.js';
|
|
4
|
+
export { fundAccount, startStellarLocalnet, stopStellarLocalnet } from './localnet.js';
|
|
5
|
+
export { createLocalnetOnlyGlobalSetup } from './localnet-global-setup.js';
|
|
6
|
+
export { type ChainAddresses, createProtocolStackGlobalSetup, type ProtocolContractModule, type ProtocolGlobalSetupContext, type ProtocolStackGlobalSetupOptions, type ProtocolStackModules, } from './protocol-global-setup.js';
|
|
7
|
+
export { type EventFilter, type PacketSentEvent, type ParsedContractEvent, scanEvents, scanPacketSentEvents, waitAndScanEvents, } from './scan.js';
|
|
8
|
+
export { Secp256k1KeyPair } from './secp256k1.js';
|
|
9
|
+
export { assertTransactionSucceeded, getNativeBalance, getTokenAuthorized, getTokenBalance, signAndSendWithExecutorAuth, signDvnAuthEntries, } from './utils.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACH,cAAc,EACd,cAAc,EACd,eAAe,EACf,cAAc,EACd,UAAU,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,cAAc,GACtB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EACH,KAAK,cAAc,EACnB,8BAA8B,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,oBAAoB,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,UAAU,EACV,oBAAoB,EACpB,iBAAiB,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACH,0BAA0B,EAC1B,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,2BAA2B,EAC3B,kBAAkB,GACrB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { assertTransactionSucceeded, getNativeBalance, getTokenAuthorized, getTokenBalance, signAndSendWithExecutorAuth, signDvnAuthEntries } from './VRABOZPX.js';
|
|
2
|
+
export { createStellarTestEnv } from './7DZ4SVEO.js';
|
|
3
|
+
export { Secp256k1KeyPair } from './DNRE4ENZ.js';
|
|
4
|
+
export { createLocalnetOnlyGlobalSetup } from './4UKUSHEU.js';
|
|
5
|
+
export { createProtocolStackGlobalSetup } from './ZWKXKZVT.js';
|
|
6
|
+
export { createClient } from './GAGBEOCZ.js';
|
|
7
|
+
export { fundAccount, startStellarLocalnet, stopStellarLocalnet } from './CYINPPER.js';
|
|
8
|
+
export { deployAssetSac, deployContract, deployNativeSac, deployZroToken, uploadWasm } from './TYAJMKGY.js';
|
|
9
|
+
export { scanEvents, scanPacketSentEvents, waitAndScanEvents } from './PMDPSIA2.js';
|
|
10
|
+
import './VUOMXK5T.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { StellarTestEnv } from './env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Vitest globalSetup that only starts/stops Stellar localnet.
|
|
4
|
+
* Use when the suite deploys its own contracts (e.g. protocol SDK upgrader tests).
|
|
5
|
+
*/
|
|
6
|
+
export declare function createLocalnetOnlyGlobalSetup(env: StellarTestEnv): (_ctx?: unknown) => Promise<() => Promise<void>>;
|
|
7
|
+
//# sourceMappingURL=localnet-global-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localnet-global-setup.d.ts","sourceRoot":"","sources":["../src/localnet-global-setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C;;;GAGG;AACH,wBAAgB,6BAA6B,CACzC,GAAG,EAAE,cAAc,GACpB,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAoBlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"localnet-global-setup.js"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { StellarTestEnv } from './env.js';
|
|
2
|
+
export declare const DEFAULT_STELLAR_LOCALNET_IMAGE = "438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/stellar:2026-03-02";
|
|
3
|
+
export declare const STELLAR_LOCALNET_OWNER_LABEL = "com.layerzerolabs.test-utils-stellar=1";
|
|
4
|
+
export declare const FUNDING_RETRY_INTERVAL_MS = 2000;
|
|
5
|
+
export interface DockerCommandResult {
|
|
6
|
+
status: number;
|
|
7
|
+
stdout: string;
|
|
8
|
+
stderr: string;
|
|
9
|
+
}
|
|
10
|
+
/** Injectable so container lifecycle policy can be tested without a Docker daemon. */
|
|
11
|
+
export type DockerCommandRunner = (args: readonly string[]) => DockerCommandResult;
|
|
12
|
+
export interface LocalnetLifecycleOptions {
|
|
13
|
+
env: StellarTestEnv;
|
|
14
|
+
commandRunner?: DockerCommandRunner;
|
|
15
|
+
}
|
|
16
|
+
export type NamedContainerRemovalPolicy = 'absent' | 'remove' | 'reject';
|
|
17
|
+
export declare function assertDockerArgs(env: StellarTestEnv): void;
|
|
18
|
+
export declare function buildDockerRunArgs(env: StellarTestEnv): string[];
|
|
19
|
+
export declare function buildDockerContainerIdLookupArgs(containerName: string): string[];
|
|
20
|
+
export declare function buildDockerOwnershipLabelLookupArgs(containerId: string): string[];
|
|
21
|
+
export declare function buildDockerRemoveArgs(containerId: string): string[];
|
|
22
|
+
export declare function getNamedContainerRemovalPolicy(containerId: string | undefined, ownerLabel: string | undefined): NamedContainerRemovalPolicy;
|
|
23
|
+
export declare function startStellarLocalnet({ env, commandRunner, }: LocalnetLifecycleOptions): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Fund a single account from the junk wallet (for ad-hoc test accounts).
|
|
26
|
+
* Calls are serialized to avoid sequence number conflicts on the junk wallet.
|
|
27
|
+
*/
|
|
28
|
+
export declare function fundAccount(env: StellarTestEnv, publicKey: string): Promise<void>;
|
|
29
|
+
/** Returns true when a destination account was created despite an ambiguous transaction poll. */
|
|
30
|
+
export declare function accountExists(getAccount: (accountId: string) => Promise<unknown>, accountId: string): Promise<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* Back off between fundTestAccounts rebuilds so a lagging localnet can confirm
|
|
33
|
+
* the previous attempt before we burn another try.
|
|
34
|
+
*/
|
|
35
|
+
export declare function pauseBeforeFundingRetry(attempt: number, maxAttempts: number, sleep?: (ms: number) => Promise<void>, intervalMs?: number): Promise<void>;
|
|
36
|
+
export declare function stopStellarLocalnet({ env, commandRunner, }: LocalnetLifecycleOptions): Promise<void>;
|
|
37
|
+
//# sourceMappingURL=localnet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localnet.d.ts","sourceRoot":"","sources":["../src/localnet.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,8BAA8B,kFACwC,CAAC;AAEpF,eAAO,MAAM,4BAA4B,2CAA2C,CAAC;AAMrF,eAAO,MAAM,yBAAyB,OAAQ,CAAC;AAO/C,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,sFAAsF;AACtF,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,mBAAmB,CAAC;AAEnF,MAAM,WAAW,wBAAwB;IACrC,GAAG,EAAE,cAAc,CAAC;IACpB,aAAa,CAAC,EAAE,mBAAmB,CAAC;CACvC;AAED,MAAM,MAAM,2BAA2B,GAAG,QAAQ,GA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
package/dist/localnet.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DEFAULT_STELLAR_LOCALNET_IMAGE, FUNDING_RETRY_INTERVAL_MS, STELLAR_LOCALNET_OWNER_LABEL, accountExists, assertDockerArgs, buildDockerContainerIdLookupArgs, buildDockerOwnershipLabelLookupArgs, buildDockerRemoveArgs, buildDockerRunArgs, fundAccount, getNamedContainerRemovalPolicy, pauseBeforeFundingRetry, startStellarLocalnet, stopStellarLocalnet } from './CYINPPER.js';
|
|
2
|
+
import './TYAJMKGY.js';
|
|
3
|
+
import './VUOMXK5T.js';
|
|
4
|
+
//# sourceMappingURL=localnet.js.map
|
|
5
|
+
//# sourceMappingURL=localnet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"localnet.js"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { StellarTestEnv } from './env.js';
|
|
2
|
+
/** Vitest globalSetup context subset (avoids a hard vitest type dependency in src/). */
|
|
3
|
+
export type ProtocolGlobalSetupContext = {
|
|
4
|
+
provide: (key: 'chainA' | 'chainB', value: ChainAddresses) => void;
|
|
5
|
+
};
|
|
6
|
+
export interface ProtocolContractModule {
|
|
7
|
+
/** The generated SDK Client constructor. Validated at the adapter boundary before use. */
|
|
8
|
+
Client: unknown;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Protocol contract modules from `@layerzerolabs/lz-v2-stellar-sdk`.
|
|
12
|
+
* Injected by consumers to avoid a workspace cycle (test-utils ↔ sdk).
|
|
13
|
+
*/
|
|
14
|
+
export interface ProtocolStackModules {
|
|
15
|
+
endpoint: ProtocolContractModule;
|
|
16
|
+
treasury: ProtocolContractModule;
|
|
17
|
+
uln302: ProtocolContractModule;
|
|
18
|
+
sml: ProtocolContractModule;
|
|
19
|
+
priceFeed: ProtocolContractModule;
|
|
20
|
+
executorFeeLib: ProtocolContractModule;
|
|
21
|
+
dvnFeeLib: ProtocolContractModule;
|
|
22
|
+
dvn: ProtocolContractModule;
|
|
23
|
+
executorHelper: ProtocolContractModule;
|
|
24
|
+
executor: ProtocolContractModule;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Addresses for a single chain's protocol contracts
|
|
28
|
+
*/
|
|
29
|
+
export interface ChainAddresses {
|
|
30
|
+
eid: number;
|
|
31
|
+
endpointV2: string;
|
|
32
|
+
uln302: string;
|
|
33
|
+
sml: string;
|
|
34
|
+
treasury: string;
|
|
35
|
+
executor: string;
|
|
36
|
+
executorHelper: string;
|
|
37
|
+
executorFeeLib: string;
|
|
38
|
+
priceFeed: string;
|
|
39
|
+
dvnFeeLib: string;
|
|
40
|
+
dvn: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ProtocolStackGlobalSetupOptions {
|
|
43
|
+
/**
|
|
44
|
+
* Directory containing protocol WASM artifacts, or an async resolver.
|
|
45
|
+
* Consumers typically resolve via getFullyQualifiedRepoRootPath.
|
|
46
|
+
*/
|
|
47
|
+
wasmDir: string | (() => string | Promise<string>);
|
|
48
|
+
/**
|
|
49
|
+
* Protocol contract modules from `@layerzerolabs/lz-v2-stellar-sdk`.
|
|
50
|
+
* Passed by the consumer to avoid a workspace dependency cycle.
|
|
51
|
+
*/
|
|
52
|
+
protocol: ProtocolStackModules;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns a Vitest globalSetup that deploys two protocol stacks and wires them.
|
|
56
|
+
*/
|
|
57
|
+
export declare function createProtocolStackGlobalSetup(env: StellarTestEnv, options: ProtocolStackGlobalSetupOptions): (ctx: ProtocolGlobalSetupContext) => Promise<() => Promise<void>>;
|
|
58
|
+
//# sourceMappingURL=protocol-global-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol-global-setup.d.ts","sourceRoot":"","sources":["../src/protocol-global-setup.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,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cAAc,EACnB,OAAO,EAAE,+BAA+B,GACzC,CAAC,GAAG,EAAE,0BAA0B,KAAK,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CA+EnE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createProtocolStackGlobalSetup } from './ZWKXKZVT.js';
|
|
2
|
+
import './GAGBEOCZ.js';
|
|
3
|
+
import './CYINPPER.js';
|
|
4
|
+
import './TYAJMKGY.js';
|
|
5
|
+
import './VUOMXK5T.js';
|
|
6
|
+
//# sourceMappingURL=protocol-global-setup.js.map
|
|
7
|
+
//# sourceMappingURL=protocol-global-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"protocol-global-setup.js"}
|
package/dist/scan.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { StellarTestEnv } from './env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Event filter for scanning contract events
|
|
4
|
+
*/
|
|
5
|
+
export interface EventFilter {
|
|
6
|
+
contractId: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Parsed contract event
|
|
10
|
+
*/
|
|
11
|
+
export interface ParsedContractEvent {
|
|
12
|
+
type: string;
|
|
13
|
+
contractId: string;
|
|
14
|
+
topics: any[];
|
|
15
|
+
data: any;
|
|
16
|
+
ledger: number;
|
|
17
|
+
txHash: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* PacketSent event structure from endpoint_v2.rs
|
|
21
|
+
*/
|
|
22
|
+
export interface PacketSentEvent {
|
|
23
|
+
encoded_packet: Buffer;
|
|
24
|
+
options: Buffer;
|
|
25
|
+
send_library: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const DEFAULT_LEDGER_WAIT_ATTEMPTS = 10;
|
|
28
|
+
export declare const DEFAULT_LEDGER_WAIT_DELAY_MS = 1000;
|
|
29
|
+
export type LatestLedgerReader = () => Promise<{
|
|
30
|
+
sequence: number;
|
|
31
|
+
}>;
|
|
32
|
+
export interface ResolveScanEndLedgerOptions {
|
|
33
|
+
maxAttempts?: number;
|
|
34
|
+
delayMs?: number;
|
|
35
|
+
sleep?: (ms: number) => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* RPC `getEvents` rejects ranges where start is past the tip, and treats end as
|
|
39
|
+
* exclusive in practice. Require tip strictly greater than the scan start ledger.
|
|
40
|
+
*/
|
|
41
|
+
export declare function assertValidScanLedgerRange(startLedger: number, endLedger: number): void;
|
|
42
|
+
/**
|
|
43
|
+
* Ensure latest ledger is strictly after `startLedgerSequence` before scanning.
|
|
44
|
+
* Returns the tip to use as `endLedger`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveScanEndLedger(getLatestLedger: LatestLedgerReader, startLedgerSequence: number, options?: ResolveScanEndLedgerOptions): Promise<number>;
|
|
47
|
+
/**
|
|
48
|
+
* Scan for contract events within a ledger range
|
|
49
|
+
*/
|
|
50
|
+
export declare function scanEvents(env: StellarTestEnv, startLedgerSequence: number, filter: EventFilter): Promise<ParsedContractEvent[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Scan for PacketSent events from the Endpoint contract
|
|
53
|
+
*/
|
|
54
|
+
export declare function scanPacketSentEvents(env: StellarTestEnv, endpointAddress: string, startLedger: number): Promise<PacketSentEvent[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Wait for new ledgers and scan for events
|
|
57
|
+
*/
|
|
58
|
+
export declare function waitAndScanEvents(env: StellarTestEnv, startLedger: number, contractAddress: string, eventName: string, maxWaitSeconds?: number): Promise<ParsedContractEvent[]>;
|
|
59
|
+
//# sourceMappingURL=scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;GAEG;AACH,M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G,EAAE,cAAc,EACnB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,eAAe,EAAE,CAAC,CA6D5B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACnC,GAAG,EAAE,cAAc,EACnB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EACjB,cAAc,GAAE,MAAW,GAC5B,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAiChC"}
|
package/dist/scan.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { DEFAULT_LEDGER_WAIT_ATTEMPTS, DEFAULT_LEDGER_WAIT_DELAY_MS, assertValidScanLedgerRange, resolveScanEndLedger, scanEvents, scanPacketSentEvents, waitAndScanEvents } from './PMDPSIA2.js';
|
|
2
|
+
import './VUOMXK5T.js';
|
|
3
|
+
//# sourceMappingURL=scan.js.map
|
|
4
|
+
//# sourceMappingURL=scan.js.map
|
package/dist/scan.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"scan.js"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A secp256k1 key pair with private key and derived Ethereum-style address.
|
|
3
|
+
* Used for DVN multisig signing.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Secp256k1KeyPair {
|
|
6
|
+
private privateKey;
|
|
7
|
+
readonly ethAddress: Buffer;
|
|
8
|
+
constructor(privateKey: Uint8Array | Buffer | string);
|
|
9
|
+
/**
|
|
10
|
+
* Generate a random key pair.
|
|
11
|
+
*/
|
|
12
|
+
static generate(): Secp256k1KeyPair;
|
|
13
|
+
/**
|
|
14
|
+
* Derive Ethereum-style address from the public key.
|
|
15
|
+
* Address = last 20 bytes of keccak256(uncompressed_pubkey[1:65])
|
|
16
|
+
*/
|
|
17
|
+
private deriveEthAddress;
|
|
18
|
+
/**
|
|
19
|
+
* Sign a 32-byte digest and return a 65-byte signature (r || s || v).
|
|
20
|
+
*/
|
|
21
|
+
sign(digest: Uint8Array): Promise<Buffer>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=secp256k1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secp256k1.d.ts","sourceRoot":"","sources":["../src/secp256k1.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,qBAAa,gBAAgB;IACzB,OAAO,CAAC,UAAU,CAAa;IAC/B,SAAgB,UAAU,EAAE,MAAM,CAAC;gBAEvB,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM;IAWpD;;OAEG;IACH,MAAM,CAAC,QAAQ,IAAI,gBAAgB;IAKnC;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;OAEG;IACG,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;CAclD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"secp256k1.js"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { contract, Keypair } from '@stellar/stellar-sdk';
|
|
2
|
+
import * as rpc from '@stellar/stellar-sdk/rpc';
|
|
3
|
+
import type { StellarTestEnv } from './env.js';
|
|
4
|
+
import type { Secp256k1KeyPair } from './secp256k1.js';
|
|
5
|
+
export { createClient } from './client.js';
|
|
6
|
+
/**
|
|
7
|
+
* Helper to get token balance for an address using SAC (Stellar Asset Contract).
|
|
8
|
+
* Works for any token including native XLM.
|
|
9
|
+
*
|
|
10
|
+
* @param tokenAddress - The SAC contract address (defaults to native XLM)
|
|
11
|
+
* @param accountAddress - The account to check balance for
|
|
12
|
+
*/
|
|
13
|
+
export declare function getTokenBalance(env: StellarTestEnv, accountAddress: string, tokenAddress?: string): Promise<bigint>;
|
|
14
|
+
/**
|
|
15
|
+
* Helper to get native token (XLM) balance for an address.
|
|
16
|
+
* Convenience wrapper around getTokenBalance.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getNativeBalance(env: StellarTestEnv, accountAddress: string): Promise<bigint>;
|
|
19
|
+
/**
|
|
20
|
+
* Helper to check if an account is authorized on a SAC (Stellar Asset Contract).
|
|
21
|
+
* Calls the SAC's `authorized()` method directly.
|
|
22
|
+
*
|
|
23
|
+
* @param accountAddress - The account to check authorization for
|
|
24
|
+
* @param tokenAddress - The SAC contract address
|
|
25
|
+
*/
|
|
26
|
+
export declare function getTokenAuthorized(env: StellarTestEnv, accountAddress: string, tokenAddress: string): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Signs the DVN abstract account's auth entries.
|
|
29
|
+
*
|
|
30
|
+
* The DVN contract implements CustomAccountInterface with Signature = TransactionAuthData.
|
|
31
|
+
* TransactionAuthData contains:
|
|
32
|
+
* - vid: u32 - Verifier ID
|
|
33
|
+
* - expiration: u64 - Ledger timestamp for when auth expires
|
|
34
|
+
* - signatures: Vec<BytesN<65>> - Secp256k1 signatures from multisig signers
|
|
35
|
+
* - sender: Sender - Either None or Admin(public_key, ed25519_signature)
|
|
36
|
+
*/
|
|
37
|
+
export declare function signDvnAuthEntries<T>(dvnAddress: string, vid: number, adminKeypair: Keypair, multisigSigners: Secp256k1KeyPair[], assembledTx: contract.AssembledTransaction<T>, networkPassphrase: string): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Signs and sends a transaction with Executor abstract account auth entries.
|
|
40
|
+
*
|
|
41
|
+
* The Executor contract implements CustomAccountInterface with Signature = ExecutorSignature.
|
|
42
|
+
* ExecutorSignature contains:
|
|
43
|
+
* - public_key: BytesN<32> - Admin's Ed25519 public key
|
|
44
|
+
* - signature: BytesN<64> - Ed25519 signature over the signature_payload
|
|
45
|
+
*
|
|
46
|
+
* This function uses `record_allow_nonroot` simulation mode to capture non-root auth entries,
|
|
47
|
+
* which is required because the executor authorizes `lz_receive`/`lz_compose` calls that are
|
|
48
|
+
* invoked by the ExecutorHelper contract (not the root invoker).
|
|
49
|
+
*
|
|
50
|
+
* @returns The transaction result after sending
|
|
51
|
+
*/
|
|
52
|
+
export declare function signAndSendWithExecutorAuth<T>(env: StellarTestEnv, executorAddress: string, adminKeypair: Keypair, assembledTx: contract.AssembledTransaction<T>, networkPassphrase?: string): Promise<rpc.Api.GetSuccessfulTransactionResponse>;
|
|
53
|
+
export declare function assertTransactionSucceeded(txResult: rpc.Api.GetTransactionResponse, contextLabel: string): void;
|
|
54
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAa9D,OAAO,KAAK,GAAG,MAAM,0BAA0B,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C;;;;;;GAMG;AACH,wBAAsB,eAAe,CACjC,GAAG,EAAE,cAAc,EACnB,cAAc,EAAE,MAAM,EACtB,YAAY,GAAE,MAAiC,GAChD,OAAO,CAAC,MAAM,CAAC,CA8BjB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAClC,GAAG,EAAE,cAAc,EACnB,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACpC,GAAG,EAAE,cAAc,EACnB,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,CAAC,CA4BlB;AAMD;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,EACtC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,OAAO,EACrB,eAAe,EAAE,gBAAgB,EAAE,EACnC,WAAW,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAC7C,iBAAiB,EAAE,MAAM,GAC1B,OAAO,CAAC,IAAI,CAAC,CAoJf;AA8GD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,2BAA2B,CAAC,CAAC,EAC/C,GAAG,EAAE,cAAc,EACnB,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,OAAO,EACrB,WAAW,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAC7C,iBAAiB,GAAE,MAA+B,GACnD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAyLnD;AA4BD,wBAAgB,0BAA0B,CACtC,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,sBAAsB,EACxC,YAAY,EAAE,MAAM,GACrB,IAAI,CAMN"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { assertTransactionSucceeded, getNativeBalance, getTokenAuthorized, getTokenBalance, signAndSendWithExecutorAuth, signDvnAuthEntries } from './VRABOZPX.js';
|
|
2
|
+
export { createClient } from './GAGBEOCZ.js';
|
|
3
|
+
import './VUOMXK5T.js';
|
|
4
|
+
//# sourceMappingURL=utils.js.map
|
|
5
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"utils.js"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@layerzerolabs/test-utils-stellar",
|
|
3
|
+
"version": "0.2.122",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Shared Stellar/Soroban test harness (localnet, funding, deploy helpers) for LayerZero V2 protocol SDK and custom OApp/OFT tests",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"module": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"src"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@noble/hashes": "^1.8.0",
|
|
22
|
+
"@noble/secp256k1": "1.7.1",
|
|
23
|
+
"@stellar/stellar-sdk": "^14.4.3"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^22.18.6",
|
|
27
|
+
"tsup": "^8.4.0",
|
|
28
|
+
"typescript": "^5.8.2",
|
|
29
|
+
"vitest": "^3.2.6",
|
|
30
|
+
"@layerzerolabs/tsup-configuration": "0.2.122",
|
|
31
|
+
"@layerzerolabs/typescript-configuration": "0.2.122"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"registry": "https://registry.npmjs.org/"
|
|
36
|
+
},
|
|
37
|
+
"externalRepoConfig": {
|
|
38
|
+
"targets": [
|
|
39
|
+
"audit-external",
|
|
40
|
+
"console-pen-test",
|
|
41
|
+
"monorepo-external",
|
|
42
|
+
"onesig-client"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsup",
|
|
47
|
+
"lint": "eslint . --max-warnings 0 || (eslint . --fix --max-warnings 0 && false)",
|
|
48
|
+
"test": "vitest --run --pass-with-no-tests --typecheck"
|
|
49
|
+
}
|
|
50
|
+
}
|
package/src/client.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Keypair } from '@stellar/stellar-sdk';
|
|
2
|
+
import { TransactionBuilder } from '@stellar/stellar-sdk';
|
|
3
|
+
|
|
4
|
+
import type { StellarTestEnv } from './env.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a Soroban contract client with DEFAULT_DEPLOYER as signer.
|
|
8
|
+
*/
|
|
9
|
+
export function createClient<T>(
|
|
10
|
+
env: StellarTestEnv,
|
|
11
|
+
ClientClass: new (options: {
|
|
12
|
+
contractId: string;
|
|
13
|
+
publicKey: string;
|
|
14
|
+
signTransaction: (tx: string) => Promise<{ signedTxXdr: string; signerAddress: string }>;
|
|
15
|
+
rpcUrl: string;
|
|
16
|
+
networkPassphrase: string;
|
|
17
|
+
allowHttp: boolean;
|
|
18
|
+
}) => T,
|
|
19
|
+
contractId: string,
|
|
20
|
+
signer: Keypair = env.DEFAULT_DEPLOYER,
|
|
21
|
+
): T {
|
|
22
|
+
return new ClientClass({
|
|
23
|
+
contractId,
|
|
24
|
+
publicKey: signer.publicKey(),
|
|
25
|
+
signTransaction: async (tx: string) => {
|
|
26
|
+
const transaction = TransactionBuilder.fromXDR(tx, env.NETWORK_PASSPHRASE);
|
|
27
|
+
transaction.sign(signer);
|
|
28
|
+
return {
|
|
29
|
+
signedTxXdr: transaction.toXDR(),
|
|
30
|
+
signerAddress: signer.publicKey(),
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
rpcUrl: env.RPC_URL,
|
|
34
|
+
networkPassphrase: env.NETWORK_PASSPHRASE,
|
|
35
|
+
allowHttp: true,
|
|
36
|
+
});
|
|
37
|
+
}
|