@underscore-finance/sdk 0.0.6 → 0.0.7

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 CHANGED
@@ -39,7 +39,7 @@ const underscore = new Underscore({
39
39
 
40
40
  // Create an AI Wallet
41
41
  const createWallet = async (owner: string, aiAgent: string) => {
42
- return await underscore.contracts.AgentFactory.createWalletClient(
42
+ return await underscore.Factory.createUserWallet(
43
43
  owner, // Your wallet address
44
44
  aiAgent, // AI agent's address
45
45
  )
@@ -48,7 +48,7 @@ const createWallet = async (owner: string, aiAgent: string) => {
48
48
  // Configure AI permissions
49
49
  const configureAgent = async (agent: string, allowedAssets: string[]) => {
50
50
  for (const asset of allowedAssets) {
51
- await underscore.contracts.WalletConfig('0xWalletAddress').addAssetForAgent(agent, asset)
51
+ await underscore.UserWalletConfig.at('0xWalletAddress').addAssetForAgent(agent, asset)
52
52
  }
53
53
  }
54
54
  ```
@@ -0,0 +1,162 @@
1
+ import { PublicClient, WalletClient } from 'viem';
2
+ type ExtractArgs<T> = T extends (...args: infer P) => any ? P : never;
3
+ type Address = `0x${string}`;
4
+ export declare const abi: readonly [{
5
+ readonly stateMutability: "view";
6
+ readonly type: "function";
7
+ readonly name: "getRegistries";
8
+ readonly inputs: readonly [];
9
+ readonly outputs: readonly [{
10
+ readonly name: "";
11
+ readonly type: "address[]";
12
+ }];
13
+ }, {
14
+ readonly stateMutability: "view";
15
+ readonly type: "function";
16
+ readonly name: "getAccessForLego";
17
+ readonly inputs: readonly [{
18
+ readonly name: "_user";
19
+ readonly type: "address";
20
+ }];
21
+ readonly outputs: readonly [{
22
+ readonly name: "";
23
+ readonly type: "address";
24
+ }, {
25
+ readonly name: "";
26
+ readonly type: "string";
27
+ }, {
28
+ readonly name: "";
29
+ readonly type: "uint256";
30
+ }];
31
+ }, {
32
+ readonly stateMutability: "nonpayable";
33
+ readonly type: "function";
34
+ readonly name: "claimRewards";
35
+ readonly inputs: readonly [{
36
+ readonly name: "_user";
37
+ readonly type: "address";
38
+ }, {
39
+ readonly name: "_market";
40
+ readonly type: "address";
41
+ }, {
42
+ readonly name: "_rewardToken";
43
+ readonly type: "address";
44
+ }, {
45
+ readonly name: "_rewardAmount";
46
+ readonly type: "uint256";
47
+ }, {
48
+ readonly name: "_proof";
49
+ readonly type: "bytes32";
50
+ }];
51
+ readonly outputs: readonly [];
52
+ }, {
53
+ readonly stateMutability: "nonpayable";
54
+ readonly type: "function";
55
+ readonly name: "recoverFunds";
56
+ readonly inputs: readonly [{
57
+ readonly name: "_asset";
58
+ readonly type: "address";
59
+ }, {
60
+ readonly name: "_recipient";
61
+ readonly type: "address";
62
+ }];
63
+ readonly outputs: readonly [{
64
+ readonly name: "";
65
+ readonly type: "bool";
66
+ }];
67
+ }, {
68
+ readonly stateMutability: "view";
69
+ readonly type: "function";
70
+ readonly name: "legoId";
71
+ readonly inputs: readonly [];
72
+ readonly outputs: readonly [{
73
+ readonly name: "";
74
+ readonly type: "uint256";
75
+ }];
76
+ }, {
77
+ readonly stateMutability: "nonpayable";
78
+ readonly type: "function";
79
+ readonly name: "setLegoId";
80
+ readonly inputs: readonly [{
81
+ readonly name: "_legoId";
82
+ readonly type: "uint256";
83
+ }];
84
+ readonly outputs: readonly [{
85
+ readonly name: "";
86
+ readonly type: "bool";
87
+ }];
88
+ }, {
89
+ readonly stateMutability: "view";
90
+ readonly type: "function";
91
+ readonly name: "hasClaimableRewards";
92
+ readonly inputs: readonly [{
93
+ readonly name: "_user";
94
+ readonly type: "address";
95
+ }];
96
+ readonly outputs: readonly [{
97
+ readonly name: "";
98
+ readonly type: "bool";
99
+ }];
100
+ }];
101
+ export declare const deployAddress: Address | undefined;
102
+ export type Contract = {
103
+ calls: {
104
+ getRegistries: () => Promise<`0x${string}`[]>;
105
+ getAccessForLego: (user: `0x${string}`) => Promise<[`0x${string}`, string, bigint]>;
106
+ legoId: () => Promise<bigint>;
107
+ hasClaimableRewards: (user: `0x${string}`) => Promise<boolean>;
108
+ };
109
+ mutations: {
110
+ claimRewards: (user: `0x${string}`, market: `0x${string}`, rewardToken: `0x${string}`, rewardAmount: bigint, proof: `0x${string}`) => Promise<void>;
111
+ recoverFunds: (asset: `0x${string}`, recipient: `0x${string}`) => Promise<boolean>;
112
+ setLegoId: (legoId: bigint) => Promise<boolean>;
113
+ };
114
+ events: {};
115
+ };
116
+ export type Calls = keyof Contract['calls'];
117
+ export type Request<M extends Calls> = {
118
+ contractName: 'LegoCommon';
119
+ method: M;
120
+ args: ExtractArgs<Contract['calls'][M]>;
121
+ address: Address | undefined;
122
+ deployAddress: Address | undefined;
123
+ defaultValue: Awaited<ReturnType<Contract['calls'][M]>> | undefined;
124
+ getAbi: () => typeof abi;
125
+ with: (options: {
126
+ contractAddress?: Address;
127
+ defaultValue?: Awaited<ReturnType<Contract['calls'][M]>>;
128
+ }) => Request<M>;
129
+ defaultTo: (defaultValue: Awaited<ReturnType<Contract['calls'][M]>>) => Request<M>;
130
+ at: (address: Address) => Request<M>;
131
+ };
132
+ export type CallReturn<M extends Calls> = NonNullable<Request<M>['defaultValue']>;
133
+ declare function getRequest<M extends Calls>(method: M, args: ExtractArgs<Contract['calls'][M]>, contractAddressOrOptions?: Address | {
134
+ contractAddress?: Address;
135
+ defaultValue?: Awaited<ReturnType<Contract['calls'][M]>>;
136
+ }): Request<M>;
137
+ type CallType = {
138
+ [K in Calls]: (...args: ExtractArgs<Contract['calls'][K]>) => ReturnType<typeof getRequest<K>>;
139
+ };
140
+ export declare const call: CallType;
141
+ export type Mutations = keyof Contract['mutations'];
142
+ export declare const mutation: {
143
+ [K in Mutations]: {
144
+ contractName: 'LegoCommon';
145
+ deployAddress: Address | undefined;
146
+ getAbi: () => typeof abi;
147
+ functionName: K;
148
+ argsType: ExtractArgs<Contract['mutations'][K]> | undefined;
149
+ };
150
+ };
151
+ export type SDK = {
152
+ getRegistries: (...args: ExtractArgs<Contract['calls']['getRegistries']>) => Promise<CallReturn<'getRegistries'>>;
153
+ getAccessForLego: (...args: ExtractArgs<Contract['calls']['getAccessForLego']>) => Promise<CallReturn<'getAccessForLego'>>;
154
+ legoId: (...args: ExtractArgs<Contract['calls']['legoId']>) => Promise<CallReturn<'legoId'>>;
155
+ hasClaimableRewards: (...args: ExtractArgs<Contract['calls']['hasClaimableRewards']>) => Promise<CallReturn<'hasClaimableRewards'>>;
156
+ claimRewards: (...args: ExtractArgs<Contract['mutations']['claimRewards']>) => Promise<Address>;
157
+ recoverFunds: (...args: ExtractArgs<Contract['mutations']['recoverFunds']>) => Promise<Address>;
158
+ setLegoId: (...args: ExtractArgs<Contract['mutations']['setLegoId']>) => Promise<Address>;
159
+ };
160
+ export declare function toSdk(address: Address, publicClient?: PublicClient, walletClient?: WalletClient): SDK;
161
+ export {};
162
+ //# sourceMappingURL=LegoCommon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegoCommon.d.ts","sourceRoot":"","sources":["../../src/contracts/LegoCommon.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAEjD,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,KAAK,CAAA;AACrE,KAAK,OAAO,GAAG,KAAK,MAAM,EAAE,CAAA;AAE5B,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqIN,CAAA;AAEV,eAAO,MAAM,aAAa,EAAE,OAAO,GAAG,SAAqB,CAAA;AAE3D,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE;QACL,aAAa,EAAE,MAAM,OAAO,CAAC,KAAK,MAAM,EAAE,EAAE,CAAC,CAAA;QAC7C,gBAAgB,EAAE,CAAC,IAAI,EAAE,KAAK,MAAM,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AC,GAAG,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/F,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC1F,CAAA;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,EAAE,YAAY,GAAG,GAAG,CAsBrG"}
@@ -0,0 +1,200 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /* @ts-nocheck */
5
+ import { singleQuery, mutate } from '@dappql/async';
6
+ export const abi = [
7
+ {
8
+ stateMutability: 'view',
9
+ type: 'function',
10
+ name: 'getRegistries',
11
+ inputs: [],
12
+ outputs: [
13
+ {
14
+ name: '',
15
+ type: 'address[]',
16
+ },
17
+ ],
18
+ },
19
+ {
20
+ stateMutability: 'view',
21
+ type: 'function',
22
+ name: 'getAccessForLego',
23
+ inputs: [
24
+ {
25
+ name: '_user',
26
+ type: 'address',
27
+ },
28
+ ],
29
+ outputs: [
30
+ {
31
+ name: '',
32
+ type: 'address',
33
+ },
34
+ {
35
+ name: '',
36
+ type: 'string',
37
+ },
38
+ {
39
+ name: '',
40
+ type: 'uint256',
41
+ },
42
+ ],
43
+ },
44
+ {
45
+ stateMutability: 'nonpayable',
46
+ type: 'function',
47
+ name: 'claimRewards',
48
+ inputs: [
49
+ {
50
+ name: '_user',
51
+ type: 'address',
52
+ },
53
+ {
54
+ name: '_market',
55
+ type: 'address',
56
+ },
57
+ {
58
+ name: '_rewardToken',
59
+ type: 'address',
60
+ },
61
+ {
62
+ name: '_rewardAmount',
63
+ type: 'uint256',
64
+ },
65
+ {
66
+ name: '_proof',
67
+ type: 'bytes32',
68
+ },
69
+ ],
70
+ outputs: [],
71
+ },
72
+ {
73
+ stateMutability: 'nonpayable',
74
+ type: 'function',
75
+ name: 'recoverFunds',
76
+ inputs: [
77
+ {
78
+ name: '_asset',
79
+ type: 'address',
80
+ },
81
+ {
82
+ name: '_recipient',
83
+ type: 'address',
84
+ },
85
+ ],
86
+ outputs: [
87
+ {
88
+ name: '',
89
+ type: 'bool',
90
+ },
91
+ ],
92
+ },
93
+ {
94
+ stateMutability: 'view',
95
+ type: 'function',
96
+ name: 'legoId',
97
+ inputs: [],
98
+ outputs: [
99
+ {
100
+ name: '',
101
+ type: 'uint256',
102
+ },
103
+ ],
104
+ },
105
+ {
106
+ stateMutability: 'nonpayable',
107
+ type: 'function',
108
+ name: 'setLegoId',
109
+ inputs: [
110
+ {
111
+ name: '_legoId',
112
+ type: 'uint256',
113
+ },
114
+ ],
115
+ outputs: [
116
+ {
117
+ name: '',
118
+ type: 'bool',
119
+ },
120
+ ],
121
+ },
122
+ {
123
+ stateMutability: 'view',
124
+ type: 'function',
125
+ name: 'hasClaimableRewards',
126
+ inputs: [
127
+ {
128
+ name: '_user',
129
+ type: 'address',
130
+ },
131
+ ],
132
+ outputs: [
133
+ {
134
+ name: '',
135
+ type: 'bool',
136
+ },
137
+ ],
138
+ },
139
+ ];
140
+ export const deployAddress = undefined;
141
+ function getRequest(method, args, contractAddressOrOptions) {
142
+ const address = typeof contractAddressOrOptions === 'string' ? contractAddressOrOptions : contractAddressOrOptions?.contractAddress;
143
+ const defaultValue = typeof contractAddressOrOptions === 'string' ? undefined : contractAddressOrOptions?.defaultValue;
144
+ const call = {
145
+ contractName: 'LegoCommon',
146
+ method,
147
+ args,
148
+ address,
149
+ deployAddress,
150
+ defaultValue,
151
+ getAbi: () => abi,
152
+ with: (options) => {
153
+ call.address = options.contractAddress;
154
+ call.defaultValue = options.defaultValue;
155
+ return call;
156
+ },
157
+ defaultTo: (defaultValue) => {
158
+ call.defaultValue = defaultValue;
159
+ return call;
160
+ },
161
+ at: (address) => {
162
+ call.address = address;
163
+ return call;
164
+ },
165
+ };
166
+ return call;
167
+ }
168
+ export const call = {
169
+ getRegistries: (...args) => getRequest('getRegistries', args),
170
+ getAccessForLego: (...args) => getRequest('getAccessForLego', args),
171
+ legoId: (...args) => getRequest('legoId', args),
172
+ hasClaimableRewards: (...args) => getRequest('hasClaimableRewards', args),
173
+ };
174
+ function getMutation(functionName) {
175
+ return {
176
+ contractName: 'LegoCommon',
177
+ functionName,
178
+ deployAddress,
179
+ argsType: undefined,
180
+ getAbi: () => abi,
181
+ };
182
+ }
183
+ export const mutation = {
184
+ claimRewards: getMutation('claimRewards'),
185
+ recoverFunds: getMutation('recoverFunds'),
186
+ setLegoId: getMutation('setLegoId'),
187
+ };
188
+ export function toSdk(address, publicClient, walletClient) {
189
+ return {
190
+ // Queries
191
+ getRegistries: (...args) => singleQuery(publicClient, call.getRegistries(...args).at(address)),
192
+ getAccessForLego: (...args) => singleQuery(publicClient, call.getAccessForLego(...args).at(address)),
193
+ legoId: (...args) => singleQuery(publicClient, call.legoId(...args).at(address)),
194
+ hasClaimableRewards: (...args) => singleQuery(publicClient, call.hasClaimableRewards(...args).at(address)),
195
+ // Mutations
196
+ claimRewards: (...args) => mutate(walletClient, mutation.claimRewards, { address })(...args),
197
+ recoverFunds: (...args) => mutate(walletClient, mutation.recoverFunds, { address })(...args),
198
+ setLegoId: (...args) => mutate(walletClient, mutation.setLegoId, { address })(...args),
199
+ };
200
+ }
@@ -0,0 +1,138 @@
1
+ import { PublicClient, WalletClient } from 'viem';
2
+ type ExtractArgs<T> = T extends (...args: infer P) => any ? P : never;
3
+ type Address = `0x${string}`;
4
+ export declare const abi: readonly [{
5
+ readonly stateMutability: "nonpayable";
6
+ readonly type: "function";
7
+ readonly name: "borrow";
8
+ readonly inputs: readonly [{
9
+ readonly name: "_borrowAsset";
10
+ readonly type: "address";
11
+ }, {
12
+ readonly name: "_amount";
13
+ readonly type: "uint256";
14
+ }, {
15
+ readonly name: "_recipient";
16
+ readonly type: "address";
17
+ }];
18
+ readonly outputs: readonly [{
19
+ readonly name: "";
20
+ readonly type: "address";
21
+ }, {
22
+ readonly name: "";
23
+ readonly type: "uint256";
24
+ }, {
25
+ readonly name: "";
26
+ readonly type: "uint256";
27
+ }];
28
+ }, {
29
+ readonly stateMutability: "nonpayable";
30
+ readonly type: "function";
31
+ readonly name: "borrow";
32
+ readonly inputs: readonly [{
33
+ readonly name: "_borrowAsset";
34
+ readonly type: "address";
35
+ }, {
36
+ readonly name: "_amount";
37
+ readonly type: "uint256";
38
+ }, {
39
+ readonly name: "_recipient";
40
+ readonly type: "address";
41
+ }, {
42
+ readonly name: "_oracleRegistry";
43
+ readonly type: "address";
44
+ }];
45
+ readonly outputs: readonly [{
46
+ readonly name: "";
47
+ readonly type: "address";
48
+ }, {
49
+ readonly name: "";
50
+ readonly type: "uint256";
51
+ }, {
52
+ readonly name: "";
53
+ readonly type: "uint256";
54
+ }];
55
+ }, {
56
+ readonly stateMutability: "nonpayable";
57
+ readonly type: "function";
58
+ readonly name: "repayDebt";
59
+ readonly inputs: readonly [{
60
+ readonly name: "_paymentAsset";
61
+ readonly type: "address";
62
+ }, {
63
+ readonly name: "_paymentAmount";
64
+ readonly type: "uint256";
65
+ }, {
66
+ readonly name: "_recipient";
67
+ readonly type: "address";
68
+ }];
69
+ readonly outputs: readonly [{
70
+ readonly name: "";
71
+ readonly type: "address";
72
+ }, {
73
+ readonly name: "";
74
+ readonly type: "uint256";
75
+ }, {
76
+ readonly name: "";
77
+ readonly type: "uint256";
78
+ }, {
79
+ readonly name: "";
80
+ readonly type: "uint256";
81
+ }];
82
+ }, {
83
+ readonly stateMutability: "nonpayable";
84
+ readonly type: "function";
85
+ readonly name: "repayDebt";
86
+ readonly inputs: readonly [{
87
+ readonly name: "_paymentAsset";
88
+ readonly type: "address";
89
+ }, {
90
+ readonly name: "_paymentAmount";
91
+ readonly type: "uint256";
92
+ }, {
93
+ readonly name: "_recipient";
94
+ readonly type: "address";
95
+ }, {
96
+ readonly name: "_oracleRegistry";
97
+ readonly type: "address";
98
+ }];
99
+ readonly outputs: readonly [{
100
+ readonly name: "";
101
+ readonly type: "address";
102
+ }, {
103
+ readonly name: "";
104
+ readonly type: "uint256";
105
+ }, {
106
+ readonly name: "";
107
+ readonly type: "uint256";
108
+ }, {
109
+ readonly name: "";
110
+ readonly type: "uint256";
111
+ }];
112
+ }];
113
+ export declare const deployAddress: Address | undefined;
114
+ export type Contract = {
115
+ calls: {};
116
+ mutations: {
117
+ borrow: (borrowAsset: `0x${string}`, amount: bigint, recipient: `0x${string}`, oracleRegistry?: `0x${string}`) => Promise<[`0x${string}`, bigint, bigint]>;
118
+ repayDebt: (paymentAsset: `0x${string}`, paymentAmount: bigint, recipient: `0x${string}`, oracleRegistry?: `0x${string}`) => Promise<[`0x${string}`, bigint, bigint, bigint]>;
119
+ };
120
+ events: {};
121
+ };
122
+ export type Mutations = keyof Contract['mutations'];
123
+ export declare const mutation: {
124
+ [K in Mutations]: {
125
+ contractName: 'LegoCredit';
126
+ deployAddress: Address | undefined;
127
+ getAbi: () => typeof abi;
128
+ functionName: K;
129
+ argsType: ExtractArgs<Contract['mutations'][K]> | undefined;
130
+ };
131
+ };
132
+ export type SDK = {
133
+ borrow: (...args: ExtractArgs<Contract['mutations']['borrow']>) => Promise<Address>;
134
+ repayDebt: (...args: ExtractArgs<Contract['mutations']['repayDebt']>) => Promise<Address>;
135
+ };
136
+ export declare function toSdk(address: Address, publicClient?: PublicClient, walletClient?: WalletClient): SDK;
137
+ export {};
138
+ //# sourceMappingURL=LegoCredit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegoCredit.d.ts","sourceRoot":"","sources":["../../src/contracts/LegoCredit.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAEjD,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE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