@owney/sdk 0.7.25-beta.11 → 0.7.25-beta.12
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 +1 -1
- package/dist/index.cjs +17 -2
- package/dist/index.js +17 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,7 +171,7 @@ await sdk.activateAgent(42161);
|
|
|
171
171
|
|
|
172
172
|
### `deposit(options)`
|
|
173
173
|
|
|
174
|
-
Deposit funds into a specific agent, or split equally across all agents if `agentId` is omitted. Validates that the asset is supported by the target agent(s) on the active chain, and per-agent minimum deposit amounts (defined per chain+asset on `agent.supportedAssets[].assets[].minDepositAmount`) are taken into account. Custom `depositCallback` implementations run once per final valid agent. The default Permit2 flow signs one recipient-bound batch authorization for every agent share. On the first Base USDC deposit, the SDK first requests an ERC-2612 signature
|
|
174
|
+
Deposit funds into a specific agent, or split equally across all agents if `agentId` is omitted. Validates that the asset is supported by the target agent(s) on the active chain, and per-agent minimum deposit amounts (defined per chain+asset on `agent.supportedAssets[].assets[].minDepositAmount`) are taken into account. Custom `depositCallback` implementations run once per final valid agent. The default Permit2 flow signs one recipient-bound batch authorization for every agent share. On the first Base USDC deposit, the SDK first requests an ERC-2612 signature; the relayer then submits the Permit2 approval and deposit as two sponsored transactions. Later deposits need only the batch signature.
|
|
175
175
|
|
|
176
176
|
| Param | Type | Description |
|
|
177
177
|
| ------------------------- | -------------------- | --------------------------------------------------------------- |
|
package/dist/index.cjs
CHANGED
|
@@ -5256,7 +5256,6 @@ var import_viem11 = require("viem");
|
|
|
5256
5256
|
var import_viem10 = require("viem");
|
|
5257
5257
|
var BATCH_PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
5258
5258
|
var BASE_USDC_ADDRESS = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
5259
|
-
var MULTICALL3_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
5260
5259
|
var ERC2612_PERMIT_TYPES = {
|
|
5261
5260
|
Permit: [
|
|
5262
5261
|
{ name: "owner", type: "address" },
|
|
@@ -5388,6 +5387,22 @@ async function execute(i, key2, plan) {
|
|
|
5388
5387
|
let body = initial;
|
|
5389
5388
|
save(key2, body);
|
|
5390
5389
|
try {
|
|
5390
|
+
if (body.erc2612Permit && !body.serializedPermitTransaction) {
|
|
5391
|
+
const preparedPermit = await postSponsorBatchTransfer({
|
|
5392
|
+
apiKey: i.apiKey,
|
|
5393
|
+
baseUrl: i.baseUrl,
|
|
5394
|
+
body
|
|
5395
|
+
});
|
|
5396
|
+
if (!preparedPermit.serializedPermitTransaction || !preparedPermit.permitTxHash || (0, import_viem11.keccak256)(preparedPermit.serializedPermitTransaction) !== preparedPermit.permitTxHash)
|
|
5397
|
+
throw new Error(
|
|
5398
|
+
"Sponsorship API did not return a valid prepared permit transaction."
|
|
5399
|
+
);
|
|
5400
|
+
body = {
|
|
5401
|
+
...body,
|
|
5402
|
+
serializedPermitTransaction: preparedPermit.serializedPermitTransaction
|
|
5403
|
+
};
|
|
5404
|
+
save(key2, body);
|
|
5405
|
+
}
|
|
5391
5406
|
if (!body.serializedTransaction) {
|
|
5392
5407
|
const prepared = await postSponsorBatchTransfer({
|
|
5393
5408
|
apiKey: i.apiKey,
|
|
@@ -5489,7 +5504,7 @@ async function execute(i, key2, plan) {
|
|
|
5489
5504
|
});
|
|
5490
5505
|
erc2612Permit = { ...unsignedPermit, signature: signature2 };
|
|
5491
5506
|
}
|
|
5492
|
-
const spender =
|
|
5507
|
+
const spender = await getSponsorRelayerAddress({
|
|
5493
5508
|
apiKey: i.apiKey,
|
|
5494
5509
|
baseUrl: i.baseUrl,
|
|
5495
5510
|
chainId: i.chainId
|
package/dist/index.js
CHANGED
|
@@ -5246,7 +5246,6 @@ import {
|
|
|
5246
5246
|
import { parseAbi as parseAbi3, hashStruct } from "viem";
|
|
5247
5247
|
var BATCH_PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
5248
5248
|
var BASE_USDC_ADDRESS = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
5249
|
-
var MULTICALL3_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
5250
5249
|
var ERC2612_PERMIT_TYPES = {
|
|
5251
5250
|
Permit: [
|
|
5252
5251
|
{ name: "owner", type: "address" },
|
|
@@ -5378,6 +5377,22 @@ async function execute(i, key2, plan) {
|
|
|
5378
5377
|
let body = initial;
|
|
5379
5378
|
save(key2, body);
|
|
5380
5379
|
try {
|
|
5380
|
+
if (body.erc2612Permit && !body.serializedPermitTransaction) {
|
|
5381
|
+
const preparedPermit = await postSponsorBatchTransfer({
|
|
5382
|
+
apiKey: i.apiKey,
|
|
5383
|
+
baseUrl: i.baseUrl,
|
|
5384
|
+
body
|
|
5385
|
+
});
|
|
5386
|
+
if (!preparedPermit.serializedPermitTransaction || !preparedPermit.permitTxHash || keccak256(preparedPermit.serializedPermitTransaction) !== preparedPermit.permitTxHash)
|
|
5387
|
+
throw new Error(
|
|
5388
|
+
"Sponsorship API did not return a valid prepared permit transaction."
|
|
5389
|
+
);
|
|
5390
|
+
body = {
|
|
5391
|
+
...body,
|
|
5392
|
+
serializedPermitTransaction: preparedPermit.serializedPermitTransaction
|
|
5393
|
+
};
|
|
5394
|
+
save(key2, body);
|
|
5395
|
+
}
|
|
5381
5396
|
if (!body.serializedTransaction) {
|
|
5382
5397
|
const prepared = await postSponsorBatchTransfer({
|
|
5383
5398
|
apiKey: i.apiKey,
|
|
@@ -5479,7 +5494,7 @@ async function execute(i, key2, plan) {
|
|
|
5479
5494
|
});
|
|
5480
5495
|
erc2612Permit = { ...unsignedPermit, signature: signature2 };
|
|
5481
5496
|
}
|
|
5482
|
-
const spender =
|
|
5497
|
+
const spender = await getSponsorRelayerAddress({
|
|
5483
5498
|
apiKey: i.apiKey,
|
|
5484
5499
|
baseUrl: i.baseUrl,
|
|
5485
5500
|
chainId: i.chainId
|