@chipi-stack/backend 14.14.0 → 14.15.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/{client-CqD_yGH0.d.mts → client-D6SDBu5p.d.mts} +3 -1
- package/dist/{client-CqD_yGH0.d.ts → client-D6SDBu5p.d.ts} +3 -1
- package/dist/index.d.mts +35 -6
- package/dist/index.d.ts +35 -6
- package/dist/index.js +321 -127
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +321 -127
- package/dist/index.mjs.map +1 -1
- package/dist/skuPurchases.d.mts +1 -1
- package/dist/skuPurchases.d.ts +1 -1
- package/dist/skus.d.mts +1 -1
- package/dist/skus.d.ts +1 -1
- package/dist/transactions.d.mts +1 -1
- package/dist/transactions.d.ts +1 -1
- package/dist/{wallets-DxKnh21Q.d.ts → wallets-C541u9mn.d.ts} +1 -1
- package/dist/{wallets-CYCLyyXY.d.mts → wallets-CX42j3eN.d.mts} +1 -1
- package/dist/wallets.d.mts +2 -2
- package/dist/wallets.d.ts +2 -2
- package/package.json +3 -3
|
@@ -26,10 +26,12 @@ declare class ChipiClient {
|
|
|
26
26
|
params?: Record<string, any>;
|
|
27
27
|
bearerToken?: string;
|
|
28
28
|
}): Promise<T>;
|
|
29
|
-
post<T>({ endpoint, bearerToken, body, }: {
|
|
29
|
+
post<T>({ endpoint, bearerToken, body, headers, }: {
|
|
30
30
|
endpoint: string;
|
|
31
31
|
bearerToken: string;
|
|
32
32
|
body?: Record<string, any>;
|
|
33
|
+
/** Extra request headers, e.g. `X-PAYMENT`. Cannot override auth or content type. */
|
|
34
|
+
headers?: Record<string, string>;
|
|
33
35
|
}): Promise<T>;
|
|
34
36
|
put<T>({ endpoint, bearerToken, body, }: {
|
|
35
37
|
endpoint: string;
|
|
@@ -26,10 +26,12 @@ declare class ChipiClient {
|
|
|
26
26
|
params?: Record<string, any>;
|
|
27
27
|
bearerToken?: string;
|
|
28
28
|
}): Promise<T>;
|
|
29
|
-
post<T>({ endpoint, bearerToken, body, }: {
|
|
29
|
+
post<T>({ endpoint, bearerToken, body, headers, }: {
|
|
30
30
|
endpoint: string;
|
|
31
31
|
bearerToken: string;
|
|
32
32
|
body?: Record<string, any>;
|
|
33
|
+
/** Extra request headers, e.g. `X-PAYMENT`. Cannot override auth or content type. */
|
|
34
|
+
headers?: Record<string, string>;
|
|
33
35
|
}): Promise<T>;
|
|
34
36
|
put<T>({ endpoint, bearerToken, body, }: {
|
|
35
37
|
endpoint: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as _chipi_stack_types from '@chipi-stack/types';
|
|
2
|
-
import { CreateSessionKeyParams, SessionKeyData, AddSessionKeyParams, SetupSessionParams, RevokeSessionKeyParams, GetSessionDataParams, SessionDataResponse, ExecuteWithSessionParams, SetSpendingPolicyParams, GetSpendingPolicyParams, SpendingPolicyData, RemoveSpendingPolicyParams, Currency, AiSignalsParams, AiSignals, ThinkParams, ThinkResponse, AiExecuteParams, AiExecuteResponse, AiChatParams, AiChatResponse, AiPricesParams, AiPrices, AiModelsResponse, ThinkDecision, PaymasterAdapter, PaymasterAccount, X402FacilitatorConfig, NonceStore, PaymentPayload, VerifyResponse, SettleResponse, ChipiSDKConfig, ExecuteTransactionParams, SignTypedDataParams, SignTypedDataResult, TransferParams, ApproveParams, CallAnyContractParams, CreateWalletParams, CreateWalletResponse, RecordSendTransactionParams, Transaction, GetTransactionListQuery, PaginatedResponse, GetWalletParams, GetTokenBalanceParams, GetTokenBalanceResponse, CreateSkuPurchaseParams, GetSkuListQuery, Sku, TransactionStatusResponse, PrepareWalletUpgradeParams, PrepareWalletUpgradeResponse, ExecuteWalletUpgradeParams, ExecuteWalletUpgradeResponse, ChipiServerSDKConfig, ChipiBrowserSDKConfig, SessionConfig, Call as Call$1, SpendingPolicyConfig, X402ClientConfig, PaymentRequirement, X402PaymentConfig, ShhhSignerKind } from '@chipi-stack/types';
|
|
2
|
+
import { CreateSessionKeyParams, SessionKeyData, AddSessionKeyParams, SetupSessionParams, RevokeSessionKeyParams, GetSessionDataParams, SessionDataResponse, ExecuteWithSessionParams, SetSpendingPolicyParams, GetSpendingPolicyParams, SpendingPolicyData, RemoveSpendingPolicyParams, Currency, AiSignalsParams, AiSignals, ThinkParams, ThinkOptions, ThinkResponse, AiExecuteParams, AiExecuteResponse, AiChatParams, AiChatResponse, AiPricesParams, AiPrices, AiModelsResponse, ThinkDecision, PaymasterAdapter, PaymasterAccount, X402FacilitatorConfig, NonceStore, PaymentPayload, VerifyResponse, SettleResponse, ChipiSDKConfig, ExecuteTransactionParams, SignTypedDataParams, SignTypedDataResult, TransferParams, ApproveParams, CallAnyContractParams, CreateWalletParams, CreateWalletResponse, RecordSendTransactionParams, Transaction, GetTransactionListQuery, PaginatedResponse, GetWalletParams, GetTokenBalanceParams, GetTokenBalanceResponse, CreateSkuPurchaseParams, GetSkuListQuery, Sku, TransactionStatusResponse, PrepareWalletUpgradeParams, PrepareWalletUpgradeResponse, ExecuteWalletUpgradeParams, ExecuteWalletUpgradeResponse, ChipiServerSDKConfig, ChipiBrowserSDKConfig, SessionConfig, Call as Call$1, SpendingPolicyConfig, X402ClientConfig, PaymentRequirement, X402PaymentConfig, ShhhSignerKind } from '@chipi-stack/types';
|
|
3
3
|
export * from '@chipi-stack/types';
|
|
4
4
|
export { Chain, ChainToken, Currency } from '@chipi-stack/types';
|
|
5
|
-
import { C as ChipiWallets } from './wallets-
|
|
6
|
-
export { E as ExecuteMigrateResponse, M as MigrateChipiWalletToShhhParams, a as MigrationOutcome, P as PrepareMigrateResponse, m as migrateChipiWalletToShhh } from './wallets-
|
|
5
|
+
import { C as ChipiWallets } from './wallets-CX42j3eN.mjs';
|
|
6
|
+
export { E as ExecuteMigrateResponse, M as MigrateChipiWalletToShhhParams, a as MigrationOutcome, P as PrepareMigrateResponse, m as migrateChipiWalletToShhh } from './wallets-CX42j3eN.mjs';
|
|
7
7
|
import { ChipiTransactions } from './transactions.mjs';
|
|
8
8
|
import { ChipiSkuPurchases } from './skuPurchases.mjs';
|
|
9
9
|
import { ChipiSkus } from './skus.mjs';
|
|
10
|
-
import { C as ChipiClient } from './client-
|
|
10
|
+
import { C as ChipiClient } from './client-D6SDBu5p.mjs';
|
|
11
11
|
import { Call, ProviderInterface, Account } from 'starknet';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -626,7 +626,11 @@ declare function isThinkDecision(decision: unknown): decision is ThinkDecision;
|
|
|
626
626
|
declare class ChipiAi {
|
|
627
627
|
private client;
|
|
628
628
|
private apiSecretKey?;
|
|
629
|
-
|
|
629
|
+
/** Needed only to pay think calls with `payWithSession`. */
|
|
630
|
+
private sessions?;
|
|
631
|
+
constructor(client: ChipiClient, apiSecretKey?: string | undefined,
|
|
632
|
+
/** Needed only to pay think calls with `payWithSession`. */
|
|
633
|
+
sessions?: ChipiSessions | undefined);
|
|
630
634
|
private secret;
|
|
631
635
|
/**
|
|
632
636
|
* `GET /v1/ai/signals`: technical signals per token, market sentiment and
|
|
@@ -639,8 +643,33 @@ declare class ChipiAi {
|
|
|
639
643
|
*
|
|
640
644
|
* The decision is advice, not an order: check it with `isThinkDecision` and
|
|
641
645
|
* enforce your own limits before executing anything.
|
|
646
|
+
*
|
|
647
|
+
* **Paying per call (x402).** With `payWithSession`, a 402 that carries a
|
|
648
|
+
* session-transfer offer (credits short, x402 on) is paid with the agent's
|
|
649
|
+
* session key: a USDC `transfer` to the offer's `payTo`, then the same call
|
|
650
|
+
* again with `X-PAYMENT`. The price must be at most `maxAmount`, `model`
|
|
651
|
+
* must be payable and the input within `maxPromptBytes`, all checked before
|
|
652
|
+
* paying. The session must whitelist `transfer` and cap USDC. A payment
|
|
653
|
+
* that was made but not served is reported in `error.details.xPayment`;
|
|
654
|
+
* pass it back as `options.xPayment` to retry without paying again.
|
|
655
|
+
*
|
|
656
|
+
* @example
|
|
657
|
+
* ```typescript
|
|
658
|
+
* const res = await sdk.ai.think(
|
|
659
|
+
* { portfolio, model: "haiku" },
|
|
660
|
+
* { payWithSession: { encryptKey, wallet, session, maxAmount: 20_000n } } // $0.02 at most
|
|
661
|
+
* );
|
|
662
|
+
* res.x402Payment; // set when the call was paid over x402
|
|
663
|
+
* ```
|
|
664
|
+
*/
|
|
665
|
+
think(params: ThinkParams, options?: ThinkOptions): Promise<ThinkResponse>;
|
|
666
|
+
private postThink;
|
|
667
|
+
/**
|
|
668
|
+
* Pay one think call with a session-key USDC transfer, then send it again
|
|
669
|
+
* with `X-PAYMENT`. Every check that can refuse the call runs before the
|
|
670
|
+
* transfer; the transfer counts only once its receipt shows the USDC moved.
|
|
642
671
|
*/
|
|
643
|
-
|
|
672
|
+
private payAndThink;
|
|
644
673
|
/**
|
|
645
674
|
* `POST /v1/ai/execute`: unsigned AVNU swap calls (approve + swap) for
|
|
646
675
|
* `walletAddress`. Nothing is submitted; sign the calls with a session key
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as _chipi_stack_types from '@chipi-stack/types';
|
|
2
|
-
import { CreateSessionKeyParams, SessionKeyData, AddSessionKeyParams, SetupSessionParams, RevokeSessionKeyParams, GetSessionDataParams, SessionDataResponse, ExecuteWithSessionParams, SetSpendingPolicyParams, GetSpendingPolicyParams, SpendingPolicyData, RemoveSpendingPolicyParams, Currency, AiSignalsParams, AiSignals, ThinkParams, ThinkResponse, AiExecuteParams, AiExecuteResponse, AiChatParams, AiChatResponse, AiPricesParams, AiPrices, AiModelsResponse, ThinkDecision, PaymasterAdapter, PaymasterAccount, X402FacilitatorConfig, NonceStore, PaymentPayload, VerifyResponse, SettleResponse, ChipiSDKConfig, ExecuteTransactionParams, SignTypedDataParams, SignTypedDataResult, TransferParams, ApproveParams, CallAnyContractParams, CreateWalletParams, CreateWalletResponse, RecordSendTransactionParams, Transaction, GetTransactionListQuery, PaginatedResponse, GetWalletParams, GetTokenBalanceParams, GetTokenBalanceResponse, CreateSkuPurchaseParams, GetSkuListQuery, Sku, TransactionStatusResponse, PrepareWalletUpgradeParams, PrepareWalletUpgradeResponse, ExecuteWalletUpgradeParams, ExecuteWalletUpgradeResponse, ChipiServerSDKConfig, ChipiBrowserSDKConfig, SessionConfig, Call as Call$1, SpendingPolicyConfig, X402ClientConfig, PaymentRequirement, X402PaymentConfig, ShhhSignerKind } from '@chipi-stack/types';
|
|
2
|
+
import { CreateSessionKeyParams, SessionKeyData, AddSessionKeyParams, SetupSessionParams, RevokeSessionKeyParams, GetSessionDataParams, SessionDataResponse, ExecuteWithSessionParams, SetSpendingPolicyParams, GetSpendingPolicyParams, SpendingPolicyData, RemoveSpendingPolicyParams, Currency, AiSignalsParams, AiSignals, ThinkParams, ThinkOptions, ThinkResponse, AiExecuteParams, AiExecuteResponse, AiChatParams, AiChatResponse, AiPricesParams, AiPrices, AiModelsResponse, ThinkDecision, PaymasterAdapter, PaymasterAccount, X402FacilitatorConfig, NonceStore, PaymentPayload, VerifyResponse, SettleResponse, ChipiSDKConfig, ExecuteTransactionParams, SignTypedDataParams, SignTypedDataResult, TransferParams, ApproveParams, CallAnyContractParams, CreateWalletParams, CreateWalletResponse, RecordSendTransactionParams, Transaction, GetTransactionListQuery, PaginatedResponse, GetWalletParams, GetTokenBalanceParams, GetTokenBalanceResponse, CreateSkuPurchaseParams, GetSkuListQuery, Sku, TransactionStatusResponse, PrepareWalletUpgradeParams, PrepareWalletUpgradeResponse, ExecuteWalletUpgradeParams, ExecuteWalletUpgradeResponse, ChipiServerSDKConfig, ChipiBrowserSDKConfig, SessionConfig, Call as Call$1, SpendingPolicyConfig, X402ClientConfig, PaymentRequirement, X402PaymentConfig, ShhhSignerKind } from '@chipi-stack/types';
|
|
3
3
|
export * from '@chipi-stack/types';
|
|
4
4
|
export { Chain, ChainToken, Currency } from '@chipi-stack/types';
|
|
5
|
-
import { C as ChipiWallets } from './wallets-
|
|
6
|
-
export { E as ExecuteMigrateResponse, M as MigrateChipiWalletToShhhParams, a as MigrationOutcome, P as PrepareMigrateResponse, m as migrateChipiWalletToShhh } from './wallets-
|
|
5
|
+
import { C as ChipiWallets } from './wallets-C541u9mn.js';
|
|
6
|
+
export { E as ExecuteMigrateResponse, M as MigrateChipiWalletToShhhParams, a as MigrationOutcome, P as PrepareMigrateResponse, m as migrateChipiWalletToShhh } from './wallets-C541u9mn.js';
|
|
7
7
|
import { ChipiTransactions } from './transactions.js';
|
|
8
8
|
import { ChipiSkuPurchases } from './skuPurchases.js';
|
|
9
9
|
import { ChipiSkus } from './skus.js';
|
|
10
|
-
import { C as ChipiClient } from './client-
|
|
10
|
+
import { C as ChipiClient } from './client-D6SDBu5p.js';
|
|
11
11
|
import { Call, ProviderInterface, Account } from 'starknet';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -626,7 +626,11 @@ declare function isThinkDecision(decision: unknown): decision is ThinkDecision;
|
|
|
626
626
|
declare class ChipiAi {
|
|
627
627
|
private client;
|
|
628
628
|
private apiSecretKey?;
|
|
629
|
-
|
|
629
|
+
/** Needed only to pay think calls with `payWithSession`. */
|
|
630
|
+
private sessions?;
|
|
631
|
+
constructor(client: ChipiClient, apiSecretKey?: string | undefined,
|
|
632
|
+
/** Needed only to pay think calls with `payWithSession`. */
|
|
633
|
+
sessions?: ChipiSessions | undefined);
|
|
630
634
|
private secret;
|
|
631
635
|
/**
|
|
632
636
|
* `GET /v1/ai/signals`: technical signals per token, market sentiment and
|
|
@@ -639,8 +643,33 @@ declare class ChipiAi {
|
|
|
639
643
|
*
|
|
640
644
|
* The decision is advice, not an order: check it with `isThinkDecision` and
|
|
641
645
|
* enforce your own limits before executing anything.
|
|
646
|
+
*
|
|
647
|
+
* **Paying per call (x402).** With `payWithSession`, a 402 that carries a
|
|
648
|
+
* session-transfer offer (credits short, x402 on) is paid with the agent's
|
|
649
|
+
* session key: a USDC `transfer` to the offer's `payTo`, then the same call
|
|
650
|
+
* again with `X-PAYMENT`. The price must be at most `maxAmount`, `model`
|
|
651
|
+
* must be payable and the input within `maxPromptBytes`, all checked before
|
|
652
|
+
* paying. The session must whitelist `transfer` and cap USDC. A payment
|
|
653
|
+
* that was made but not served is reported in `error.details.xPayment`;
|
|
654
|
+
* pass it back as `options.xPayment` to retry without paying again.
|
|
655
|
+
*
|
|
656
|
+
* @example
|
|
657
|
+
* ```typescript
|
|
658
|
+
* const res = await sdk.ai.think(
|
|
659
|
+
* { portfolio, model: "haiku" },
|
|
660
|
+
* { payWithSession: { encryptKey, wallet, session, maxAmount: 20_000n } } // $0.02 at most
|
|
661
|
+
* );
|
|
662
|
+
* res.x402Payment; // set when the call was paid over x402
|
|
663
|
+
* ```
|
|
664
|
+
*/
|
|
665
|
+
think(params: ThinkParams, options?: ThinkOptions): Promise<ThinkResponse>;
|
|
666
|
+
private postThink;
|
|
667
|
+
/**
|
|
668
|
+
* Pay one think call with a session-key USDC transfer, then send it again
|
|
669
|
+
* with `X-PAYMENT`. Every check that can refuse the call runs before the
|
|
670
|
+
* transfer; the transfer counts only once its receipt shows the USDC moved.
|
|
642
671
|
*/
|
|
643
|
-
|
|
672
|
+
private payAndThink;
|
|
644
673
|
/**
|
|
645
674
|
* `POST /v1/ai/execute`: unsigned AVNU swap calls (approve + swap) for
|
|
646
675
|
* `walletAddress`. Nothing is submitted; sign the calls with a session key
|