@dainprotocol/service-sdk 1.0.29 → 1.0.30

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.
@@ -17,16 +17,16 @@ export declare const MetadataSchema: z.ZodObject<{
17
17
  author: z.ZodString;
18
18
  tags: z.ZodArray<z.ZodString, "many">;
19
19
  }, "strip", z.ZodTypeAny, {
20
- description?: string;
21
20
  version?: string;
22
21
  title?: string;
22
+ description?: string;
23
23
  logo?: string;
24
24
  author?: string;
25
25
  tags?: string[];
26
26
  }, {
27
- description?: string;
28
27
  version?: string;
29
28
  title?: string;
29
+ description?: string;
30
30
  logo?: string;
31
31
  author?: string;
32
32
  tags?: string[];
@@ -48,8 +48,8 @@ export declare const ServiceConfigSchema: z.ZodObject<{
48
48
  recommendedPrompt: z.ZodString;
49
49
  recommendedTools: z.ZodArray<z.ZodString, "many">;
50
50
  }, "strip", z.ZodTypeAny, {
51
- description?: string;
52
51
  id?: string;
52
+ description?: string;
53
53
  name?: string;
54
54
  metadata?: {
55
55
  capabilities?: string[];
@@ -58,8 +58,8 @@ export declare const ServiceConfigSchema: z.ZodObject<{
58
58
  recommendedPrompt?: string;
59
59
  recommendedTools?: string[];
60
60
  }, {
61
- description?: string;
62
61
  id?: string;
62
+ description?: string;
63
63
  name?: string;
64
64
  metadata?: {
65
65
  capabilities?: string[];
@@ -85,8 +85,8 @@ export declare const ToolboxConfigSchema: z.ZodObject<{
85
85
  }>;
86
86
  recommendedPrompt: z.ZodString;
87
87
  }, "strip", z.ZodTypeAny, {
88
- description?: string;
89
88
  id?: string;
89
+ description?: string;
90
90
  name?: string;
91
91
  metadata?: {
92
92
  complexity?: string;
@@ -95,8 +95,8 @@ export declare const ToolboxConfigSchema: z.ZodObject<{
95
95
  recommendedPrompt?: string;
96
96
  tools?: string[];
97
97
  }, {
98
- description?: string;
99
98
  id?: string;
99
+ description?: string;
100
100
  name?: string;
101
101
  metadata?: {
102
102
  complexity?: string;
@@ -122,8 +122,8 @@ export declare const ToolConfigSchema: z.ZodObject<{
122
122
  inputSchema: z.ZodAny;
123
123
  outputSchema: z.ZodAny;
124
124
  }, "strip", z.ZodTypeAny, {
125
- description?: string;
126
125
  id?: string;
126
+ description?: string;
127
127
  name?: string;
128
128
  pricing?: {
129
129
  pricePerUse?: number;
@@ -132,8 +132,8 @@ export declare const ToolConfigSchema: z.ZodObject<{
132
132
  inputSchema?: any;
133
133
  outputSchema?: any;
134
134
  }, {
135
- description?: string;
136
135
  id?: string;
136
+ description?: string;
137
137
  name?: string;
138
138
  pricing?: {
139
139
  pricePerUse?: number;
@@ -147,12 +147,12 @@ export declare const ServiceContextSchema: z.ZodObject<{
147
147
  name: z.ZodString;
148
148
  description: z.ZodString;
149
149
  }, "strip", z.ZodTypeAny, {
150
- description?: string;
151
150
  id?: string;
151
+ description?: string;
152
152
  name?: string;
153
153
  }, {
154
- description?: string;
155
154
  id?: string;
155
+ description?: string;
156
156
  name?: string;
157
157
  }>;
158
158
  export declare const ServiceContextWithDataSchema: z.ZodObject<z.objectUtil.extendShape<{
@@ -162,14 +162,14 @@ export declare const ServiceContextWithDataSchema: z.ZodObject<z.objectUtil.exte
162
162
  }, {
163
163
  data: z.ZodAny;
164
164
  }>, "strip", z.ZodTypeAny, {
165
- description?: string;
166
165
  data?: any;
167
166
  id?: string;
167
+ description?: string;
168
168
  name?: string;
169
169
  }, {
170
- description?: string;
171
170
  data?: any;
172
171
  id?: string;
172
+ description?: string;
173
173
  name?: string;
174
174
  }>;
175
175
  export declare const ToolWithJsonSchemaSchema: z.ZodObject<{
@@ -178,13 +178,13 @@ export declare const ToolWithJsonSchemaSchema: z.ZodObject<{
178
178
  description: z.ZodString;
179
179
  inputSchema: z.ZodAny;
180
180
  }, "strip", z.ZodTypeAny, {
181
- description?: string;
182
181
  id?: string;
182
+ description?: string;
183
183
  name?: string;
184
184
  inputSchema?: any;
185
185
  }, {
186
- description?: string;
187
186
  id?: string;
187
+ description?: string;
188
188
  name?: string;
189
189
  inputSchema?: any;
190
190
  }>;
@@ -195,29 +195,29 @@ export declare const GetAllToolsAsJsonSchemaResponseSchema: z.ZodObject<{
195
195
  description: z.ZodString;
196
196
  inputSchema: z.ZodAny;
197
197
  }, "strip", z.ZodTypeAny, {
198
- description?: string;
199
198
  id?: string;
199
+ description?: string;
200
200
  name?: string;
201
201
  inputSchema?: any;
202
202
  }, {
203
- description?: string;
204
203
  id?: string;
204
+ description?: string;
205
205
  name?: string;
206
206
  inputSchema?: any;
207
207
  }>, "many">;
208
208
  reccomendedPrompts: z.ZodArray<z.ZodString, "many">;
209
209
  }, "strip", z.ZodTypeAny, {
210
210
  tools?: {
211
- description?: string;
212
211
  id?: string;
212
+ description?: string;
213
213
  name?: string;
214
214
  inputSchema?: any;
215
215
  }[];
216
216
  reccomendedPrompts?: string[];
217
217
  }, {
218
218
  tools?: {
219
- description?: string;
220
219
  id?: string;
220
+ description?: string;
221
221
  name?: string;
222
222
  inputSchema?: any;
223
223
  }[];
@@ -231,16 +231,16 @@ export declare const ServicePinnableSchema: z.ZodObject<{
231
231
  description: z.ZodString;
232
232
  icon: z.ZodString;
233
233
  }, "strip", z.ZodTypeAny, {
234
- description?: string;
235
234
  type?: "button" | "widget";
236
235
  id?: string;
236
+ description?: string;
237
237
  name?: string;
238
238
  label?: string;
239
239
  icon?: string;
240
240
  }, {
241
- description?: string;
242
241
  type?: "button" | "widget";
243
242
  id?: string;
243
+ description?: string;
244
244
  name?: string;
245
245
  label?: string;
246
246
  icon?: string;
@@ -267,27 +267,27 @@ export declare const ServicePinnableWithWidgetSchema: z.ZodObject<z.objectUtil.e
267
267
  ui?: any;
268
268
  }>;
269
269
  }>, "strip", z.ZodTypeAny, {
270
- description?: string;
271
270
  type?: "button" | "widget";
271
+ id?: string;
272
+ description?: string;
273
+ name?: string;
272
274
  widget?: {
273
275
  text?: string;
274
276
  data?: any;
275
277
  ui?: any;
276
278
  };
277
- id?: string;
278
- name?: string;
279
279
  label?: string;
280
280
  icon?: string;
281
281
  }, {
282
- description?: string;
283
282
  type?: "button" | "widget";
283
+ id?: string;
284
+ description?: string;
285
+ name?: string;
284
286
  widget?: {
285
287
  text?: string;
286
288
  data?: any;
287
289
  ui?: any;
288
290
  };
289
- id?: string;
290
- name?: string;
291
291
  label?: string;
292
292
  icon?: string;
293
293
  }>;
@@ -17,7 +17,7 @@ export interface PaymentIntent {
17
17
  declare class DAINServicePayments {
18
18
  private keypair;
19
19
  private smartAccountAddress?;
20
- constructor(keypair: Keypair, smartAccountAddress?: PublicKey);
20
+ constructor(keypairOrApiKey: Keypair | string, smartAccountAddress?: PublicKey);
21
21
  createPaymentIntent({ amount, description, }: {
22
22
  amount: number;
23
23
  description: string;
@@ -1,12 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const service_1 = require("@/service/service");
3
5
  const web3_js_1 = require("@solana/web3.js");
6
+ const bs58_1 = tslib_1.__importDefault(require("bs58"));
4
7
  class DAINServicePayments {
5
8
  keypair;
6
9
  smartAccountAddress;
7
- constructor(keypair, smartAccountAddress) {
8
- this.keypair = keypair;
9
- this.smartAccountAddress = smartAccountAddress;
10
+ constructor(keypairOrApiKey, smartAccountAddress) {
11
+ if (typeof keypairOrApiKey === "string") {
12
+ const identity = (0, service_1.parseApiKey)(keypairOrApiKey);
13
+ this.keypair = web3_js_1.Keypair.fromSecretKey(bs58_1.default.decode(identity.privateKey));
14
+ this.smartAccountAddress = new web3_js_1.PublicKey(identity.agentId);
15
+ }
16
+ else {
17
+ this.keypair = keypairOrApiKey;
18
+ this.smartAccountAddress = smartAccountAddress;
19
+ }
10
20
  }
11
21
  createPaymentIntent({ amount, description, }) {
12
22
  // TODO: Implement actual payment intent creation logic
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/payments/index.ts"],"names":[],"mappings":";;AAAA,6CAAqD;AAqBrD,MAAM,mBAAmB;IACf,OAAO,CA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CAAC;YAC/B,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QACjD,CAAC;IACH,CAAC;IAED,mBAAmB,CAAC,EAClB,MAAM,EACN,WAAW,GAIZ;QACC,uDAAuD;QAEvD,MAAM,oBAAoB,GAAG,iBAAO,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;QACrE,OAAO;YACL,oBAAoB,EAAE,oBAAoB;YAC1C,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,WAAW;SACzB,CAAC;IACJ,CAAC;IAED,SAAS,CAAC,EAAE,oBAAoB,EAAmB;QACjD,gDAAgD;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,EAAE,oBAAoB,EAAa;QAC5C,gCAAgC;QAEhC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,kBAAe,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dainprotocol/service-sdk",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "description": "DAIN Service SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",