@slvr-labs/sdk 0.1.0 → 0.1.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/README.md +42 -0
- package/dist/index.d.mts +2117 -0
- package/dist/index.d.ts +1903 -34
- package/dist/index.js +3091 -427
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3035 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +17 -10
- package/skills/slvr-bot/SKILL.md +9 -8
- package/skills/slvr-bot/references/api.md +8 -0
- package/dist/connect.d.ts +0 -47
- package/dist/connect.d.ts.map +0 -1
- package/dist/connect.js +0 -56
- package/dist/connect.js.map +0 -1
- package/dist/contracts/autoCommit.d.ts +0 -151
- package/dist/contracts/autoCommit.d.ts.map +0 -1
- package/dist/contracts/autoCommit.js +0 -426
- package/dist/contracts/autoCommit.js.map +0 -1
- package/dist/contracts/hub.d.ts +0 -50
- package/dist/contracts/hub.d.ts.map +0 -1
- package/dist/contracts/hub.js +0 -118
- package/dist/contracts/hub.js.map +0 -1
- package/dist/contracts/index.d.ts +0 -8
- package/dist/contracts/index.d.ts.map +0 -1
- package/dist/contracts/index.js +0 -18
- package/dist/contracts/index.js.map +0 -1
- package/dist/contracts/jackpot.d.ts +0 -21
- package/dist/contracts/jackpot.d.ts.map +0 -1
- package/dist/contracts/jackpot.js +0 -44
- package/dist/contracts/jackpot.js.map +0 -1
- package/dist/contracts/lottery.d.ts +0 -256
- package/dist/contracts/lottery.d.ts.map +0 -1
- package/dist/contracts/lottery.js +0 -767
- package/dist/contracts/lottery.js.map +0 -1
- package/dist/contracts/registry.d.ts +0 -53
- package/dist/contracts/registry.d.ts.map +0 -1
- package/dist/contracts/registry.js +0 -143
- package/dist/contracts/registry.js.map +0 -1
- package/dist/contracts/staking.d.ts +0 -101
- package/dist/contracts/staking.d.ts.map +0 -1
- package/dist/contracts/staking.js +0 -306
- package/dist/contracts/staking.js.map +0 -1
- package/dist/contracts/token.d.ts +0 -95
- package/dist/contracts/token.d.ts.map +0 -1
- package/dist/contracts/token.js +0 -273
- package/dist/contracts/token.js.map +0 -1
- package/dist/deployments.d.ts +0 -117
- package/dist/deployments.d.ts.map +0 -1
- package/dist/deployments.js +0 -74
- package/dist/deployments.js.map +0 -1
- package/dist/errors.d.ts +0 -39
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -67
- package/dist/errors.js.map +0 -1
- package/dist/ev.d.ts +0 -123
- package/dist/ev.d.ts.map +0 -1
- package/dist/ev.js +0 -111
- package/dist/ev.js.map +0 -1
- package/dist/events.d.ts +0 -418
- package/dist/events.d.ts.map +0 -1
- package/dist/events.js +0 -87
- package/dist/events.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/oracle.d.ts +0 -48
- package/dist/oracle.d.ts.map +0 -1
- package/dist/oracle.js +0 -77
- package/dist/oracle.js.map +0 -1
- package/dist/price.d.ts +0 -52
- package/dist/price.d.ts.map +0 -1
- package/dist/price.js +0 -78
- package/dist/price.js.map +0 -1
- package/dist/transaction.d.ts +0 -54
- package/dist/transaction.d.ts.map +0 -1
- package/dist/transaction.js +0 -105
- package/dist/transaction.js.map +0 -1
- package/dist/types.d.ts +0 -162
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -23
- package/dist/types.js.map +0 -1
- package/dist/utils.d.ts +0 -58
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -110
- package/dist/utils.js.map +0 -1
package/dist/price.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Address, PublicClient } from 'viem';
|
|
2
|
-
/**
|
|
3
|
-
* Reserves of the SLVR/ETH UniswapV2 pair, with the token ordering resolved.
|
|
4
|
-
*/
|
|
5
|
-
export interface SlvrReserves {
|
|
6
|
-
/** SLVR reserve, in wei (18 decimals). */
|
|
7
|
-
slvrReserve: bigint;
|
|
8
|
-
/** ETH (WETH) reserve, in wei (18 decimals). */
|
|
9
|
-
ethReserve: bigint;
|
|
10
|
-
/** Whether SLVR is `token0` in the pair (ordering is resolved for you). */
|
|
11
|
-
token0IsSlvr: boolean;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Reads the SLVR price from the SLVR/ETH UniswapV2 pair.
|
|
15
|
-
*
|
|
16
|
-
* Mirrors the web app's price logic: it reads the pair's `getReserves()` and
|
|
17
|
-
* `token0()`, figures out which reserve is SLVR (never assumes ordering), and
|
|
18
|
-
* prices SLVR as `ethReserve / slvrReserve`. Both tokens are 18-decimal, so the
|
|
19
|
-
* raw reserve ratio is already ETH-per-SLVR.
|
|
20
|
-
*
|
|
21
|
-
* This is a **spot** price straight from reserves — no TWAP, no slippage model.
|
|
22
|
-
* Fine for sizing bets and EV estimates; do not use it as an oracle for anything
|
|
23
|
-
* that must resist manipulation.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```typescript
|
|
27
|
-
* import { SlvrPrice } from '@slvr-labs/sdk';
|
|
28
|
-
* const price = new SlvrPrice(publicClient, pairAddress, slvrTokenAddress);
|
|
29
|
-
* const ethPerSlvr = await price.getPriceInEth();
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare class SlvrPrice {
|
|
33
|
-
private publicClient;
|
|
34
|
-
private pairAddress;
|
|
35
|
-
private slvrTokenAddress;
|
|
36
|
-
private static readonly PAIR_ABI;
|
|
37
|
-
constructor(publicClient: PublicClient, pairAddress: Address, slvrTokenAddress: Address);
|
|
38
|
-
/** Read the pair reserves and resolve which side is SLVR. */
|
|
39
|
-
getReserves(): Promise<SlvrReserves>;
|
|
40
|
-
/**
|
|
41
|
-
* SLVR price in ETH (ETH per SLVR), as a floating-point number.
|
|
42
|
-
* @throws {Error} if the pair has no SLVR liquidity (zero reserve).
|
|
43
|
-
*/
|
|
44
|
-
getPriceInEth(): Promise<number>;
|
|
45
|
-
/**
|
|
46
|
-
* SLVR price in ETH as a WAD (1e18-scaled `bigint`), for callers that want to
|
|
47
|
-
* stay in integer math: `priceWad = ethReserve * 1e18 / slvrReserve`.
|
|
48
|
-
* @throws {Error} if the pair has no SLVR liquidity (zero reserve).
|
|
49
|
-
*/
|
|
50
|
-
getPriceInEthWad(): Promise<bigint>;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=price.d.ts.map
|
package/dist/price.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../src/price.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAY,MAAM,MAAM,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,gBAAgB,CAAU;IAElC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAG7B;gBAES,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO;IAMvF,6DAA6D;IACvD,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC;IAoB1C;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAQtC;;;;OAIG;IACG,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;CAO1C"}
|
package/dist/price.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SlvrPrice = void 0;
|
|
4
|
-
const viem_1 = require("viem");
|
|
5
|
-
/**
|
|
6
|
-
* Reads the SLVR price from the SLVR/ETH UniswapV2 pair.
|
|
7
|
-
*
|
|
8
|
-
* Mirrors the web app's price logic: it reads the pair's `getReserves()` and
|
|
9
|
-
* `token0()`, figures out which reserve is SLVR (never assumes ordering), and
|
|
10
|
-
* prices SLVR as `ethReserve / slvrReserve`. Both tokens are 18-decimal, so the
|
|
11
|
-
* raw reserve ratio is already ETH-per-SLVR.
|
|
12
|
-
*
|
|
13
|
-
* This is a **spot** price straight from reserves — no TWAP, no slippage model.
|
|
14
|
-
* Fine for sizing bets and EV estimates; do not use it as an oracle for anything
|
|
15
|
-
* that must resist manipulation.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* import { SlvrPrice } from '@slvr-labs/sdk';
|
|
20
|
-
* const price = new SlvrPrice(publicClient, pairAddress, slvrTokenAddress);
|
|
21
|
-
* const ethPerSlvr = await price.getPriceInEth();
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
class SlvrPrice {
|
|
25
|
-
constructor(publicClient, pairAddress, slvrTokenAddress) {
|
|
26
|
-
this.publicClient = publicClient;
|
|
27
|
-
this.pairAddress = pairAddress;
|
|
28
|
-
this.slvrTokenAddress = slvrTokenAddress;
|
|
29
|
-
}
|
|
30
|
-
/** Read the pair reserves and resolve which side is SLVR. */
|
|
31
|
-
async getReserves() {
|
|
32
|
-
const [reserves, token0] = await Promise.all([
|
|
33
|
-
this.publicClient.readContract({
|
|
34
|
-
address: this.pairAddress,
|
|
35
|
-
abi: SlvrPrice.PAIR_ABI,
|
|
36
|
-
functionName: 'getReserves',
|
|
37
|
-
}),
|
|
38
|
-
this.publicClient.readContract({
|
|
39
|
-
address: this.pairAddress,
|
|
40
|
-
abi: SlvrPrice.PAIR_ABI,
|
|
41
|
-
functionName: 'token0',
|
|
42
|
-
}),
|
|
43
|
-
]);
|
|
44
|
-
const token0IsSlvr = token0.toLowerCase() === this.slvrTokenAddress.toLowerCase();
|
|
45
|
-
const slvrReserve = token0IsSlvr ? reserves[0] : reserves[1];
|
|
46
|
-
const ethReserve = token0IsSlvr ? reserves[1] : reserves[0];
|
|
47
|
-
return { slvrReserve, ethReserve, token0IsSlvr };
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* SLVR price in ETH (ETH per SLVR), as a floating-point number.
|
|
51
|
-
* @throws {Error} if the pair has no SLVR liquidity (zero reserve).
|
|
52
|
-
*/
|
|
53
|
-
async getPriceInEth() {
|
|
54
|
-
const { slvrReserve, ethReserve } = await this.getReserves();
|
|
55
|
-
if (slvrReserve === 0n) {
|
|
56
|
-
throw new Error('SLVR/ETH pair has zero SLVR reserve; cannot price');
|
|
57
|
-
}
|
|
58
|
-
return Number(ethReserve) / Number(slvrReserve);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* SLVR price in ETH as a WAD (1e18-scaled `bigint`), for callers that want to
|
|
62
|
-
* stay in integer math: `priceWad = ethReserve * 1e18 / slvrReserve`.
|
|
63
|
-
* @throws {Error} if the pair has no SLVR liquidity (zero reserve).
|
|
64
|
-
*/
|
|
65
|
-
async getPriceInEthWad() {
|
|
66
|
-
const { slvrReserve, ethReserve } = await this.getReserves();
|
|
67
|
-
if (slvrReserve === 0n) {
|
|
68
|
-
throw new Error('SLVR/ETH pair has zero SLVR reserve; cannot price');
|
|
69
|
-
}
|
|
70
|
-
return (ethReserve * 10n ** 18n) / slvrReserve;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
exports.SlvrPrice = SlvrPrice;
|
|
74
|
-
SlvrPrice.PAIR_ABI = (0, viem_1.parseAbi)([
|
|
75
|
-
'function getReserves() view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)',
|
|
76
|
-
'function token0() view returns (address)',
|
|
77
|
-
]);
|
|
78
|
-
//# sourceMappingURL=price.js.map
|
package/dist/price.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"price.js","sourceRoot":"","sources":["../src/price.ts"],"names":[],"mappings":";;;AAAA,+BAAuD;AAc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C;QAC7D,IAAI,WAAW,KAAK,EAAE,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB;QACpB,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC7D,IAAI,WAAW,KAAK,EAAE,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,CAAC,UAAU,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,WAAW,CAAC;IACjD,CAAC;;AA5DH,8BA6DC;AAxDyB,kBAAQ,GAAG,IAAA,eAAQ,EAAC;IAC1C,qGAAqG;IACrG,0CAA0C;CAC3C,CAAC,CAAC"}
|
package/dist/transaction.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { PublicClient, WalletClient, Address } from 'viem';
|
|
2
|
-
/**
|
|
3
|
-
* Options for transaction execution
|
|
4
|
-
*/
|
|
5
|
-
export interface TransactionOptions {
|
|
6
|
-
/** Maximum gas to use */
|
|
7
|
-
gas?: bigint;
|
|
8
|
-
/** Gas price (legacy) */
|
|
9
|
-
gasPrice?: bigint;
|
|
10
|
-
/** Max fee per gas (EIP-1559) */
|
|
11
|
-
maxFeePerGas?: bigint;
|
|
12
|
-
/** Max priority fee per gas (EIP-1559) */
|
|
13
|
-
maxPriorityFeePerGas?: bigint;
|
|
14
|
-
/** Whether to wait for transaction receipt */
|
|
15
|
-
waitForReceipt?: boolean;
|
|
16
|
-
/** Timeout for waiting for receipt (milliseconds) */
|
|
17
|
-
receiptTimeout?: number;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Estimate gas for a contract write operation
|
|
21
|
-
* @param publicClient Public client
|
|
22
|
-
* @param address Contract address
|
|
23
|
-
* @param abi Contract ABI
|
|
24
|
-
* @param functionName Function name
|
|
25
|
-
* @param args Function arguments
|
|
26
|
-
* @param value Optional value to send
|
|
27
|
-
* @param account Optional account address
|
|
28
|
-
* @returns Estimated gas
|
|
29
|
-
*/
|
|
30
|
-
export declare function estimateGas(publicClient: PublicClient, address: Address, abi: readonly unknown[], functionName: string, args: unknown[], value?: bigint, account?: Address): Promise<bigint>;
|
|
31
|
-
/**
|
|
32
|
-
* Wait for transaction receipt with error handling
|
|
33
|
-
* @param publicClient Public client
|
|
34
|
-
* @param hash Transaction hash
|
|
35
|
-
* @param timeout Timeout in milliseconds
|
|
36
|
-
* @returns Transaction receipt
|
|
37
|
-
* @throws TransactionError if transaction fails or times out
|
|
38
|
-
*/
|
|
39
|
-
export declare function waitForReceipt(publicClient: PublicClient, hash: `0x${string}`, timeout?: number): Promise<unknown>;
|
|
40
|
-
/**
|
|
41
|
-
* Execute a contract write with options
|
|
42
|
-
* @param walletClient Wallet client
|
|
43
|
-
* @param publicClient Public client
|
|
44
|
-
* @param address Contract address
|
|
45
|
-
* @param abi Contract ABI
|
|
46
|
-
* @param functionName Function name
|
|
47
|
-
* @param args Function arguments
|
|
48
|
-
* @param options Transaction options
|
|
49
|
-
* @returns Transaction hash or receipt
|
|
50
|
-
*/
|
|
51
|
-
export declare function executeTransaction(walletClient: WalletClient, publicClient: PublicClient, address: Address, abi: readonly unknown[], functionName: string, args: unknown[], options?: TransactionOptions & {
|
|
52
|
-
value?: bigint;
|
|
53
|
-
}): Promise<`0x${string}` | unknown>;
|
|
54
|
-
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG3D;;GAEG;AACH,MA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
-
exports.estimateGas = estimateGas;
|
|
4
|
-
exports.waitForReceipt = waitForReceipt;
|
|
5
|
-
exports.executeTransaction = executeTransaction;
|
|
6
|
-
const errors_1 = require("./errors");
|
|
7
|
-
/**
|
|
8
|
-
* Estimate gas for a contract write operation
|
|
9
|
-
* @param publicClient Public client
|
|
10
|
-
* @param address Contract address
|
|
11
|
-
* @param abi Contract ABI
|
|
12
|
-
* @param functionName Function name
|
|
13
|
-
* @param args Function arguments
|
|
14
|
-
* @param value Optional value to send
|
|
15
|
-
* @param account Optional account address
|
|
16
|
-
* @returns Estimated gas
|
|
17
|
-
*/
|
|
18
|
-
async function estimateGas(publicClient, address, abi, functionName, args, value, account) {
|
|
19
|
-
try {
|
|
20
|
-
const estimateParams = {
|
|
21
|
-
address,
|
|
22
|
-
abi,
|
|
23
|
-
functionName,
|
|
24
|
-
args,
|
|
25
|
-
};
|
|
26
|
-
if (value !== undefined) {
|
|
27
|
-
estimateParams.value = value;
|
|
28
|
-
}
|
|
29
|
-
if (account !== undefined) {
|
|
30
|
-
estimateParams.account = account;
|
|
31
|
-
}
|
|
32
|
-
const gas = await publicClient.estimateContractGas(estimateParams);
|
|
33
|
-
return gas;
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
throw new errors_1.TransactionError(`Failed to estimate gas for ${functionName}: ${error instanceof Error ? error.message : String(error)}`, undefined, error);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Wait for transaction receipt with error handling
|
|
41
|
-
* @param publicClient Public client
|
|
42
|
-
* @param hash Transaction hash
|
|
43
|
-
* @param timeout Timeout in milliseconds
|
|
44
|
-
* @returns Transaction receipt
|
|
45
|
-
* @throws TransactionError if transaction fails or times out
|
|
46
|
-
*/
|
|
47
|
-
async function waitForReceipt(publicClient, hash, timeout = 120000) {
|
|
48
|
-
try {
|
|
49
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
50
|
-
hash,
|
|
51
|
-
timeout,
|
|
52
|
-
});
|
|
53
|
-
// Check if transaction failed
|
|
54
|
-
if (receipt && typeof receipt === 'object' && 'status' in receipt) {
|
|
55
|
-
if (receipt.status === 'reverted') {
|
|
56
|
-
throw new errors_1.TransactionError(`Transaction reverted: ${hash}`, hash);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return receipt;
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
if (error instanceof errors_1.TransactionError) {
|
|
63
|
-
throw error;
|
|
64
|
-
}
|
|
65
|
-
throw new errors_1.TransactionError(`Failed to wait for transaction receipt: ${error instanceof Error ? error.message : String(error)}`, hash, error);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Execute a contract write with options
|
|
70
|
-
* @param walletClient Wallet client
|
|
71
|
-
* @param publicClient Public client
|
|
72
|
-
* @param address Contract address
|
|
73
|
-
* @param abi Contract ABI
|
|
74
|
-
* @param functionName Function name
|
|
75
|
-
* @param args Function arguments
|
|
76
|
-
* @param options Transaction options
|
|
77
|
-
* @returns Transaction hash or receipt
|
|
78
|
-
*/
|
|
79
|
-
async function executeTransaction(walletClient, publicClient, address, abi, functionName, args, options = {}) {
|
|
80
|
-
const { gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, waitForReceipt: waitForReceipt_, receiptTimeout, value, } = options;
|
|
81
|
-
const writeParams = {
|
|
82
|
-
address,
|
|
83
|
-
abi,
|
|
84
|
-
functionName,
|
|
85
|
-
args,
|
|
86
|
-
account: walletClient.account,
|
|
87
|
-
chain: null,
|
|
88
|
-
...(value !== undefined && { value }),
|
|
89
|
-
...(gas !== undefined && { gas }),
|
|
90
|
-
...(gasPrice !== undefined && { gasPrice }),
|
|
91
|
-
...(maxFeePerGas !== undefined && { maxFeePerGas }),
|
|
92
|
-
...(maxPriorityFeePerGas !== undefined && { maxPriorityFeePerGas }),
|
|
93
|
-
};
|
|
94
|
-
try {
|
|
95
|
-
const hash = await walletClient.writeContract(writeParams);
|
|
96
|
-
if (waitForReceipt_) {
|
|
97
|
-
return await waitForReceipt(publicClient, hash, receiptTimeout);
|
|
98
|
-
}
|
|
99
|
-
return hash;
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
throw new errors_1.TransactionError(`Failed to execute transaction: ${error instanceof Error ? error.message : String(error)}`, undefined, error);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=transaction.js.map
|
package/dist/transaction.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":";;AAgCA,kCA+BC;AAUD,wCAgCC;AAaD,gDAgDC;AArKD,qCAA4C;AAoB5C;;;;;;;;;;GAUG;AACI,KAAK,UAAU,WAAW,CAC/B,YAA0B,EAC1B,OAAgB,EAChB,GAAuB,EACvB,YAAoB,EACpB,IAAe,EACf,KAAc,EACd,OAAiB;IAEjB,IAAI,CAAC;QACH,MAAM,cAAc,GAAQ;YAC1B,OAAO;YACP,GAAG;YACH,YAAY;YACZ,IAAI;SACL,CAAC;QACF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,cAAc,CAAC,KAAK,GAAG,KAAK,CAAC;QAC/B,CAAC;QACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,cAAc,CAAC,OAAO,GAAG,OAAO,CAAC;QACnC,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;QACnE,OAAO,GAAG,CAAC;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,yBAAgB,CACxB,8BAA8B,YAAY,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACvG,SAAS,EACT,KAAK,CACN,CAAC;IACJ,CAA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,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;QACrC,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,GAAG,EAAE,CAAC;QACjC,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,CAAC;QAC3C,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,YAAY,EAAE,CAAC;QACnD,GAAG,CAAC,oBAAoB,KAAK,SAAS,IAAI,EAAE,oBAAoB,EAAE,CAAC;KAChB,CAAC;IAEtD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QAE3D,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,MAAM,cAAc,CAAC,YAAY,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,yBAAgB,CACxB,kCAAkC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAC1F,SAAS,EACT,KAAK,CACN,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { Address, PublicClient, WalletClient } from 'viem';
|
|
2
|
-
/**
|
|
3
|
-
* Configuration for the Slvr SDK
|
|
4
|
-
*/
|
|
5
|
-
export interface SlvrConfig {
|
|
6
|
-
/** Public client for read operations */
|
|
7
|
-
publicClient: PublicClient;
|
|
8
|
-
/** Wallet client for write operations (optional, required for transactions) */
|
|
9
|
-
walletClient?: WalletClient;
|
|
10
|
-
/** Contract addresses */
|
|
11
|
-
addresses: {
|
|
12
|
-
lottery: Address;
|
|
13
|
-
staking: Address;
|
|
14
|
-
token: Address;
|
|
15
|
-
autoCommit?: Address;
|
|
16
|
-
/** SlvrHub address (optional, for emission/staker/jackpot stats and keeper/admin ops) */
|
|
17
|
-
hub?: Address;
|
|
18
|
-
/** SlvrGameRegistry address (optional, for game weight/status stats) */
|
|
19
|
-
registry?: Address;
|
|
20
|
-
/** SlvrJackpot address (optional, for jackpot pool reads) */
|
|
21
|
-
jackpot?: Address;
|
|
22
|
-
/** SLVR/ETH UniswapV2 pair address (optional, enables `sdk.price` SLVR price reads) */
|
|
23
|
-
slvrEthPair?: Address;
|
|
24
|
-
/**
|
|
25
|
-
* Chainlink-style ETH/USD price feed address (optional, enables `sdk.ethUsd`
|
|
26
|
-
* and USD-denominated prices). Only set on chains that actually have a feed.
|
|
27
|
-
*/
|
|
28
|
-
chainlinkEthUsd?: Address;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* A SLVR price quote in both ETH and USD.
|
|
33
|
-
*/
|
|
34
|
-
export interface PriceQuote {
|
|
35
|
-
/** Price in ETH (ETH per SLVR). */
|
|
36
|
-
eth: number;
|
|
37
|
-
/** Price in USD, or `null` if no ETH/USD source was available. */
|
|
38
|
-
usd: number | null;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Round information
|
|
42
|
-
*/
|
|
43
|
-
export interface RoundInfo {
|
|
44
|
-
roundId: bigint;
|
|
45
|
-
requestedAt: bigint;
|
|
46
|
-
resolved: boolean;
|
|
47
|
-
randomnessId: `0x${string}`;
|
|
48
|
-
randomnessValue: bigint;
|
|
49
|
-
winningSquare: number;
|
|
50
|
-
jackpotHit: boolean;
|
|
51
|
-
singleMinerRound: boolean;
|
|
52
|
-
singleMinerWinner: Address;
|
|
53
|
-
totalWager: bigint;
|
|
54
|
-
fee: bigint;
|
|
55
|
-
winnerTotal: bigint;
|
|
56
|
-
potForWinners: bigint;
|
|
57
|
-
slvrForWinners: bigint;
|
|
58
|
-
payoutMulWad: bigint;
|
|
59
|
-
slvrMulWad: bigint;
|
|
60
|
-
totalUnclaimedSlvr: bigint;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Miner state information
|
|
64
|
-
*/
|
|
65
|
-
export interface MinerState {
|
|
66
|
-
rewardsSlvr: bigint;
|
|
67
|
-
refinedAccrued: bigint;
|
|
68
|
-
indexSnapshot: bigint;
|
|
69
|
-
hasAccount: boolean;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Treasury state information
|
|
73
|
-
*/
|
|
74
|
-
export interface TreasuryState {
|
|
75
|
-
minerIndex: bigint;
|
|
76
|
-
totalUnclaimed: bigint;
|
|
77
|
-
totalRefined: bigint;
|
|
78
|
-
jackpotPool: bigint;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Staking information for a staked veNFT tokenId
|
|
82
|
-
*/
|
|
83
|
-
export interface StakingInfo {
|
|
84
|
-
/** Total tracked weight across all staked tokens */
|
|
85
|
-
totalWeight: bigint;
|
|
86
|
-
/** Tracked weight (balance) of this tokenId */
|
|
87
|
-
balance: bigint;
|
|
88
|
-
/** Claimable rewards for this tokenId */
|
|
89
|
-
rewards: bigint;
|
|
90
|
-
/** Accumulated reward per unit of weight (1e18 precision) */
|
|
91
|
-
rewardPerWeightStored: bigint;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* AutoCommit plan information
|
|
95
|
-
*/
|
|
96
|
-
export interface AutoCommitPlan {
|
|
97
|
-
enabled: boolean;
|
|
98
|
-
nextRoundId: bigint;
|
|
99
|
-
playsRemaining: number;
|
|
100
|
-
amountPerPlay: bigint;
|
|
101
|
-
balance: bigint;
|
|
102
|
-
autoClaim: boolean;
|
|
103
|
-
squares: number[];
|
|
104
|
-
bpsAlloc: number[];
|
|
105
|
-
planStartRoundId: bigint;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Game status in the registry (mirrors ISlvrGameRegistry.Status)
|
|
109
|
-
*/
|
|
110
|
-
export declare enum GameStatus {
|
|
111
|
-
Pending = 0,
|
|
112
|
-
Active = 1,
|
|
113
|
-
Paused = 2,
|
|
114
|
-
Retired = 3
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Game tier in the registry (mirrors ISlvrGameRegistry.Tier)
|
|
118
|
-
*/
|
|
119
|
-
export declare enum GameTier {
|
|
120
|
-
Core = 0,
|
|
121
|
-
Community = 1,
|
|
122
|
-
Experimental = 2
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Full registry record for a game (mirrors ISlvrGameRegistry.GameInfo)
|
|
126
|
-
*/
|
|
127
|
-
export interface GameInfo {
|
|
128
|
-
game: Address;
|
|
129
|
-
gameType: `0x${string}`;
|
|
130
|
-
status: GameStatus;
|
|
131
|
-
tier: GameTier;
|
|
132
|
-
emissionWeight: number;
|
|
133
|
-
maxWeightBps: number;
|
|
134
|
-
exists: boolean;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Bet parameters
|
|
138
|
-
*/
|
|
139
|
-
export interface BetParams {
|
|
140
|
-
roundId: bigint;
|
|
141
|
-
squares: number[];
|
|
142
|
-
amounts: bigint[];
|
|
143
|
-
beneficiary?: Address;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Claim parameters
|
|
147
|
-
*/
|
|
148
|
-
export interface ClaimParams {
|
|
149
|
-
roundId: bigint;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Advanced claim parameters (unified claim function)
|
|
153
|
-
*/
|
|
154
|
-
export interface ClaimParamsAdvanced {
|
|
155
|
-
user: Address;
|
|
156
|
-
roundId: bigint;
|
|
157
|
-
recipientNative?: Address;
|
|
158
|
-
recipientSlvr?: Address;
|
|
159
|
-
bypassFee?: boolean;
|
|
160
|
-
ethOnly?: boolean;
|
|
161
|
-
}
|
|
162
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","s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EG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
package/dist/types.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GameTier = exports.GameStatus = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Game status in the registry (mirrors ISlvrGameRegistry.Status)
|
|
6
|
-
*/
|
|
7
|
-
var GameStatus;
|
|
8
|
-
(function (GameStatus) {
|
|
9
|
-
GameStatus[GameStatus["Pending"] = 0] = "Pending";
|
|
10
|
-
GameStatus[GameStatus["Active"] = 1] = "Active";
|
|
11
|
-
GameStatus[GameStatus["Paused"] = 2] = "Paused";
|
|
12
|
-
GameStatus[GameStatus["Retired"] = 3] = "Retired";
|
|
13
|
-
})(GameStatus || (exports.GameStatus = GameStatus = {}));
|
|
14
|
-
/**
|
|
15
|
-
* Game tier in the registry (mirrors ISlvrGameRegistry.Tier)
|
|
16
|
-
*/
|
|
17
|
-
var GameTier;
|
|
18
|
-
(function (GameTier) {
|
|
19
|
-
GameTier[GameTier["Core"] = 0] = "Core";
|
|
20
|
-
GameTier[GameTier["Community"] = 1] = "Community";
|
|
21
|
-
GameTier[GameTier["Experimental"] = 2] = "Experimental";
|
|
22
|
-
})(GameTier || (exports.GameTier = GameTier = {}));
|
|
23
|
-
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAkHA;;GAEG;AACH,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,iDAAW,CAAA;IACX,+CAAU,CAAA;IACV,+CAAU,CAAA;IACV,iDAAW,CAAA;AACb,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAED;;GAEG;AACH,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,uCAAQ,CAAA;IACR,iDAAa,CAAA;IACb,uDAAgB,CAAA;AAClB,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB"}
|
package/dist/utils.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Address } from 'viem';
|
|
2
|
-
/**
|
|
3
|
-
* Validate and normalize an Ethereum address
|
|
4
|
-
* @param address Address to validate
|
|
5
|
-
* @param fieldName Field name for error message
|
|
6
|
-
* @returns Checksummed address
|
|
7
|
-
* @throws ValidationError if address is invalid
|
|
8
|
-
*/
|
|
9
|
-
export declare function validateAddress(address: string, fieldName?: string): Address;
|
|
10
|
-
/**
|
|
11
|
-
* Validate that an amount is positive
|
|
12
|
-
* @param amount Amount to validate
|
|
13
|
-
* @param fieldName Field name for error message
|
|
14
|
-
* @throws ValidationError if amount is invalid
|
|
15
|
-
*/
|
|
16
|
-
export declare function validateAmount(amount: bigint, fieldName?: string): void;
|
|
17
|
-
/**
|
|
18
|
-
* Validate square indices are within valid range
|
|
19
|
-
* @param squares Array of square indices
|
|
20
|
-
* @param gridSize Grid size (default 25)
|
|
21
|
-
* @throws ValidationError if squares are invalid
|
|
22
|
-
*/
|
|
23
|
-
export declare function validateSquares(squares: number[], gridSize?: number): void;
|
|
24
|
-
/**
|
|
25
|
-
* Validate that arrays have matching lengths
|
|
26
|
-
* @param arrays Arrays to validate
|
|
27
|
-
* @param fieldNames Field names for error message
|
|
28
|
-
* @throws ValidationError if arrays don't match
|
|
29
|
-
*/
|
|
30
|
-
export declare function validateArrayLengths(arrays: unknown[][], fieldNames: string[]): void;
|
|
31
|
-
/**
|
|
32
|
-
* Validate basis points (0-10000)
|
|
33
|
-
* @param bps Basis points value
|
|
34
|
-
* @param fieldName Field name for error message
|
|
35
|
-
* @throws ValidationError if bps is invalid
|
|
36
|
-
*/
|
|
37
|
-
export declare function validateBps(bps: number, fieldName?: string): void;
|
|
38
|
-
/**
|
|
39
|
-
* Validate that basis points array sums to 10000
|
|
40
|
-
* @param bpsArray Array of basis points
|
|
41
|
-
* @param fieldName Field name for error message
|
|
42
|
-
* @throws ValidationError if bps don't sum to 10000
|
|
43
|
-
*/
|
|
44
|
-
export declare function validateBpsSum(bpsArray: number[], fieldName?: string): void;
|
|
45
|
-
/**
|
|
46
|
-
* Wait for transaction receipt with timeout
|
|
47
|
-
* @param publicClient Public client
|
|
48
|
-
* @param hash Transaction hash
|
|
49
|
-
* @param timeout Timeout in milliseconds (default 120000 = 2 minutes)
|
|
50
|
-
* @returns Transaction receipt
|
|
51
|
-
*/
|
|
52
|
-
export declare function waitForTransactionReceipt(publicClient: {
|
|
53
|
-
waitForTransactionReceipt?: (args: {
|
|
54
|
-
hash: `0x${string}`;
|
|
55
|
-
timeout?: number;
|
|
56
|
-
}) => Promise<unknown>;
|
|
57
|
-
}, hash: `0x${string}`, timeout?: number): Promise<unknown>;
|
|
58
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAyB,MAAM,MAAM,CAAC;AAGtD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,MAAkB,GAAG,OAAO,CAKvF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,MAAiB,GAAG,IAAI,CAOjF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAE,MAAW,GAAG,IAAI,CAa9E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAgBpF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,GAAE,MAAc,GAAG,IAAI,CAOxE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,GAAE,MAAmB,GAAG,IAAI,CAQvF;AAED;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAC7C,YAAY,EAAE;IAAE,yBAAyB,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,EACnH,IAAI,EAAE,KAAK,MAAM,EAAE,EACnB,OAAO,GAAE,MAAe,GACvB,OAAO,CAAC,OAAO,CAAC,CAKlB"}
|