@mysten-incubation/suipay-buyer 0.3.0-dev.6 → 0.3.0-dev.8

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.d.ts CHANGED
@@ -250,6 +250,16 @@ interface CreateDelegatedSignerResponse {
250
250
  method: string;
251
251
  idempotentReplay: boolean;
252
252
  grants: PreparedSessionTxKind[];
253
+ /**
254
+ * On a replay, grants whose create already executed. Finalize their digest;
255
+ * sponsoring them again could mint a second grant.
256
+ */
257
+ submitted?: SubmittedGrantCreate[];
258
+ }
259
+ interface SubmittedGrantCreate {
260
+ grantId: string;
261
+ asset: string;
262
+ digest: string;
253
263
  }
254
264
  interface FinalizeSessionResponse {
255
265
  delegatedSignerId: string;
@@ -1805,4 +1815,4 @@ interface VerifyPreparedSettlementInput {
1805
1815
  */
1806
1816
  declare function verifyPreparedPayment(input: VerifyPreparedSettlementInput): Promise<PreparedSettlement>;
1807
1817
 
1808
- export { type AccountApi, type AccountsApi, type AgentConnectionManifest, type AgentGrantBinding, type AgentProfile, type AgentSessionBinding, type AgentsApi, type AssetScopeInput, type BuyerAccount, type BuyerClient, type BuyerClientError, type BuyerClientOptions, type BuyerConnection, type BuyerPolicy, type BuyerResult, type CatalogApi, type CatalogService, type CreateAndActivateResult, type CreateDelegatedSignerInput, type CreateDelegatedSignerResponse, type CreatePolicyInput, type CreatePolicyResponse, type CreateProfileInput, type CreateProfileResponse, type DashboardBridgeResolvers, type DashboardConnectionManifest, type DelegatedSigner, type DelegatedSignerGrant, type DelegatedSignerGrantStatus, type DelegatedSignerSession, type DelegatedSignerStatus, type DelegatedSignersApi, ErrorCode, type ExecuteIntentKind, type ExecuteIntentResult, type FinalizeGrantResponse, type FinalizeIntentResult, type FinalizeSessionResponse, type FundHistoryItem, type GrantsApi, type ManifestError, type ManifestResult, NextAction, type PatchProfileInput, type PayInput, type PayResult, type Payer, type PayerOptions, type PaymentMethod, type PaymentReceipt, type PaymentRow, PaymentState, type PaymentStatusValue, type PaymentsApi, type PoliciesApi, type PolicyStatus, type PolicyTarget, type PrepareCreateGrantInput, type PrepareCreateSessionInput, type PreparedConsentGrant, type PreparedGrantTxKind, type PreparedIntent, type PreparedRevokeTxKind, type PreparedSessionTxKind, type ProfileStatus, type ProfilesApi, type ReceiptsApi, type RegistryApi, type RegistryService, type RevokeDelegatedSignerResponse, type ServiceRail, type ServicesApi, type SessionsApi, type SettlementRow, type SettlementsApi, type SpendAccount, type SpendAccountStatus, type SpendAccountsApi, type SponsoredTx, type TransactionSigner, type TrustSignal, createBuyer, createBuyerControlPlane, createMemoryLedger, createPayer, createReader, dashboardManifestToAgentManifest, manifestToSession, parseAgentManifest, personalMessageSigner, verifyPreparedPayment };
1818
+ export { type AccountApi, type AccountsApi, type AgentConnectionManifest, type AgentGrantBinding, type AgentProfile, type AgentSessionBinding, type AgentsApi, type AssetScopeInput, type BuyerAccount, type BuyerClient, type BuyerClientError, type BuyerClientOptions, type BuyerConnection, type BuyerPolicy, type BuyerResult, type CatalogApi, type CatalogService, type CreateAndActivateResult, type CreateDelegatedSignerInput, type CreateDelegatedSignerResponse, type CreatePolicyInput, type CreatePolicyResponse, type CreateProfileInput, type CreateProfileResponse, type DashboardBridgeResolvers, type DashboardConnectionManifest, type DelegatedSigner, type DelegatedSignerGrant, type DelegatedSignerGrantStatus, type DelegatedSignerSession, type DelegatedSignerStatus, type DelegatedSignersApi, ErrorCode, type ExecuteIntentKind, type ExecuteIntentResult, type FinalizeGrantResponse, type FinalizeIntentResult, type FinalizeSessionResponse, type FundHistoryItem, type GrantsApi, type ManifestError, type ManifestResult, NextAction, type PatchProfileInput, type PayInput, type PayResult, type Payer, type PayerOptions, type PaymentMethod, type PaymentReceipt, type PaymentRow, PaymentState, type PaymentStatusValue, type PaymentsApi, type PoliciesApi, type PolicyStatus, type PolicyTarget, type PrepareCreateGrantInput, type PrepareCreateSessionInput, type PreparedConsentGrant, type PreparedGrantTxKind, type PreparedIntent, type PreparedRevokeTxKind, type PreparedSessionTxKind, type ProfileStatus, type ProfilesApi, type ReceiptsApi, type RegistryApi, type RegistryService, type RevokeDelegatedSignerResponse, type ServiceRail, type ServicesApi, type SessionsApi, type SettlementRow, type SettlementsApi, type SpendAccount, type SpendAccountStatus, type SpendAccountsApi, type SponsoredTx, type SubmittedGrantCreate, type TransactionSigner, type TrustSignal, createBuyer, createBuyerControlPlane, createMemoryLedger, createPayer, createReader, dashboardManifestToAgentManifest, manifestToSession, parseAgentManifest, personalMessageSigner, verifyPreparedPayment };
package/dist/index.js CHANGED
@@ -1746,6 +1746,12 @@ function createAgentsApi(transport) {
1746
1746
  if (!created.ok)
1747
1747
  return created;
1748
1748
  const finalized = [];
1749
+ for (const submitted of created.value.submitted ?? []) {
1750
+ const fin = await finalizeGrant(created.value.delegatedSignerId, submitted.grantId, submitted.digest);
1751
+ if (!fin.ok)
1752
+ return fin;
1753
+ finalized.push(fin.value);
1754
+ }
1749
1755
  for (const grant of created.value.grants) {
1750
1756
  const scope = input.assetScopes.find((s) => s.asset.toLowerCase() === grant.asset.toLowerCase() || supportedAssetByCoinType(s.asset)?.id === grant.asset.toLowerCase());
1751
1757
  const coinType = TESTNET_ASSETS.find((a) => a.id === grant.asset.toLowerCase() || a.symbol.toLowerCase() === grant.asset.toLowerCase())?.coinType ?? scope?.asset ?? grant.asset;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mysten-incubation/suipay-buyer",
3
- "version": "0.3.0-dev.6",
3
+ "version": "0.3.0-dev.8",
4
4
  "type": "module",
5
5
  "description": "SuiPay buyer SDK — delegated spend-account pay plus a typed /v1 control-plane client.",
6
6
  "license": "MIT",
@@ -40,8 +40,8 @@
40
40
  "tsup": "^8.0.0",
41
41
  "typescript": "^6.0.3",
42
42
  "vitest": "^4.1.10",
43
- "@cmdoss/suipay-core": "0.1.0",
44
- "@cmdoss/suipay-sdk": "0.1.0"
43
+ "@cmdoss/suipay-sdk": "0.1.0",
44
+ "@cmdoss/suipay-core": "0.1.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsup",