@oakagentkit/addon 0.0.0-stage → 0.1.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/LICENSE +18 -0
- package/README.md +12 -2
- package/build/dist/bridge.d.ts +61 -0
- package/build/dist/bridge.js +1 -0
- package/build/dist/chunks/4B2GMIK7.js +1 -0
- package/build/dist/chunks/4LWKW7PM.js +2 -0
- package/build/dist/chunks/4X7FLHGQ.js +1 -0
- package/build/dist/chunks/5HTX664S.js +1 -0
- package/build/dist/chunks/62PM22KQ.js +7 -0
- package/build/dist/chunks/GONTF7K4.js +1 -0
- package/build/dist/chunks/HGFLLHB6.js +1 -0
- package/build/dist/chunks/HLAZAI2Q.js +4 -0
- package/build/dist/chunks/ILJVXWGD.js +1 -0
- package/build/dist/chunks/QIDB35RS.js +1 -0
- package/build/dist/chunks/U4YOG57X.js +1 -0
- package/build/dist/chunks/VZCMAMZL.js +2 -0
- package/build/dist/chunks/YVAFJM4Y.js +1 -0
- package/build/dist/cli.d.ts +63 -0
- package/build/dist/cli.js +6 -0
- package/build/dist/identity.d.ts +48 -0
- package/build/dist/identity.js +1 -0
- package/build/dist/journal.d.ts +53 -0
- package/build/dist/journal.js +1 -0
- package/build/dist/onboarding.d.ts +38 -0
- package/build/dist/onboarding.js +1 -0
- package/build/dist/private-files.d.ts +5 -0
- package/build/dist/private-files.js +1 -0
- package/build/dist/recipes.d.ts +26 -0
- package/build/dist/recipes.js +1 -0
- package/build/dist/redact.d.ts +4 -0
- package/build/dist/redact.js +1 -0
- package/build/dist/renew.d.ts +2 -0
- package/build/dist/renew.js +1 -0
- package/build/dist/schema/recipe.schema.json +1 -0
- package/build/dist/sender.d.ts +116 -0
- package/build/dist/sender.js +1 -0
- package/build/dist/session.d.ts +45 -0
- package/build/dist/session.js +1 -0
- package/build/dist/setup.d.ts +24 -0
- package/build/dist/setup.js +1 -0
- package/build/dist/subscribe.d.ts +347 -0
- package/build/dist/subscribe.js +1 -0
- package/build/dist/version.d.ts +1 -0
- package/build/dist/version.js +1 -0
- package/build/dist/wallet.d.ts +11 -0
- package/build/dist/wallet.js +12 -0
- package/package.json +54 -4
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
|
+
import { type OakNetwork } from '@oakagentkit/core/addresses';
|
|
3
|
+
export declare function walletSummary(address: Address, network: OakNetwork): string;
|
|
4
|
+
export declare function startupInstructions(address: Address, network: OakNetwork, directory?: string): Promise<string>;
|
|
5
|
+
export declare function walletStatus(address: Address, network: OakNetwork): {
|
|
6
|
+
wallet: `0x${string}`;
|
|
7
|
+
address: `0x${string}`;
|
|
8
|
+
network: "testnet" | "mainnet";
|
|
9
|
+
chainId: 4663 | 46630;
|
|
10
|
+
funding: {
|
|
11
|
+
gas: {
|
|
12
|
+
address: string;
|
|
13
|
+
symbol: string;
|
|
14
|
+
decimals: number;
|
|
15
|
+
chainId: 4663 | 46630;
|
|
16
|
+
};
|
|
17
|
+
payment: {
|
|
18
|
+
address: `0x${string}`;
|
|
19
|
+
symbol: string;
|
|
20
|
+
decimals: number;
|
|
21
|
+
chainId: 4663 | 46630;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
message: string;
|
|
25
|
+
backup: string;
|
|
26
|
+
notice: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const backupGuidance = "Backups are optional. When you hold more than pocket change, run oak export in your own terminal, never through an agent. Keep the exported private key offline and private. Restore it with oak init --recover in your own terminal. Automatic wallets have no recovery phrase. Oak cannot recover a lost key.";
|
|
29
|
+
export declare const defaultProfile: {
|
|
30
|
+
type: string;
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
image: string;
|
|
34
|
+
services: never[];
|
|
35
|
+
x402Support: boolean;
|
|
36
|
+
active: boolean;
|
|
37
|
+
registrations: never[];
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e}from"./chunks/VZCMAMZL.js";import"./chunks/GONTF7K4.js";export{d as backupGuidance,e as defaultProfile,b as startupInstructions,c as walletStatus,a as walletSummary};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type FileHandle } from 'node:fs/promises';
|
|
2
|
+
export declare function privateDirectory(path: string, create?: boolean): Promise<void>;
|
|
3
|
+
export declare function privateFile(handle: FileHandle, maximum: number): Promise<void>;
|
|
4
|
+
export declare function syncPrivateDirectory(path: string): Promise<void>;
|
|
5
|
+
export declare function openPrivateFile(path: string, flags: number, maximum: number, createDirectory?: boolean): Promise<FileHandle>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d}from"./chunks/GONTF7K4.js";export{d as openPrivateFile,a as privateDirectory,b as privateFile,c as syncPrivateDirectory};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Address, type Hex } from 'viem';
|
|
2
|
+
import type { JsonValue, Recipe, UnsignedTx } from '@oakagentkit/core/types';
|
|
3
|
+
export declare function loadRecipe(json: unknown): Recipe;
|
|
4
|
+
export type DecodedResult = JsonValue;
|
|
5
|
+
export interface RecipeReadClient {
|
|
6
|
+
getChainId(): Promise<number>;
|
|
7
|
+
call(args: {
|
|
8
|
+
to: Address;
|
|
9
|
+
data: Hex;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
data?: Hex;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export declare function buildRead(recipe: Recipe, args: Record<string, unknown>, options?: {
|
|
15
|
+
client?: RecipeReadClient;
|
|
16
|
+
}): Promise<DecodedResult>;
|
|
17
|
+
export declare function buildTx(recipe: Recipe, args: Record<string, unknown>, wallet: Address): UnsignedTx[];
|
|
18
|
+
export interface RecipeStoreOptions {
|
|
19
|
+
directory?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface RecipeImportOptions extends RecipeStoreOptions {
|
|
22
|
+
fetch?: typeof fetch;
|
|
23
|
+
}
|
|
24
|
+
export declare function addRecipes(source: string, options?: RecipeImportOptions): Promise<Recipe[]>;
|
|
25
|
+
export declare function listRecipes(options?: RecipeStoreOptions): Promise<Recipe[]>;
|
|
26
|
+
export declare function removeRecipes(project: string, options?: RecipeStoreOptions): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f}from"./chunks/4LWKW7PM.js";import"./chunks/GONTF7K4.js";import"./chunks/YVAFJM4Y.js";export{d as addRecipes,b as buildRead,c as buildTx,e as listRecipes,a as loadRecipe,f as removeRecipes};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d}from"./chunks/YVAFJM4Y.js";export{d as configReadError,b as errorMessage,c as publicError,a as redact};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunks/U4YOG57X.js";import"./chunks/HGFLLHB6.js";import"./chunks/HLAZAI2Q.js";import"./chunks/QIDB35RS.js";import"./chunks/YVAFJM4Y.js";export{a as ensureSubscribed};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"http://json-schema.org/draft-07/schema#","$id":"https://oakagentkit.org/schema/recipe.schema.json","title":"Oak declarative recipe v1","type":"object","additionalProperties":false,"required":["schema","project","name","description","chainId","contract","function","inputs","kind"],"properties":{"schema":{"const":"oak-recipe/v1"},"project":{"$ref":"#/definitions/slug"},"name":{"$ref":"#/definitions/slug"},"description":{"type":"string"},"chainId":{"const":4663},"contract":{"type":"string","format":"eip55"},"function":{"type":"object","additionalProperties":false,"required":["type","name","stateMutability","inputs","outputs"],"properties":{"type":{"const":"function"},"name":{"type":"string","pattern":"^[A-Za-z_][A-Za-z0-9_]*$"},"stateMutability":{"enum":["view","pure","nonpayable","payable"]},"inputs":{"type":"array","maxItems":128,"items":{"$ref":"#/definitions/parameter"}},"outputs":{"type":"array","maxItems":128,"items":{"$ref":"#/definitions/parameter"}}}},"inputs":{"type":"array","maxItems":128,"items":{"type":"object","additionalProperties":false,"required":["name","type","description"],"properties":{"name":{"type":"string","pattern":"^[A-Za-z_][A-Za-z0-9_]*$"},"type":{"type":"string","pattern":"^(address|bool|string|bytes([1-9]|[12][0-9]|3[0-2])?|u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?|tuple)(\\[([1-9][0-9]*)?\\])*$"},"description":{"type":"string"},"default":{}}}},"kind":{"enum":["read","tx"]},"value":{"type":"object","additionalProperties":false,"required":["fromInput"],"properties":{"fromInput":{"type":"string","pattern":"^[A-Za-z_][A-Za-z0-9_]*$"}}},"approve":{"type":"object","additionalProperties":false,"required":["token","amountFromInput"],"properties":{"token":{"type":"string","format":"eip55"},"amountFromInput":{"type":"string","pattern":"^[A-Za-z_][A-Za-z0-9_]*$"}}}},"definitions":{"slug":{"type":"string","pattern":"^[a-z0-9-]{1,40}$"},"parameter":{"type":"object","additionalProperties":false,"required":["type"],"properties":{"name":{"type":"string","pattern":"^([A-Za-z_][A-Za-z0-9_]*)?$"},"type":{"type":"string","pattern":"^(address|bool|string|bytes([1-9]|[12][0-9]|3[0-2])?|u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?|tuple)(\\[([1-9][0-9]*)?\\])*$"},"internalType":{"type":"string"},"components":{"type":"array","minItems":1,"maxItems":128,"items":{"$ref":"#/definitions/parameter"}}}}}}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { erc20Abi, type Address, type Hex } from 'viem';
|
|
2
|
+
import type { SenderResult, TypedDataRequest, UnsignedTx } from '@oakagentkit/core/types';
|
|
3
|
+
import { type WalletSigner } from './wallet.js';
|
|
4
|
+
type Receipt = {
|
|
5
|
+
blockHash?: Hex;
|
|
6
|
+
transactionHash: Hex;
|
|
7
|
+
blockNumber: bigint;
|
|
8
|
+
status: 'success' | 'reverted';
|
|
9
|
+
};
|
|
10
|
+
type Call = {
|
|
11
|
+
account: Address;
|
|
12
|
+
to: Address;
|
|
13
|
+
data: Hex;
|
|
14
|
+
value: bigint;
|
|
15
|
+
};
|
|
16
|
+
type SimulatedCall = {
|
|
17
|
+
status: 'success' | 'failure';
|
|
18
|
+
gasUsed: bigint;
|
|
19
|
+
maxUsedGas?: bigint;
|
|
20
|
+
};
|
|
21
|
+
export interface ChainClient {
|
|
22
|
+
getChainId(): Promise<number>;
|
|
23
|
+
getBalance(args: {
|
|
24
|
+
address: Address;
|
|
25
|
+
blockTag: 'pending';
|
|
26
|
+
}): Promise<bigint>;
|
|
27
|
+
estimateMaxPriorityFeePerGas(): Promise<bigint>;
|
|
28
|
+
estimateGas(args: Call): Promise<bigint>;
|
|
29
|
+
simulateBlocks(args: {
|
|
30
|
+
blocks: [{
|
|
31
|
+
calls: Call[];
|
|
32
|
+
}];
|
|
33
|
+
validation: false;
|
|
34
|
+
traceTransfers: true;
|
|
35
|
+
}): Promise<readonly {
|
|
36
|
+
calls: readonly SimulatedCall[];
|
|
37
|
+
}[]>;
|
|
38
|
+
readContract(args: {
|
|
39
|
+
address: Address;
|
|
40
|
+
abi: typeof erc20Abi;
|
|
41
|
+
functionName: 'allowance';
|
|
42
|
+
args: readonly [Address, Address];
|
|
43
|
+
}): Promise<unknown>;
|
|
44
|
+
getTransactionCount(args: {
|
|
45
|
+
address: Address;
|
|
46
|
+
} & ({
|
|
47
|
+
blockTag: 'pending' | 'latest' | 'safe' | 'finalized';
|
|
48
|
+
blockNumber?: never;
|
|
49
|
+
} | {
|
|
50
|
+
blockNumber: bigint;
|
|
51
|
+
blockTag?: never;
|
|
52
|
+
})): Promise<number>;
|
|
53
|
+
getBlock(args: {
|
|
54
|
+
blockTag: 'latest' | 'safe' | 'finalized';
|
|
55
|
+
blockNumber?: never;
|
|
56
|
+
} | {
|
|
57
|
+
blockNumber: bigint;
|
|
58
|
+
blockTag?: never;
|
|
59
|
+
}): Promise<{
|
|
60
|
+
hash?: Hex | null;
|
|
61
|
+
number: bigint | null;
|
|
62
|
+
timestamp: bigint;
|
|
63
|
+
baseFeePerGas?: bigint | null;
|
|
64
|
+
}>;
|
|
65
|
+
getTransactionReceipt(args: {
|
|
66
|
+
hash: Hex;
|
|
67
|
+
}): Promise<Receipt>;
|
|
68
|
+
getTransaction(args: {
|
|
69
|
+
hash: Hex;
|
|
70
|
+
}): Promise<{
|
|
71
|
+
hash: Hex;
|
|
72
|
+
}>;
|
|
73
|
+
sendRawTransaction(args: {
|
|
74
|
+
serializedTransaction: Hex;
|
|
75
|
+
}): Promise<Hex>;
|
|
76
|
+
waitForTransactionReceipt(args: {
|
|
77
|
+
hash: Hex;
|
|
78
|
+
confirmations: number;
|
|
79
|
+
timeout: number;
|
|
80
|
+
}): Promise<Receipt>;
|
|
81
|
+
}
|
|
82
|
+
export type Finality = number | 'safe' | 'finalized';
|
|
83
|
+
export declare const NOT_AFTER_SECONDS = 12;
|
|
84
|
+
export type PreparedTx = UnsignedTx & {
|
|
85
|
+
notAfter?: number;
|
|
86
|
+
};
|
|
87
|
+
export interface SenderOptions {
|
|
88
|
+
signer?: WalletSigner;
|
|
89
|
+
clientFor?: (chainId: number) => ChainClient;
|
|
90
|
+
allowedChainIds?: readonly number[];
|
|
91
|
+
directory?: string;
|
|
92
|
+
finality?: Finality;
|
|
93
|
+
receiptTimeoutMs?: number;
|
|
94
|
+
now?: () => number;
|
|
95
|
+
notAfterSeconds?: number;
|
|
96
|
+
preview?: (text: string) => void | Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
export interface LockedSender {
|
|
99
|
+
approvalStatus?(): Promise<string>;
|
|
100
|
+
send(txs: PreparedTx[]): Promise<SenderResult>;
|
|
101
|
+
signTypedData(request: TypedDataRequest): Promise<Hex>;
|
|
102
|
+
assertCanPayGas(txs: PreparedTx[]): Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
export declare class SenderError extends Error {
|
|
105
|
+
}
|
|
106
|
+
export declare function createSender(options?: SenderOptions): {
|
|
107
|
+
withAction: <T>(action: (locked: LockedSender) => Promise<T>) => Promise<T>;
|
|
108
|
+
send: (txs: UnsignedTx[]) => Promise<SenderResult>;
|
|
109
|
+
signTypedData: (request: TypedDataRequest) => Promise<`0x${string}`>;
|
|
110
|
+
assertCanPayGas: (txs: UnsignedTx[]) => Promise<void>;
|
|
111
|
+
blockNumber: (chainId?: number) => Promise<bigint>;
|
|
112
|
+
};
|
|
113
|
+
export declare const send: (txs: UnsignedTx[], options?: SenderOptions) => Promise<SenderResult>;
|
|
114
|
+
export declare const signTypedData: (request: TypedDataRequest, options?: SenderOptions) => Promise<`0x${string}`>;
|
|
115
|
+
export declare const assertCanPayGas: (txs: UnsignedTx[], options?: SenderOptions) => Promise<void>;
|
|
116
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f}from"./chunks/HLAZAI2Q.js";import"./chunks/QIDB35RS.js";import"./chunks/YVAFJM4Y.js";export{a as NOT_AFTER_SECONDS,b as SenderError,f as assertCanPayGas,c as createSender,d as send,e as signTypedData};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type SessionIdentity } from '@oakagentkit/core/identity-link';
|
|
2
|
+
import type { OakNetwork } from '@oakagentkit/core/addresses';
|
|
3
|
+
import type { Hex, SessionPayload } from '@oakagentkit/core/types';
|
|
4
|
+
import { type WalletSigner } from './wallet.js';
|
|
5
|
+
export interface IdentitySession extends SessionPayload {
|
|
6
|
+
identity?: SessionIdentity;
|
|
7
|
+
nonce?: Hex;
|
|
8
|
+
sessionKey?: `0x${string}`;
|
|
9
|
+
}
|
|
10
|
+
export declare function createSession(options?: {
|
|
11
|
+
signer?: WalletSigner;
|
|
12
|
+
identity?: SessionIdentity;
|
|
13
|
+
sessionKey?: `0x${string}`;
|
|
14
|
+
network?: OakNetwork;
|
|
15
|
+
now?: () => number;
|
|
16
|
+
lifetime?: number;
|
|
17
|
+
}): Promise<string>;
|
|
18
|
+
export declare function verifySession(header: string, now?: number, network?: OakNetwork): Promise<IdentitySession>;
|
|
19
|
+
export declare function createSessionManager(options: {
|
|
20
|
+
signer: WalletSigner;
|
|
21
|
+
network?: OakNetwork;
|
|
22
|
+
identity?: SessionIdentity;
|
|
23
|
+
now?: () => number;
|
|
24
|
+
refreshIdentity?: (identity: SessionIdentity) => Promise<SessionIdentity | undefined>;
|
|
25
|
+
}): {
|
|
26
|
+
readonly identity: {
|
|
27
|
+
chainId: number;
|
|
28
|
+
registry: import("viem").Address;
|
|
29
|
+
agentId: import("@oakagentkit/core/types").DecimalString;
|
|
30
|
+
linkId?: Hex;
|
|
31
|
+
} | undefined;
|
|
32
|
+
setIdentity(value?: SessionIdentity): void;
|
|
33
|
+
clear: () => void;
|
|
34
|
+
get(): Promise<string>;
|
|
35
|
+
headers(method: string, path: string, body: string): Promise<Record<string, string>>;
|
|
36
|
+
};
|
|
37
|
+
export declare function signRequest(options: {
|
|
38
|
+
token: string;
|
|
39
|
+
signer: Pick<WalletSigner, 'signMessage'>;
|
|
40
|
+
method: string;
|
|
41
|
+
path: string;
|
|
42
|
+
body: string;
|
|
43
|
+
expires: number;
|
|
44
|
+
nonce?: Hex;
|
|
45
|
+
}): Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d}from"./chunks/4B2GMIK7.js";export{a as createSession,c as createSessionManager,d as signRequest,b as verifySession};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type SessionIdentity } from '@oakagentkit/core/identity-link';
|
|
2
|
+
import type { OakNetwork } from '@oakagentkit/core/addresses';
|
|
3
|
+
import type { ToolArgs } from '@oakagentkit/core/types';
|
|
4
|
+
import { type IdentityClient, type OwnerSign } from './identity.js';
|
|
5
|
+
import type { WalletSigner } from './wallet.js';
|
|
6
|
+
export type SetupRequest = {
|
|
7
|
+
mode: 'register';
|
|
8
|
+
profile?: ToolArgs;
|
|
9
|
+
tag?: boolean;
|
|
10
|
+
} | {
|
|
11
|
+
mode: 'link';
|
|
12
|
+
agentId: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function createSetup(options: {
|
|
15
|
+
network: OakNetwork;
|
|
16
|
+
signer: WalletSigner;
|
|
17
|
+
identity: IdentityClient;
|
|
18
|
+
callTool(name: string, args: ToolArgs): Promise<unknown>;
|
|
19
|
+
save(identity: SessionIdentity): Promise<void>;
|
|
20
|
+
signOwner?: OwnerSign;
|
|
21
|
+
}): (request: SetupRequest) => Promise<{
|
|
22
|
+
identity: SessionIdentity;
|
|
23
|
+
summary: string;
|
|
24
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunks/ILJVXWGD.js";import"./chunks/5HTX664S.js";import"./chunks/4B2GMIK7.js";import"./chunks/VZCMAMZL.js";import"./chunks/GONTF7K4.js";export{a as createSetup};
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { type Address, type PublicClient } from 'viem';
|
|
2
|
+
import { type OakNetwork } from '@oakagentkit/core/addresses';
|
|
3
|
+
import type { GrandfatherTree, GrandfatherProofResult } from '@oakagentkit/core/merkle';
|
|
4
|
+
import type { ActionResult, NoteRefusal, NoteTarget, SignedPriceNote, ToolResponse, TypedDataRequest } from '@oakagentkit/core/types';
|
|
5
|
+
import { type createSender, type LockedSender } from './sender.js';
|
|
6
|
+
export declare const subscriptionAbi: readonly [{
|
|
7
|
+
readonly name: "subscribe";
|
|
8
|
+
readonly type: "function";
|
|
9
|
+
readonly stateMutability: "nonpayable";
|
|
10
|
+
readonly inputs: readonly [{
|
|
11
|
+
readonly type: "uint8";
|
|
12
|
+
readonly name: "plan";
|
|
13
|
+
}, {
|
|
14
|
+
readonly type: "uint256";
|
|
15
|
+
readonly name: "maxCount";
|
|
16
|
+
}, {
|
|
17
|
+
readonly type: "uint256";
|
|
18
|
+
readonly name: "maxPrice";
|
|
19
|
+
}, {
|
|
20
|
+
readonly type: "tuple";
|
|
21
|
+
readonly components: readonly [{
|
|
22
|
+
readonly type: "address";
|
|
23
|
+
readonly name: "wallet";
|
|
24
|
+
}, {
|
|
25
|
+
readonly type: "uint256";
|
|
26
|
+
readonly name: "oakPerEthE18";
|
|
27
|
+
}, {
|
|
28
|
+
readonly type: "uint64";
|
|
29
|
+
readonly name: "timestamp";
|
|
30
|
+
}, {
|
|
31
|
+
readonly type: "bytes32";
|
|
32
|
+
readonly name: "nonce";
|
|
33
|
+
}];
|
|
34
|
+
readonly name: "n";
|
|
35
|
+
}, {
|
|
36
|
+
readonly type: "bytes";
|
|
37
|
+
readonly name: "sig";
|
|
38
|
+
}];
|
|
39
|
+
readonly outputs: readonly [];
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "subscribeWithAuthorization";
|
|
42
|
+
readonly type: "function";
|
|
43
|
+
readonly stateMutability: "nonpayable";
|
|
44
|
+
readonly inputs: readonly [{
|
|
45
|
+
readonly type: "uint256";
|
|
46
|
+
readonly name: "maxCount";
|
|
47
|
+
}, {
|
|
48
|
+
readonly type: "tuple";
|
|
49
|
+
readonly components: readonly [{
|
|
50
|
+
readonly type: "address";
|
|
51
|
+
readonly name: "wallet";
|
|
52
|
+
}, {
|
|
53
|
+
readonly type: "uint256";
|
|
54
|
+
readonly name: "oakPerEthE18";
|
|
55
|
+
}, {
|
|
56
|
+
readonly type: "uint64";
|
|
57
|
+
readonly name: "timestamp";
|
|
58
|
+
}, {
|
|
59
|
+
readonly type: "bytes32";
|
|
60
|
+
readonly name: "nonce";
|
|
61
|
+
}];
|
|
62
|
+
readonly name: "n";
|
|
63
|
+
}, {
|
|
64
|
+
readonly type: "bytes";
|
|
65
|
+
readonly name: "sig";
|
|
66
|
+
}, {
|
|
67
|
+
readonly type: "bytes";
|
|
68
|
+
readonly name: "usdgAuth";
|
|
69
|
+
}];
|
|
70
|
+
readonly outputs: readonly [];
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "subscribeGrandfatheredWithAuthorization";
|
|
73
|
+
readonly type: "function";
|
|
74
|
+
readonly stateMutability: "nonpayable";
|
|
75
|
+
readonly inputs: readonly [{
|
|
76
|
+
readonly type: "uint256";
|
|
77
|
+
readonly name: "count";
|
|
78
|
+
}, {
|
|
79
|
+
readonly type: "bytes32[]";
|
|
80
|
+
readonly name: "proof";
|
|
81
|
+
}, {
|
|
82
|
+
readonly type: "bytes";
|
|
83
|
+
readonly name: "usdgAuth";
|
|
84
|
+
}];
|
|
85
|
+
readonly outputs: readonly [];
|
|
86
|
+
}, {
|
|
87
|
+
readonly name: "renewWithAuthorization";
|
|
88
|
+
readonly type: "function";
|
|
89
|
+
readonly stateMutability: "nonpayable";
|
|
90
|
+
readonly inputs: readonly [{
|
|
91
|
+
readonly type: "bytes";
|
|
92
|
+
readonly name: "usdgAuth";
|
|
93
|
+
}];
|
|
94
|
+
readonly outputs: readonly [];
|
|
95
|
+
}, {
|
|
96
|
+
readonly name: "renewNoHold";
|
|
97
|
+
readonly type: "function";
|
|
98
|
+
readonly stateMutability: "nonpayable";
|
|
99
|
+
readonly inputs: readonly [{
|
|
100
|
+
readonly type: "uint256";
|
|
101
|
+
readonly name: "maxPrice";
|
|
102
|
+
}, {
|
|
103
|
+
readonly type: "tuple";
|
|
104
|
+
readonly components: readonly [{
|
|
105
|
+
readonly type: "address";
|
|
106
|
+
readonly name: "wallet";
|
|
107
|
+
}, {
|
|
108
|
+
readonly type: "uint256";
|
|
109
|
+
readonly name: "oakPerEthE18";
|
|
110
|
+
}, {
|
|
111
|
+
readonly type: "uint64";
|
|
112
|
+
readonly name: "timestamp";
|
|
113
|
+
}, {
|
|
114
|
+
readonly type: "bytes32";
|
|
115
|
+
readonly name: "nonce";
|
|
116
|
+
}];
|
|
117
|
+
readonly name: "n";
|
|
118
|
+
}, {
|
|
119
|
+
readonly type: "bytes";
|
|
120
|
+
readonly name: "sig";
|
|
121
|
+
}];
|
|
122
|
+
readonly outputs: readonly [];
|
|
123
|
+
}, {
|
|
124
|
+
readonly name: "cancel";
|
|
125
|
+
readonly type: "function";
|
|
126
|
+
readonly stateMutability: "nonpayable";
|
|
127
|
+
readonly inputs: readonly [];
|
|
128
|
+
readonly outputs: readonly [];
|
|
129
|
+
}, {
|
|
130
|
+
readonly name: "hasRecord";
|
|
131
|
+
readonly type: "function";
|
|
132
|
+
readonly stateMutability: "view";
|
|
133
|
+
readonly inputs: readonly [{
|
|
134
|
+
readonly type: "address";
|
|
135
|
+
}];
|
|
136
|
+
readonly outputs: readonly [{
|
|
137
|
+
readonly type: "bool";
|
|
138
|
+
}];
|
|
139
|
+
}, {
|
|
140
|
+
readonly name: "previous";
|
|
141
|
+
readonly type: "function";
|
|
142
|
+
readonly stateMutability: "view";
|
|
143
|
+
readonly inputs: readonly [];
|
|
144
|
+
readonly outputs: readonly [{
|
|
145
|
+
readonly type: "address";
|
|
146
|
+
}];
|
|
147
|
+
}, {
|
|
148
|
+
readonly name: "retired";
|
|
149
|
+
readonly type: "function";
|
|
150
|
+
readonly stateMutability: "view";
|
|
151
|
+
readonly inputs: readonly [];
|
|
152
|
+
readonly outputs: readonly [{
|
|
153
|
+
readonly type: "bool";
|
|
154
|
+
}];
|
|
155
|
+
}, {
|
|
156
|
+
readonly name: "plan";
|
|
157
|
+
readonly type: "function";
|
|
158
|
+
readonly stateMutability: "view";
|
|
159
|
+
readonly inputs: readonly [{
|
|
160
|
+
readonly type: "address";
|
|
161
|
+
}];
|
|
162
|
+
readonly outputs: readonly [{
|
|
163
|
+
readonly type: "uint8";
|
|
164
|
+
}];
|
|
165
|
+
}, {
|
|
166
|
+
readonly name: "paidUntil";
|
|
167
|
+
readonly type: "function";
|
|
168
|
+
readonly stateMutability: "view";
|
|
169
|
+
readonly inputs: readonly [{
|
|
170
|
+
readonly type: "address";
|
|
171
|
+
}];
|
|
172
|
+
readonly outputs: readonly [{
|
|
173
|
+
readonly type: "uint64";
|
|
174
|
+
}];
|
|
175
|
+
}, {
|
|
176
|
+
readonly name: "signupOakCount";
|
|
177
|
+
readonly type: "function";
|
|
178
|
+
readonly stateMutability: "view";
|
|
179
|
+
readonly inputs: readonly [{
|
|
180
|
+
readonly type: "address";
|
|
181
|
+
}];
|
|
182
|
+
readonly outputs: readonly [{
|
|
183
|
+
readonly type: "uint256";
|
|
184
|
+
}];
|
|
185
|
+
}, {
|
|
186
|
+
readonly name: "grandfatherRoot";
|
|
187
|
+
readonly type: "function";
|
|
188
|
+
readonly stateMutability: "view";
|
|
189
|
+
readonly inputs: readonly [];
|
|
190
|
+
readonly outputs: readonly [{
|
|
191
|
+
readonly type: "bytes32";
|
|
192
|
+
}];
|
|
193
|
+
}, {
|
|
194
|
+
readonly name: "grandfatherDeadline";
|
|
195
|
+
readonly type: "function";
|
|
196
|
+
readonly stateMutability: "view";
|
|
197
|
+
readonly inputs: readonly [];
|
|
198
|
+
readonly outputs: readonly [{
|
|
199
|
+
readonly type: "uint64";
|
|
200
|
+
}];
|
|
201
|
+
}, {
|
|
202
|
+
readonly name: "quoteHolder";
|
|
203
|
+
readonly type: "function";
|
|
204
|
+
readonly stateMutability: "view";
|
|
205
|
+
readonly inputs: readonly [{
|
|
206
|
+
readonly type: "tuple";
|
|
207
|
+
readonly components: readonly [{
|
|
208
|
+
readonly type: "address";
|
|
209
|
+
readonly name: "wallet";
|
|
210
|
+
}, {
|
|
211
|
+
readonly type: "uint256";
|
|
212
|
+
readonly name: "oakPerEthE18";
|
|
213
|
+
}, {
|
|
214
|
+
readonly type: "uint64";
|
|
215
|
+
readonly name: "timestamp";
|
|
216
|
+
}, {
|
|
217
|
+
readonly type: "bytes32";
|
|
218
|
+
readonly name: "nonce";
|
|
219
|
+
}];
|
|
220
|
+
readonly name: "n";
|
|
221
|
+
}, {
|
|
222
|
+
readonly type: "bytes";
|
|
223
|
+
readonly name: "sig";
|
|
224
|
+
}];
|
|
225
|
+
readonly outputs: readonly [{
|
|
226
|
+
readonly type: "uint256";
|
|
227
|
+
readonly name: "count";
|
|
228
|
+
}, {
|
|
229
|
+
readonly type: "uint256";
|
|
230
|
+
readonly name: "burn";
|
|
231
|
+
}];
|
|
232
|
+
}, {
|
|
233
|
+
readonly name: "quoteNoHold";
|
|
234
|
+
readonly type: "function";
|
|
235
|
+
readonly stateMutability: "view";
|
|
236
|
+
readonly inputs: readonly [{
|
|
237
|
+
readonly type: "tuple";
|
|
238
|
+
readonly components: readonly [{
|
|
239
|
+
readonly type: "address";
|
|
240
|
+
readonly name: "wallet";
|
|
241
|
+
}, {
|
|
242
|
+
readonly type: "uint256";
|
|
243
|
+
readonly name: "oakPerEthE18";
|
|
244
|
+
}, {
|
|
245
|
+
readonly type: "uint64";
|
|
246
|
+
readonly name: "timestamp";
|
|
247
|
+
}, {
|
|
248
|
+
readonly type: "bytes32";
|
|
249
|
+
readonly name: "nonce";
|
|
250
|
+
}];
|
|
251
|
+
readonly name: "n";
|
|
252
|
+
}, {
|
|
253
|
+
readonly type: "bytes";
|
|
254
|
+
readonly name: "sig";
|
|
255
|
+
}];
|
|
256
|
+
readonly outputs: readonly [{
|
|
257
|
+
readonly type: "uint256";
|
|
258
|
+
readonly name: "price";
|
|
259
|
+
}];
|
|
260
|
+
}, {
|
|
261
|
+
readonly name: "NoteOutsideGuard";
|
|
262
|
+
readonly type: "error";
|
|
263
|
+
readonly inputs: readonly [{
|
|
264
|
+
readonly type: "uint256";
|
|
265
|
+
readonly name: "spot";
|
|
266
|
+
}, {
|
|
267
|
+
readonly type: "uint256";
|
|
268
|
+
readonly name: "note";
|
|
269
|
+
}];
|
|
270
|
+
}, {
|
|
271
|
+
readonly name: "OracleUnreadable";
|
|
272
|
+
readonly type: "error";
|
|
273
|
+
readonly inputs: readonly [{
|
|
274
|
+
readonly type: "address";
|
|
275
|
+
readonly name: "source";
|
|
276
|
+
}];
|
|
277
|
+
}, {
|
|
278
|
+
readonly name: "NoteExpired";
|
|
279
|
+
readonly type: "error";
|
|
280
|
+
readonly inputs: readonly [];
|
|
281
|
+
}, {
|
|
282
|
+
readonly name: "NoteUsed";
|
|
283
|
+
readonly type: "error";
|
|
284
|
+
readonly inputs: readonly [];
|
|
285
|
+
}, {
|
|
286
|
+
readonly name: "NoteBadSignature";
|
|
287
|
+
readonly type: "error";
|
|
288
|
+
readonly inputs: readonly [];
|
|
289
|
+
}];
|
|
290
|
+
export declare const HOLDER_PRICE = 9000000n;
|
|
291
|
+
export declare const RENEW_WINDOW: bigint;
|
|
292
|
+
export interface Deployment {
|
|
293
|
+
network: OakNetwork;
|
|
294
|
+
chainId: 4663 | 46630;
|
|
295
|
+
subscription: Address;
|
|
296
|
+
usdg: Address;
|
|
297
|
+
oak: Address;
|
|
298
|
+
oracle: Address;
|
|
299
|
+
ethUsdgPool: Address;
|
|
300
|
+
}
|
|
301
|
+
export interface LifecycleOptions {
|
|
302
|
+
wallet: Address;
|
|
303
|
+
deployment: Deployment;
|
|
304
|
+
client: PublicClient;
|
|
305
|
+
sender: Pick<ReturnType<typeof createSender>, 'withAction'>;
|
|
306
|
+
issueNote(target: NoteTarget): Promise<SignedPriceNote | NoteRefusal>;
|
|
307
|
+
grandfatherList?: () => Promise<GrandfatherTree | null>;
|
|
308
|
+
callTool?: (name: string, args: Record<string, unknown>) => Promise<ToolResponse<ActionResult>>;
|
|
309
|
+
}
|
|
310
|
+
export interface LifecycleResult {
|
|
311
|
+
ok: boolean;
|
|
312
|
+
access: boolean;
|
|
313
|
+
summary: string;
|
|
314
|
+
hashes: string[];
|
|
315
|
+
}
|
|
316
|
+
export interface SubscriptionRecord {
|
|
317
|
+
contract: Address;
|
|
318
|
+
plan: number;
|
|
319
|
+
paidUntil: bigint;
|
|
320
|
+
count: bigint;
|
|
321
|
+
retired: boolean;
|
|
322
|
+
}
|
|
323
|
+
export declare function usdgDomain(deployment: Pick<Deployment, 'network' | 'chainId' | 'usdg'>): TypedDataRequest['domain'];
|
|
324
|
+
export declare function assertDeployment(deployment: Deployment): void;
|
|
325
|
+
export declare class SubscriptionLifecycle {
|
|
326
|
+
readonly options: LifecycleOptions;
|
|
327
|
+
constructor(options: LifecycleOptions);
|
|
328
|
+
get deployment(): Deployment;
|
|
329
|
+
get wallet(): `0x${string}`;
|
|
330
|
+
now(): Promise<bigint>;
|
|
331
|
+
authoritative(): Promise<SubscriptionRecord | null>;
|
|
332
|
+
proof(record: SubscriptionRecord): Promise<GrandfatherProofResult | null>;
|
|
333
|
+
balance(token: Address): Promise<bigint>;
|
|
334
|
+
access(record: SubscriptionRecord | null): Promise<boolean>;
|
|
335
|
+
private plain;
|
|
336
|
+
action(action: (locked: LockedSender) => Promise<LifecycleResult>, retryNote?: boolean): Promise<LifecycleResult>;
|
|
337
|
+
private tx;
|
|
338
|
+
private funds;
|
|
339
|
+
private authorization;
|
|
340
|
+
private note;
|
|
341
|
+
private fresh;
|
|
342
|
+
pricedPayment(locked: LockedSender, contract: Address, plan: 'holder' | 'nohold', renewal?: boolean): Promise<LifecycleResult>;
|
|
343
|
+
holderPayment(locked: LockedSender, record: SubscriptionRecord, proof?: GrandfatherProofResult): Promise<LifecycleResult>;
|
|
344
|
+
subscribe(plan: 'holder' | 'nohold'): Promise<LifecycleResult>;
|
|
345
|
+
cancel(): Promise<LifecycleResult>;
|
|
346
|
+
register(noTag?: boolean): Promise<ToolResponse<ActionResult>>;
|
|
347
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f}from"./chunks/HGFLLHB6.js";import"./chunks/HLAZAI2Q.js";import"./chunks/QIDB35RS.js";import"./chunks/YVAFJM4Y.js";export{b as HOLDER_PRICE,c as RENEW_WINDOW,f as SubscriptionLifecycle,e as assertDeployment,a as subscriptionAbi,d as usdgDomain};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const version: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunks/4X7FLHGQ.js";export{a as version};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type PrivateKeyAccount } from 'viem/accounts';
|
|
2
|
+
import type { Address } from 'viem';
|
|
3
|
+
export type WalletSigner = Readonly<Pick<PrivateKeyAccount, 'address' | 'signMessage' | 'signTransaction' | 'signTypedData'>>;
|
|
4
|
+
export declare function createWallet(options?: {
|
|
5
|
+
recover?: boolean;
|
|
6
|
+
replace?: boolean;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
address: Address;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function loadSigner(): Promise<WalletSigner>;
|
|
11
|
+
export declare function exportKey(): Promise<void>;
|