@blockrun/llm 3.5.2 → 3.7.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/dist/index.cjs +12 -2
- package/dist/index.js +12 -2
- package/package.json +10 -3
package/dist/index.cjs
CHANGED
|
@@ -161,6 +161,16 @@ function createNonce() {
|
|
|
161
161
|
crypto.getRandomValues(bytes);
|
|
162
162
|
return `0x${Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
163
163
|
}
|
|
164
|
+
var BLOCKRUN_SERVICE_CODE = "blockrun";
|
|
165
|
+
function withBuilderCodeServiceCode(extensions) {
|
|
166
|
+
const merged = { ...extensions || {} };
|
|
167
|
+
const existing = merged["builder-code"] || {};
|
|
168
|
+
merged["builder-code"] = {
|
|
169
|
+
...existing,
|
|
170
|
+
info: { ...existing.info || {}, s: [BLOCKRUN_SERVICE_CODE] }
|
|
171
|
+
};
|
|
172
|
+
return merged;
|
|
173
|
+
}
|
|
164
174
|
async function createPaymentPayload(privateKey, fromAddress, recipient, amount, network = "eip155:8453", options = {}) {
|
|
165
175
|
const now = Math.floor(Date.now() / 1e3);
|
|
166
176
|
const validAfter = now - 600;
|
|
@@ -208,7 +218,7 @@ async function createPaymentPayload(privateKey, fromAddress, recipient, amount,
|
|
|
208
218
|
nonce
|
|
209
219
|
}
|
|
210
220
|
},
|
|
211
|
-
extensions: options.extensions
|
|
221
|
+
extensions: withBuilderCodeServiceCode(options.extensions)
|
|
212
222
|
};
|
|
213
223
|
return btoa(JSON.stringify(paymentData));
|
|
214
224
|
}
|
|
@@ -268,7 +278,7 @@ async function createSolanaPaymentPayload(secretKey, fromAddress, recipient, amo
|
|
|
268
278
|
payload: {
|
|
269
279
|
transaction: serializedTx
|
|
270
280
|
},
|
|
271
|
-
extensions: options.extensions
|
|
281
|
+
extensions: withBuilderCodeServiceCode(options.extensions)
|
|
272
282
|
};
|
|
273
283
|
return btoa(JSON.stringify(paymentData));
|
|
274
284
|
}
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,16 @@ function createNonce() {
|
|
|
54
54
|
crypto.getRandomValues(bytes);
|
|
55
55
|
return `0x${Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
56
56
|
}
|
|
57
|
+
var BLOCKRUN_SERVICE_CODE = "blockrun";
|
|
58
|
+
function withBuilderCodeServiceCode(extensions) {
|
|
59
|
+
const merged = { ...extensions || {} };
|
|
60
|
+
const existing = merged["builder-code"] || {};
|
|
61
|
+
merged["builder-code"] = {
|
|
62
|
+
...existing,
|
|
63
|
+
info: { ...existing.info || {}, s: [BLOCKRUN_SERVICE_CODE] }
|
|
64
|
+
};
|
|
65
|
+
return merged;
|
|
66
|
+
}
|
|
57
67
|
async function createPaymentPayload(privateKey, fromAddress, recipient, amount, network = "eip155:8453", options = {}) {
|
|
58
68
|
const now = Math.floor(Date.now() / 1e3);
|
|
59
69
|
const validAfter = now - 600;
|
|
@@ -101,7 +111,7 @@ async function createPaymentPayload(privateKey, fromAddress, recipient, amount,
|
|
|
101
111
|
nonce
|
|
102
112
|
}
|
|
103
113
|
},
|
|
104
|
-
extensions: options.extensions
|
|
114
|
+
extensions: withBuilderCodeServiceCode(options.extensions)
|
|
105
115
|
};
|
|
106
116
|
return btoa(JSON.stringify(paymentData));
|
|
107
117
|
}
|
|
@@ -161,7 +171,7 @@ async function createSolanaPaymentPayload(secretKey, fromAddress, recipient, amo
|
|
|
161
171
|
payload: {
|
|
162
172
|
transaction: serializedTx
|
|
163
173
|
},
|
|
164
|
-
extensions: options.extensions
|
|
174
|
+
extensions: withBuilderCodeServiceCode(options.extensions)
|
|
165
175
|
};
|
|
166
176
|
return btoa(JSON.stringify(paymentData));
|
|
167
177
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockrun/llm",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "BlockRun SDK - Pay-per-request AI (LLM, Image, Video, Music, Voice) via x402 on Base and Solana",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
},
|
|
54
54
|
"optionalDependencies": {
|
|
55
55
|
"@anthropic-ai/sdk": "^0.39.0",
|
|
56
|
-
"@blockrun/clawrouter": "^0.12.190",
|
|
57
56
|
"@solana/spl-token": "^0.4.14",
|
|
58
57
|
"@solana/web3.js": "^1.98.4"
|
|
59
58
|
},
|
|
@@ -76,5 +75,13 @@
|
|
|
76
75
|
"engines": {
|
|
77
76
|
"node": ">=20"
|
|
78
77
|
},
|
|
79
|
-
"packageManager": "pnpm@9.15.4"
|
|
78
|
+
"packageManager": "pnpm@9.15.4",
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"@blockrun/clawrouter": "^0.12.222"
|
|
81
|
+
},
|
|
82
|
+
"peerDependenciesMeta": {
|
|
83
|
+
"@blockrun/clawrouter": {
|
|
84
|
+
"optional": true
|
|
85
|
+
}
|
|
86
|
+
}
|
|
80
87
|
}
|