diff --git a/.changeset/purple-shirts-judge.md b/.changeset/purple-shirts-judge.md new file mode 100644 index 0000000..677408a --- /dev/null +++ b/.changeset/purple-shirts-judge.md @@ -0,0 +1,5 @@ +--- +"@coinbasejs/commerce": patch +--- + +fix(commerce): update `Charge` type diff --git a/packages/commerce/src/charge.ts b/packages/commerce/src/charge.ts index da136eb..59bbaab 100644 --- a/packages/commerce/src/charge.ts +++ b/packages/commerce/src/charge.ts @@ -30,14 +30,16 @@ export async function getCharges(apiKey: string): Promise { }); } +export type ChargePricing = { + amount: string; + currency: string; +}; + export type CreateChargeParameters = { name: string; description: string; pricing_type: ChargePricingType; - local_price: { - amount: string; - currency: string; - }; + local_price: ChargePricing; }; export type CreateChargeResponse = { @@ -63,12 +65,8 @@ export type Charge = { brand_color: string; brand_logo_url: string; charge_kind: "WEB3"; - checkout: { - id: string; - }; code: string; collected_email: boolean; - confirmed_at: string; created_at: string; description: string; expires_at: string; @@ -81,14 +79,8 @@ export type Charge = { // TODO: check type payments: string[]; pricing: { - local: { - amount: string; - currency: string; - }; - settlement: { - amount: string; - currency: string; - }; + local: ChargePricing; + settlement: ChargePricing; }; pricing_type: ChargePricingType; pwcb_only: boolean; diff --git a/packages/commerce/src/index.ts b/packages/commerce/src/index.ts index 45b00e1..c7d9455 100644 --- a/packages/commerce/src/index.ts +++ b/packages/commerce/src/index.ts @@ -3,6 +3,7 @@ export type { Client, ClientConfig } from "./client"; export { createCharge, getCharge, getCharges } from "./charge"; export type { Charge, + ChargePricing, ChargePricingType, CreateChargeParameters, CreateChargeResponse,