@alien_org/contract 0.0.17-beta → 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 CHANGED
@@ -1,5 +1,7 @@
1
1
  # @alien_org/contract
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@alien_org/contract.svg)](https://www.npmjs.com/package/@alien_org/contract)
4
+
3
5
  Type definitions and version utilities for miniapp-host communication.
4
6
 
5
7
  ## Installation
package/dist/index.cjs CHANGED
@@ -9,7 +9,12 @@ const PLATFORMS = ["ios", "android"];
9
9
  //#region src/methods/versions/releases.ts
10
10
  const releases = {
11
11
  "0.0.9": ["app:ready"],
12
- "0.0.14": ["miniapp:close.ack", "host.back.button:toggle"]
12
+ "0.0.14": ["miniapp:close.ack", "host.back.button:toggle"],
13
+ "0.1.1": [
14
+ "payment:request",
15
+ "clipboard:write",
16
+ "clipboard:read"
17
+ ]
13
18
  };
14
19
 
15
20
  //#endregion
package/dist/index.d.cts CHANGED
@@ -83,7 +83,7 @@ interface Events {
83
83
  * For instant fulfillment, your backend should fulfill on webhook receipt
84
84
  * using the `invoice` from the request.
85
85
  *
86
- * @since 0.0.14
86
+ * @since 0.1.1
87
87
  * @schema
88
88
  */
89
89
  'payment:response': CreateEventPayload<WithReqId<{
@@ -92,13 +92,13 @@ interface Events {
92
92
  * - `paid`: Success
93
93
  * - `cancelled`: User rejected
94
94
  * - `failed`: Error (check `errorCode`)
95
- * @since 0.0.14
95
+ * @since 0.1.1
96
96
  * @schema
97
97
  */
98
98
  status: 'paid' | 'cancelled' | 'failed';
99
99
  /**
100
100
  * Transaction hash (present when status is 'paid').
101
- * @since 0.0.14
101
+ * @since 0.1.1
102
102
  * @schema
103
103
  */
104
104
  txHash?: string;
@@ -109,11 +109,36 @@ interface Events {
109
109
  * - `pre_checkout_rejected`: Backend rejected the payment in pre-checkout
110
110
  * - `pre_checkout_timeout`: Backend didn't respond to pre-checkout in time
111
111
  * - `unknown`: Unexpected error
112
- * @since 0.0.14
112
+ * @since 0.1.1
113
113
  * @schema
114
114
  */
115
115
  errorCode?: 'insufficient_balance' | 'network_error' | 'pre_checkout_rejected' | 'pre_checkout_timeout' | 'unknown';
116
116
  }>>;
117
+ /**
118
+ * Clipboard read response.
119
+ *
120
+ * On success: `text` contains the clipboard content (may be empty string).
121
+ * On failure: `text` is null and `errorCode` indicates the reason.
122
+ *
123
+ * @since 0.1.1
124
+ * @schema
125
+ */
126
+ 'clipboard:response': CreateEventPayload<WithReqId<{
127
+ /**
128
+ * Text from clipboard. Null if read failed.
129
+ * @since 0.1.1
130
+ * @schema
131
+ */
132
+ text: string | null;
133
+ /**
134
+ * Error code if clipboard read failed.
135
+ * - `permission_denied`: User denied clipboard access
136
+ * - `unavailable`: Clipboard is not available
137
+ * @since 0.1.1
138
+ * @schema
139
+ */
140
+ errorCode?: 'permission_denied' | 'unavailable';
141
+ }>>;
117
142
  }
118
143
  //#endregion
119
144
  //#region src/events/types/event-types.d.ts
@@ -204,61 +229,61 @@ interface Methods {
204
229
  * Set `test: true` for test mode - no real payment is made, but webhooks
205
230
  * are fired with `test: true` flag. Use for development and testing.
206
231
  *
207
- * @since 0.0.14
232
+ * @since 0.1.1
208
233
  * @schema
209
234
  */
210
235
  'payment:request': CreateMethodPayload<WithReqId<{
211
236
  /**
212
237
  * The recipient's wallet address.
213
- * @since 0.0.14
238
+ * @since 0.1.1
214
239
  * @schema
215
240
  */
216
241
  recipient: string;
217
242
  /**
218
243
  * The amount to pay (in token's smallest unit, as string for precision).
219
- * @since 0.0.14
244
+ * @since 0.1.1
220
245
  * @schema
221
246
  */
222
247
  amount: string;
223
248
  /**
224
249
  * The token identifier (e.g., 'SOL', 'ALIEN', or contract address).
225
- * @since 0.0.14
250
+ * @since 0.1.1
226
251
  * @schema
227
252
  */
228
253
  token: string;
229
254
  /**
230
255
  * The network for the payment ('solana' or 'alien').
231
- * @since 0.0.14
256
+ * @since 0.1.1
232
257
  * @schema
233
258
  */
234
259
  network: string;
235
260
  /**
236
261
  * Your order/invoice ID for backend correlation and instant fulfillment.
237
- * @since 0.0.14
262
+ * @since 0.1.1
238
263
  * @schema
239
264
  */
240
265
  invoice: string;
241
266
  /**
242
267
  * Item title shown on the approval screen.
243
- * @since 0.0.14
268
+ * @since 0.1.1
244
269
  * @schema
245
270
  */
246
271
  title?: string;
247
272
  /**
248
273
  * Item description/caption shown on the approval screen.
249
- * @since 0.0.14
274
+ * @since 0.1.1
250
275
  * @schema
251
276
  */
252
277
  caption?: string;
253
278
  /**
254
279
  * Item icon URL shown on the approval screen.
255
- * @since 0.0.14
280
+ * @since 0.1.1
256
281
  * @schema
257
282
  */
258
283
  iconUrl?: string;
259
284
  /**
260
285
  * Quantity of items being purchased.
261
- * @since 0.0.14
286
+ * @since 0.1.1
262
287
  * @schema
263
288
  */
264
289
  quantity?: number;
@@ -266,11 +291,30 @@ interface Methods {
266
291
  * Test mode flag. When true, no real payment is processed.
267
292
  * The approval screen shows a test indicator, and webhooks
268
293
  * include `test: true`. Use for development and testing.
269
- * @since 0.0.14
294
+ * @since 0.1.1
270
295
  * @schema
271
296
  */
272
297
  test?: boolean;
273
298
  }>>;
299
+ /**
300
+ * Write text to the system clipboard.
301
+ * @since 0.1.1
302
+ * @schema
303
+ */
304
+ 'clipboard:write': CreateMethodPayload<{
305
+ /**
306
+ * Text to copy to clipboard.
307
+ * @since 0.1.1
308
+ * @schema
309
+ */
310
+ text: string;
311
+ }>;
312
+ /**
313
+ * Read text from the system clipboard.
314
+ * @since 0.1.1
315
+ * @schema
316
+ */
317
+ 'clipboard:read': CreateMethodPayload<WithReqId<Empty>>;
274
318
  }
275
319
  //#endregion
276
320
  //#region src/methods/types/method-types.d.ts
package/dist/index.d.mts CHANGED
@@ -83,7 +83,7 @@ interface Events {
83
83
  * For instant fulfillment, your backend should fulfill on webhook receipt
84
84
  * using the `invoice` from the request.
85
85
  *
86
- * @since 0.0.14
86
+ * @since 0.1.1
87
87
  * @schema
88
88
  */
89
89
  'payment:response': CreateEventPayload<WithReqId<{
@@ -92,13 +92,13 @@ interface Events {
92
92
  * - `paid`: Success
93
93
  * - `cancelled`: User rejected
94
94
  * - `failed`: Error (check `errorCode`)
95
- * @since 0.0.14
95
+ * @since 0.1.1
96
96
  * @schema
97
97
  */
98
98
  status: 'paid' | 'cancelled' | 'failed';
99
99
  /**
100
100
  * Transaction hash (present when status is 'paid').
101
- * @since 0.0.14
101
+ * @since 0.1.1
102
102
  * @schema
103
103
  */
104
104
  txHash?: string;
@@ -109,11 +109,36 @@ interface Events {
109
109
  * - `pre_checkout_rejected`: Backend rejected the payment in pre-checkout
110
110
  * - `pre_checkout_timeout`: Backend didn't respond to pre-checkout in time
111
111
  * - `unknown`: Unexpected error
112
- * @since 0.0.14
112
+ * @since 0.1.1
113
113
  * @schema
114
114
  */
115
115
  errorCode?: 'insufficient_balance' | 'network_error' | 'pre_checkout_rejected' | 'pre_checkout_timeout' | 'unknown';
116
116
  }>>;
117
+ /**
118
+ * Clipboard read response.
119
+ *
120
+ * On success: `text` contains the clipboard content (may be empty string).
121
+ * On failure: `text` is null and `errorCode` indicates the reason.
122
+ *
123
+ * @since 0.1.1
124
+ * @schema
125
+ */
126
+ 'clipboard:response': CreateEventPayload<WithReqId<{
127
+ /**
128
+ * Text from clipboard. Null if read failed.
129
+ * @since 0.1.1
130
+ * @schema
131
+ */
132
+ text: string | null;
133
+ /**
134
+ * Error code if clipboard read failed.
135
+ * - `permission_denied`: User denied clipboard access
136
+ * - `unavailable`: Clipboard is not available
137
+ * @since 0.1.1
138
+ * @schema
139
+ */
140
+ errorCode?: 'permission_denied' | 'unavailable';
141
+ }>>;
117
142
  }
118
143
  //#endregion
119
144
  //#region src/events/types/event-types.d.ts
@@ -204,61 +229,61 @@ interface Methods {
204
229
  * Set `test: true` for test mode - no real payment is made, but webhooks
205
230
  * are fired with `test: true` flag. Use for development and testing.
206
231
  *
207
- * @since 0.0.14
232
+ * @since 0.1.1
208
233
  * @schema
209
234
  */
210
235
  'payment:request': CreateMethodPayload<WithReqId<{
211
236
  /**
212
237
  * The recipient's wallet address.
213
- * @since 0.0.14
238
+ * @since 0.1.1
214
239
  * @schema
215
240
  */
216
241
  recipient: string;
217
242
  /**
218
243
  * The amount to pay (in token's smallest unit, as string for precision).
219
- * @since 0.0.14
244
+ * @since 0.1.1
220
245
  * @schema
221
246
  */
222
247
  amount: string;
223
248
  /**
224
249
  * The token identifier (e.g., 'SOL', 'ALIEN', or contract address).
225
- * @since 0.0.14
250
+ * @since 0.1.1
226
251
  * @schema
227
252
  */
228
253
  token: string;
229
254
  /**
230
255
  * The network for the payment ('solana' or 'alien').
231
- * @since 0.0.14
256
+ * @since 0.1.1
232
257
  * @schema
233
258
  */
234
259
  network: string;
235
260
  /**
236
261
  * Your order/invoice ID for backend correlation and instant fulfillment.
237
- * @since 0.0.14
262
+ * @since 0.1.1
238
263
  * @schema
239
264
  */
240
265
  invoice: string;
241
266
  /**
242
267
  * Item title shown on the approval screen.
243
- * @since 0.0.14
268
+ * @since 0.1.1
244
269
  * @schema
245
270
  */
246
271
  title?: string;
247
272
  /**
248
273
  * Item description/caption shown on the approval screen.
249
- * @since 0.0.14
274
+ * @since 0.1.1
250
275
  * @schema
251
276
  */
252
277
  caption?: string;
253
278
  /**
254
279
  * Item icon URL shown on the approval screen.
255
- * @since 0.0.14
280
+ * @since 0.1.1
256
281
  * @schema
257
282
  */
258
283
  iconUrl?: string;
259
284
  /**
260
285
  * Quantity of items being purchased.
261
- * @since 0.0.14
286
+ * @since 0.1.1
262
287
  * @schema
263
288
  */
264
289
  quantity?: number;
@@ -266,11 +291,30 @@ interface Methods {
266
291
  * Test mode flag. When true, no real payment is processed.
267
292
  * The approval screen shows a test indicator, and webhooks
268
293
  * include `test: true`. Use for development and testing.
269
- * @since 0.0.14
294
+ * @since 0.1.1
270
295
  * @schema
271
296
  */
272
297
  test?: boolean;
273
298
  }>>;
299
+ /**
300
+ * Write text to the system clipboard.
301
+ * @since 0.1.1
302
+ * @schema
303
+ */
304
+ 'clipboard:write': CreateMethodPayload<{
305
+ /**
306
+ * Text to copy to clipboard.
307
+ * @since 0.1.1
308
+ * @schema
309
+ */
310
+ text: string;
311
+ }>;
312
+ /**
313
+ * Read text from the system clipboard.
314
+ * @since 0.1.1
315
+ * @schema
316
+ */
317
+ 'clipboard:read': CreateMethodPayload<WithReqId<Empty>>;
274
318
  }
275
319
  //#endregion
276
320
  //#region src/methods/types/method-types.d.ts
package/dist/index.mjs CHANGED
@@ -8,7 +8,12 @@ const PLATFORMS = ["ios", "android"];
8
8
  //#region src/methods/versions/releases.ts
9
9
  const releases = {
10
10
  "0.0.9": ["app:ready"],
11
- "0.0.14": ["miniapp:close.ack", "host.back.button:toggle"]
11
+ "0.0.14": ["miniapp:close.ack", "host.back.button:toggle"],
12
+ "0.1.1": [
13
+ "payment:request",
14
+ "clipboard:write",
15
+ "clipboard:read"
16
+ ]
12
17
  };
13
18
 
14
19
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alien_org/contract",
3
- "version": "0.0.17-beta",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",