Skip to content

Commit c2ae6db

Browse files
feat(api): api update
1 parent 0884d3d commit c2ae6db

3 files changed

Lines changed: 94 additions & 20 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 67
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/privy/privy-api-client-e9cdfaa13a8e1ec55ac18519aefd59d1377dd2080d9aa3a57b2e7ba7524f5c5b.yml
3-
openapi_spec_hash: fc6e32c9db9cd6b2555aea9d5047a616
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/privy/privy-api-client-1fb83ffdf4334d0d4d2dd2ac825bd0854a981e40d36044b1cc13a22cf23d8150.yml
3+
openapi_spec_hash: ad1ac458726ce47675b6b6cb343560f1
44
config_hash: 7c799aff73109967296d1f07433e90aa

swap.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,15 @@ type SwapQuoteResponse struct {
123123
MinimumOutputAmount string `json:"minimum_output_amount" api:"required"`
124124
// Token address being bought.
125125
OutputToken string `json:"output_token" api:"required"`
126-
// Destination chain CAIP-2 identifier for cross-chain swaps.
126+
// Destination chain CAIP-2 identifier for cross-chain swaps. Only present for
127+
// cross-chain swaps.
127128
DestinationCaip2 string `json:"destination_caip2"`
128129
// Estimated fees for the swap. Only present for cross-chain swaps.
129130
EstimatedFees []FeeLineItemUnion `json:"estimated_fees"`
130131
// Gas cost for a blockchain action. Includes both raw base-unit amount and a
131132
// human-readable decimal string, plus the gas token symbol.
132133
EstimatedGas Gas `json:"estimated_gas"`
133-
// Quote expiry as Unix timestamp (seconds). Present for cross-chain quotes.
134+
// Quote expiry as Unix timestamp (seconds). Only present for cross-chain quotes.
134135
ExpiresAt float64 `json:"expires_at"`
135136
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
136137
JSON struct {

walletaction.go

Lines changed: 89 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -582,18 +582,20 @@ type SwapActionResponse struct {
582582
WalletID string `json:"wallet_id" api:"required"`
583583
// Destination chain CAIP-2 identifier. Present for cross-chain swaps.
584584
DestinationCaip2 string `json:"destination_caip2"`
585-
// Estimated fee breakdown from the provider quote.
586-
EstimatedFees []FeeLineItemUnion `json:"estimated_fees"`
585+
// Estimated fee breakdown from the provider quote. Only present for cross-chain
586+
// swaps. Populated after on-chain confirmation.
587+
EstimatedFees []FeeLineItemUnion `json:"estimated_fees" api:"nullable"`
587588
// Gas cost for a blockchain action. Includes both raw base-unit amount and a
588589
// human-readable decimal string, plus the gas token symbol.
589-
EstimatedGas Gas `json:"estimated_gas"`
590+
EstimatedGas SwapActionResponseEstimatedGas `json:"estimated_gas"`
590591
// A description of why a wallet action (or a step within a wallet action) failed.
591592
FailureReason FailureReason `json:"failure_reason"`
592-
// Actual fees paid for the swap. Populated after on-chain confirmation.
593-
Fees []FeeLineItemUnion `json:"fees"`
593+
// Actual fees paid for the swap. Populated after on-chain confirmation. Only
594+
// present for cross-chain swaps.
595+
Fees []FeeLineItemUnion `json:"fees" api:"nullable"`
594596
// Gas cost for a blockchain action. Includes both raw base-unit amount and a
595597
// human-readable decimal string, plus the gas token symbol.
596-
Gas Gas `json:"gas"`
598+
Gas SwapActionResponseGas `json:"gas"`
597599
// The steps of the wallet action. Only returned if `?include=steps` is provided.
598600
Steps []WalletActionStepUnion `json:"steps"`
599601
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -632,6 +634,40 @@ const (
632634
SwapActionResponseTypeSwap SwapActionResponseType = "swap"
633635
)
634636

637+
// Gas cost for a blockchain action. Includes both raw base-unit amount and a
638+
// human-readable decimal string, plus the gas token symbol.
639+
type SwapActionResponseEstimatedGas struct {
640+
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
641+
JSON struct {
642+
ExtraFields map[string]respjson.Field
643+
raw string
644+
} `json:"-"`
645+
Gas
646+
}
647+
648+
// Returns the unmodified JSON received from the API
649+
func (r SwapActionResponseEstimatedGas) RawJSON() string { return r.JSON.raw }
650+
func (r *SwapActionResponseEstimatedGas) UnmarshalJSON(data []byte) error {
651+
return apijson.UnmarshalRoot(data, r)
652+
}
653+
654+
// Gas cost for a blockchain action. Includes both raw base-unit amount and a
655+
// human-readable decimal string, plus the gas token symbol.
656+
type SwapActionResponseGas struct {
657+
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
658+
JSON struct {
659+
ExtraFields map[string]respjson.Field
660+
raw string
661+
} `json:"-"`
662+
Gas
663+
}
664+
665+
// Returns the unmodified JSON received from the API
666+
func (r SwapActionResponseGas) RawJSON() string { return r.JSON.raw }
667+
func (r *SwapActionResponseGas) UnmarshalJSON(data []byte) error {
668+
return apijson.UnmarshalRoot(data, r)
669+
}
670+
635671
// Response for a transfer action.
636672
type TransferActionResponse struct {
637673
// The ID of the wallet action.
@@ -640,6 +676,10 @@ type TransferActionResponse struct {
640676
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
641677
// Recipient address.
642678
DestinationAddress string `json:"destination_address" api:"required"`
679+
// Amount received on the destination chain. Set at creation for same-chain
680+
// transfers. Null until fill confirmation for cross-chain or cross-asset
681+
// transfers.
682+
DestinationAmount string `json:"destination_amount" api:"required"`
643683
// Chain name (e.g. "base", "ethereum").
644684
SourceChain string `json:"source_chain" api:"required"`
645685
// Status of a wallet action.
@@ -650,25 +690,24 @@ type TransferActionResponse struct {
650690
Type TransferActionResponseType `json:"type" api:"required"`
651691
// The ID of the wallet involved in the action.
652692
WalletID string `json:"wallet_id" api:"required"`
653-
// Amount received on the destination chain. Populated immediately for exact_output
654-
// transfers, or after fill confirmation for exact_input transfers.
655-
DestinationAmount string `json:"destination_amount"`
656693
// Destination asset for cross-asset transfers. Omitted for same-asset transfers.
657694
DestinationAsset string `json:"destination_asset"`
658695
// Destination chain for cross-chain transfers. Omitted for same-chain transfers.
659696
DestinationChain string `json:"destination_chain"`
660-
// Estimated fee breakdown from the provider quote.
661-
EstimatedFees []FeeLineItemUnion `json:"estimated_fees"`
697+
// Estimated fee breakdown from the provider quote. Only present for cross-chain or
698+
// cross-asset transfers. Populated after on-chain confirmation.
699+
EstimatedFees []FeeLineItemUnion `json:"estimated_fees" api:"nullable"`
662700
// Gas cost for a blockchain action. Includes both raw base-unit amount and a
663701
// human-readable decimal string, plus the gas token symbol.
664-
EstimatedGas Gas `json:"estimated_gas"`
702+
EstimatedGas TransferActionResponseEstimatedGas `json:"estimated_gas"`
665703
// A description of why a wallet action (or a step within a wallet action) failed.
666704
FailureReason FailureReason `json:"failure_reason"`
667-
// Actual fees paid for the transfer. Populated after on-chain confirmation.
668-
Fees []FeeLineItemUnion `json:"fees"`
705+
// Actual fees paid for the transfer. Populated after on-chain confirmation. Only
706+
// present for cross-chain transfers.
707+
Fees []FeeLineItemUnion `json:"fees" api:"nullable"`
669708
// Gas cost for a blockchain action. Includes both raw base-unit amount and a
670709
// human-readable decimal string, plus the gas token symbol.
671-
Gas Gas `json:"gas"`
710+
Gas TransferActionResponseGas `json:"gas"`
672711
// Decimal amount sent on the source chain (e.g. "1.5"). Omitted for exact_output
673712
// cross-chain transfers until the source amount is determined.
674713
SourceAmount string `json:"source_amount"`
@@ -688,11 +727,11 @@ type TransferActionResponse struct {
688727
ID respjson.Field
689728
CreatedAt respjson.Field
690729
DestinationAddress respjson.Field
730+
DestinationAmount respjson.Field
691731
SourceChain respjson.Field
692732
Status respjson.Field
693733
Type respjson.Field
694734
WalletID respjson.Field
695-
DestinationAmount respjson.Field
696735
DestinationAsset respjson.Field
697736
DestinationChain respjson.Field
698737
EstimatedFees respjson.Field
@@ -722,6 +761,40 @@ const (
722761
TransferActionResponseTypeTransfer TransferActionResponseType = "transfer"
723762
)
724763

764+
// Gas cost for a blockchain action. Includes both raw base-unit amount and a
765+
// human-readable decimal string, plus the gas token symbol.
766+
type TransferActionResponseEstimatedGas struct {
767+
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
768+
JSON struct {
769+
ExtraFields map[string]respjson.Field
770+
raw string
771+
} `json:"-"`
772+
Gas
773+
}
774+
775+
// Returns the unmodified JSON received from the API
776+
func (r TransferActionResponseEstimatedGas) RawJSON() string { return r.JSON.raw }
777+
func (r *TransferActionResponseEstimatedGas) UnmarshalJSON(data []byte) error {
778+
return apijson.UnmarshalRoot(data, r)
779+
}
780+
781+
// Gas cost for a blockchain action. Includes both raw base-unit amount and a
782+
// human-readable decimal string, plus the gas token symbol.
783+
type TransferActionResponseGas struct {
784+
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
785+
JSON struct {
786+
ExtraFields map[string]respjson.Field
787+
raw string
788+
} `json:"-"`
789+
Gas
790+
}
791+
792+
// Returns the unmodified JSON received from the API
793+
func (r TransferActionResponseGas) RawJSON() string { return r.JSON.raw }
794+
func (r *TransferActionResponseGas) UnmarshalJSON(data []byte) error {
795+
return apijson.UnmarshalRoot(data, r)
796+
}
797+
725798
// Status of a wallet action.
726799
type WalletActionStatus string
727800

0 commit comments

Comments
 (0)