@coinbase/cdp-sdk 1.9.0 → 1.11.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.
Files changed (141) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +28 -0
  3. package/_cjs/accounts/evm/toEvmServerAccount.js +18 -0
  4. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
  5. package/_cjs/accounts/evm/toEvmSmartAccount.js +18 -0
  6. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
  7. package/_cjs/actions/evm/fund/Quote.js +63 -0
  8. package/_cjs/actions/evm/fund/Quote.js.map +1 -0
  9. package/_cjs/actions/evm/fund/fund.js +49 -0
  10. package/_cjs/actions/evm/fund/fund.js.map +1 -0
  11. package/_cjs/actions/evm/fund/quoteFund.js +46 -0
  12. package/_cjs/actions/evm/fund/quoteFund.js.map +1 -0
  13. package/_cjs/actions/evm/fund/types.js +3 -0
  14. package/_cjs/actions/evm/fund/types.js.map +1 -0
  15. package/_cjs/actions/evm/fund/waitForFundOperationReceipt.js +64 -0
  16. package/_cjs/actions/evm/fund/waitForFundOperationReceipt.js.map +1 -0
  17. package/_cjs/client/evm/constants.js +21 -0
  18. package/_cjs/client/evm/constants.js.map +1 -0
  19. package/_cjs/client/evm/evm.js +76 -0
  20. package/_cjs/client/evm/evm.js.map +1 -1
  21. package/_cjs/client/solana/solana.js +4 -1
  22. package/_cjs/client/solana/solana.js.map +1 -1
  23. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +40 -1
  24. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  25. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js +14 -1
  26. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -1
  27. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js +26 -1
  28. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -1
  29. package/_cjs/openapi-client/generated/index.msw.js +4 -3
  30. package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
  31. package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.js +50 -0
  32. package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.js.map +1 -0
  33. package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.msw.js +270 -0
  34. package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.msw.js.map +1 -0
  35. package/_cjs/openapi-client/index.js +3 -0
  36. package/_cjs/openapi-client/index.js.map +1 -1
  37. package/_cjs/version.js +1 -1
  38. package/_cjs/version.js.map +1 -1
  39. package/_esm/accounts/evm/toEvmServerAccount.js +18 -0
  40. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
  41. package/_esm/accounts/evm/toEvmSmartAccount.js +18 -0
  42. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
  43. package/_esm/actions/evm/fund/Quote.js +59 -0
  44. package/_esm/actions/evm/fund/Quote.js.map +1 -0
  45. package/_esm/actions/evm/fund/fund.js +46 -0
  46. package/_esm/actions/evm/fund/fund.js.map +1 -0
  47. package/_esm/actions/evm/fund/quoteFund.js +43 -0
  48. package/_esm/actions/evm/fund/quoteFund.js.map +1 -0
  49. package/_esm/actions/evm/fund/types.js +2 -0
  50. package/_esm/actions/evm/fund/types.js.map +1 -0
  51. package/_esm/actions/evm/fund/waitForFundOperationReceipt.js +61 -0
  52. package/_esm/actions/evm/fund/waitForFundOperationReceipt.js.map +1 -0
  53. package/_esm/client/evm/constants.js +18 -0
  54. package/_esm/client/evm/constants.js.map +1 -0
  55. package/_esm/client/evm/evm.js +76 -0
  56. package/_esm/client/evm/evm.js.map +1 -1
  57. package/_esm/client/solana/solana.js +4 -1
  58. package/_esm/client/solana/solana.js.map +1 -1
  59. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +39 -0
  60. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  61. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js +12 -0
  62. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -1
  63. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js +23 -0
  64. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -1
  65. package/_esm/openapi-client/generated/index.msw.js +4 -3
  66. package/_esm/openapi-client/generated/index.msw.js.map +1 -1
  67. package/_esm/openapi-client/generated/payments-alpha/payments-alpha.js +42 -0
  68. package/_esm/openapi-client/generated/payments-alpha/payments-alpha.js.map +1 -0
  69. package/_esm/openapi-client/generated/payments-alpha/payments-alpha.msw.js +250 -0
  70. package/_esm/openapi-client/generated/payments-alpha/payments-alpha.msw.js.map +1 -0
  71. package/_esm/openapi-client/index.js +3 -0
  72. package/_esm/openapi-client/index.js.map +1 -1
  73. package/_esm/version.js +1 -1
  74. package/_esm/version.js.map +1 -1
  75. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  76. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
  77. package/_types/accounts/evm/types.d.ts +1 -2
  78. package/_types/accounts/evm/types.d.ts.map +1 -1
  79. package/_types/actions/evm/fund/Quote.d.ts +51 -0
  80. package/_types/actions/evm/fund/Quote.d.ts.map +1 -0
  81. package/_types/actions/evm/fund/fund.d.ts +25 -0
  82. package/_types/actions/evm/fund/fund.d.ts.map +1 -0
  83. package/_types/actions/evm/fund/quoteFund.d.ts +25 -0
  84. package/_types/actions/evm/fund/quoteFund.d.ts.map +1 -0
  85. package/_types/actions/evm/fund/types.d.ts +16 -0
  86. package/_types/actions/evm/fund/types.d.ts.map +1 -0
  87. package/_types/actions/evm/fund/waitForFundOperationReceipt.d.ts +68 -0
  88. package/_types/actions/evm/fund/waitForFundOperationReceipt.d.ts.map +1 -0
  89. package/_types/actions/evm/types.d.ts +65 -0
  90. package/_types/actions/evm/types.d.ts.map +1 -1
  91. package/_types/client/evm/constants.d.ts +5 -0
  92. package/_types/client/evm/constants.d.ts.map +1 -0
  93. package/_types/client/evm/evm.d.ts +44 -1
  94. package/_types/client/evm/evm.d.ts.map +1 -1
  95. package/_types/client/evm/evm.types.d.ts +15 -1
  96. package/_types/client/evm/evm.types.d.ts.map +1 -1
  97. package/_types/client/solana/solana.d.ts.map +1 -1
  98. package/_types/client/solana/solana.types.d.ts +2 -0
  99. package/_types/client/solana/solana.types.d.ts.map +1 -1
  100. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +258 -0
  101. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  102. package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts +7 -1
  103. package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts.map +1 -1
  104. package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts +2 -0
  105. package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts.map +1 -1
  106. package/_types/openapi-client/generated/index.msw.d.ts +4 -3
  107. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
  108. package/_types/openapi-client/generated/payments-alpha/payments-alpha.d.ts +42 -0
  109. package/_types/openapi-client/generated/payments-alpha/payments-alpha.d.ts.map +1 -0
  110. package/_types/openapi-client/generated/payments-alpha/payments-alpha.msw.d.ts +20 -0
  111. package/_types/openapi-client/generated/payments-alpha/payments-alpha.msw.d.ts.map +1 -0
  112. package/_types/openapi-client/index.d.ts +8 -0
  113. package/_types/openapi-client/index.d.ts.map +1 -1
  114. package/_types/types/misc.d.ts +2 -2
  115. package/_types/types/misc.d.ts.map +1 -1
  116. package/_types/version.d.ts +1 -1
  117. package/_types/version.d.ts.map +1 -1
  118. package/accounts/evm/toEvmServerAccount.ts +26 -0
  119. package/accounts/evm/toEvmSmartAccount.ts +26 -0
  120. package/accounts/evm/types.ts +1 -2
  121. package/actions/evm/fund/Quote.ts +83 -0
  122. package/actions/evm/fund/fund.ts +76 -0
  123. package/actions/evm/fund/quoteFund.ts +81 -0
  124. package/actions/evm/fund/types.ts +16 -0
  125. package/actions/evm/fund/waitForFundOperationReceipt.ts +118 -0
  126. package/actions/evm/types.ts +73 -0
  127. package/client/evm/constants.ts +17 -0
  128. package/client/evm/evm.ts +91 -0
  129. package/client/evm/evm.types.ts +16 -0
  130. package/client/solana/solana.ts +4 -1
  131. package/client/solana/solana.types.ts +2 -0
  132. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +300 -0
  133. package/openapi-client/generated/evm-accounts/evm-accounts.msw.ts +41 -0
  134. package/openapi-client/generated/evm-accounts/evm-accounts.ts +20 -0
  135. package/openapi-client/generated/index.msw.ts +4 -3
  136. package/openapi-client/generated/payments-alpha/payments-alpha.msw.ts +369 -0
  137. package/openapi-client/generated/payments-alpha/payments-alpha.ts +96 -0
  138. package/openapi-client/index.ts +3 -0
  139. package/package.json +1 -1
  140. package/types/misc.ts +2 -2
  141. package/version.ts +1 -1
@@ -34,6 +34,7 @@ export type EvmClientInterface = Omit<
34
34
  typeof OpenApiEvmMethods,
35
35
  | "createEvmAccount" // mapped to createAccount
36
36
  | "createEvmSmartAccount" // mapped to createSmartAccount
37
+ | "importEvmAccount" // mapped to importAccount
37
38
  | "getEvmAccount" // mapped to getAccount
38
39
  | "getEvmAccountByName" // mapped to getAccount
39
40
  | "getEvmSmartAccount" // mapped to getSmartAccount
@@ -55,6 +56,7 @@ export type EvmClientInterface = Omit<
55
56
  > & {
56
57
  createAccount: (options: CreateServerAccountOptions) => Promise<ServerAccount>;
57
58
  createSmartAccount: (options: CreateSmartAccountOptions) => Promise<SmartAccount>;
59
+ importAccount: (options: ImportServerAccountOptions) => Promise<ServerAccount>;
58
60
  getAccount: (options: GetServerAccountOptions) => Promise<ServerAccount>;
59
61
  getSmartAccount: (options: GetSmartAccountOptions) => Promise<SmartAccount>;
60
62
  getOrCreateAccount: (options: GetOrCreateServerAccountOptions) => Promise<ServerAccount>;
@@ -143,10 +145,24 @@ export interface UserOperation {
143
145
  export interface CreateServerAccountOptions {
144
146
  /** The name of the account. */
145
147
  name?: string;
148
+ /** The policy ID to apply to the account. */
149
+ accountPolicy?: string;
146
150
  /** The idempotency key. */
147
151
  idempotencyKey?: string;
148
152
  }
149
153
 
154
+ /**
155
+ * Options for importing an EVM server account.
156
+ */
157
+ export interface ImportServerAccountOptions {
158
+ /** The name of the account. */
159
+ name?: string;
160
+ /** The idempotency key. */
161
+ idempotencyKey?: string;
162
+ /** The private key of the account. */
163
+ privateKey: Hex;
164
+ }
165
+
150
166
  /**
151
167
  * Options for getting an EVM account.
152
168
  */
@@ -56,7 +56,10 @@ export class SolanaClient implements SolanaClientInterface {
56
56
  */
57
57
  async createAccount(options: CreateAccountOptions = {}): Promise<SolanaAccount> {
58
58
  const openApiAccount = await CdpOpenApiClient.createSolanaAccount(
59
- options,
59
+ {
60
+ name: options.name,
61
+ accountPolicy: options.accountPolicy,
62
+ },
60
63
  options.idempotencyKey,
61
64
  );
62
65
 
@@ -40,6 +40,8 @@ export interface SignatureResult {
40
40
  export interface CreateAccountOptions {
41
41
  /** The name of the account. */
42
42
  name?: string;
43
+ /** The policy ID to apply to the account. */
44
+ accountPolicy?: string;
43
45
  /** The idempotency key. */
44
46
  idempotencyKey?: string;
45
47
  }
@@ -578,6 +578,236 @@ Account names are guaranteed to be unique across all Solana accounts in the deve
578
578
  policies?: string[];
579
579
  }
580
580
 
581
+ /**
582
+ * The action of the payment method.
583
+ */
584
+ export type PaymentRailAction = (typeof PaymentRailAction)[keyof typeof PaymentRailAction];
585
+
586
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
587
+ export const PaymentRailAction = {
588
+ source: "source",
589
+ target: "target",
590
+ } as const;
591
+
592
+ /**
593
+ * The type of payment method.
594
+ */
595
+ export type PaymentMethodType = (typeof PaymentMethodType)[keyof typeof PaymentMethodType];
596
+
597
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
598
+ export const PaymentMethodType = {
599
+ card: "card",
600
+ fiat_account: "fiat_account",
601
+ } as const;
602
+
603
+ /**
604
+ * The limit for this payment method being used as a source for transfers.
605
+ */
606
+ export type PaymentMethodLimitsSourceLimit = {
607
+ /** The amount of the limit. */
608
+ amount?: string;
609
+ /** The currency of the limit. */
610
+ currency?: string;
611
+ };
612
+
613
+ /**
614
+ * The limit for this payment method being used as a target for transfers.
615
+ */
616
+ export type PaymentMethodLimitsTargetLimit = {
617
+ /** The amount of the limit. */
618
+ amount?: string;
619
+ /** The currency of the limit. */
620
+ currency?: string;
621
+ };
622
+
623
+ /**
624
+ * The limits of the payment method.
625
+ */
626
+ export type PaymentMethodLimits = {
627
+ /** The limit for this payment method being used as a source for transfers. */
628
+ sourceLimit?: PaymentMethodLimitsSourceLimit;
629
+ /** The limit for this payment method being used as a target for transfers. */
630
+ targetLimit?: PaymentMethodLimitsTargetLimit;
631
+ };
632
+
633
+ /**
634
+ * The fiat payment method object.
635
+ */
636
+ export interface PaymentMethod {
637
+ /**
638
+ * The ID of the payment method which previously was added.
639
+ * @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
640
+ */
641
+ id: string;
642
+ /** The type of payment method. */
643
+ type: PaymentMethodType;
644
+ /** The currency of the payment method. */
645
+ currency: string;
646
+ /** The actions for the payment method. */
647
+ actions: PaymentRailAction[];
648
+ /** The limits of the payment method. */
649
+ limits?: PaymentMethodLimits;
650
+ }
651
+
652
+ /**
653
+ * The networks of the asset.
654
+ */
655
+ export type CryptoRailNetworksItem = {
656
+ /** The name of the network. */
657
+ name?: string;
658
+ /** The chain ID of the network. */
659
+ chainId?: number;
660
+ /** The contract address of the asset on the network. */
661
+ contractAddress?: string;
662
+ };
663
+
664
+ /**
665
+ * The crypto rails available.
666
+ */
667
+ export interface CryptoRail {
668
+ /** The currency symbol of the asset. */
669
+ currency: string;
670
+ /** The name of the asset. */
671
+ name: string;
672
+ /** All available networks of the asset. */
673
+ networks: CryptoRailNetworksItem[];
674
+ /** The actions for the crypto rail. */
675
+ actions: PaymentRailAction[];
676
+ }
677
+
678
+ /**
679
+ * The fiat payment method request object.
680
+ */
681
+ export interface PaymentMethodRequest {
682
+ /**
683
+ * The ID of the payment method.
684
+ * @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
685
+ */
686
+ id: string;
687
+ }
688
+
689
+ /**
690
+ * The source of the transfer.
691
+ */
692
+ export type TransferSource = PaymentMethodRequest;
693
+
694
+ /**
695
+ * The crypto rail input object which specifies the symbol, network, and address which is the source or destination wallet address.
696
+ */
697
+ export interface CryptoRailAddress {
698
+ /** The symbol of the currency of the payment rail. */
699
+ currency: string;
700
+ /** The network of the payment rail. */
701
+ network: string;
702
+ /** The address of the payment rail. This is the source or destination wallet address. It is not a contract address. */
703
+ address: string;
704
+ }
705
+
706
+ /**
707
+ * The target of the transfer.
708
+ */
709
+ export type TransferTarget = CryptoRailAddress;
710
+
711
+ /**
712
+ * The type of fee.
713
+ */
714
+ export type FeeType = (typeof FeeType)[keyof typeof FeeType];
715
+
716
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
717
+ export const FeeType = {
718
+ exchange_fee: "exchange_fee",
719
+ network_fee: "network_fee",
720
+ } as const;
721
+
722
+ /**
723
+ * The fee for the transfer.
724
+ */
725
+ export interface Fee {
726
+ /** The type of fee. */
727
+ type: FeeType;
728
+ /** The amount of the fee. */
729
+ amount: string;
730
+ /** The currency of the fee. */
731
+ currency: string;
732
+ /** The description of the fee. */
733
+ description?: string;
734
+ }
735
+
736
+ /**
737
+ * The type of the source of the transfer.
738
+ */
739
+ export type TransferSourceType = (typeof TransferSourceType)[keyof typeof TransferSourceType];
740
+
741
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
742
+ export const TransferSourceType = {
743
+ payment_method: "payment_method",
744
+ } as const;
745
+
746
+ /**
747
+ * The type of the target of the transfer.
748
+ */
749
+ export type TransferTargetType = (typeof TransferTargetType)[keyof typeof TransferTargetType];
750
+
751
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
752
+ export const TransferTargetType = {
753
+ crypto_rail: "crypto_rail",
754
+ } as const;
755
+
756
+ /**
757
+ * The status of the transfer.
758
+ */
759
+ export type TransferStatus = (typeof TransferStatus)[keyof typeof TransferStatus];
760
+
761
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
762
+ export const TransferStatus = {
763
+ created: "created",
764
+ pending: "pending",
765
+ started: "started",
766
+ completed: "completed",
767
+ failed: "failed",
768
+ } as const;
769
+
770
+ /**
771
+ * The transfer object.
772
+ */
773
+ export interface Transfer {
774
+ /**
775
+ * The ID of the transfer.
776
+ * @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
777
+ */
778
+ id: string;
779
+ /** The type of the source of the transfer. */
780
+ sourceType: TransferSourceType;
781
+ /** The source of the transfer. */
782
+ source: PaymentMethodRequest;
783
+ /** The type of the target of the transfer. */
784
+ targetType: TransferTargetType;
785
+ /** The target of the transfer. */
786
+ target: CryptoRailAddress;
787
+ /** The amount the source will transfer. */
788
+ sourceAmount: string;
789
+ /** The currency the source will transfer. */
790
+ sourceCurrency: string;
791
+ /** The amount the target will receive. */
792
+ targetAmount: string;
793
+ /** The currency the target will receive. */
794
+ targetCurrency: string;
795
+ /** The amount the customer put in to transfer. */
796
+ userAmount: string;
797
+ /** The currency the customer put in to transfer. */
798
+ userCurrency: string;
799
+ /** The fees for the transfer. */
800
+ fees: Fee[];
801
+ /** The status of the transfer. */
802
+ status: TransferStatus;
803
+ /** The UTC date and time in ISO 8601 format the transfer was created. */
804
+ createdAt: string;
805
+ /** The UTC date and time in ISO 8601 format the transfer was updated. */
806
+ updatedAt: string;
807
+ /** The transaction hash or transaction signature of the transfer. */
808
+ transactionHash?: string;
809
+ }
810
+
581
811
  /**
582
812
  * Internal server error.
583
813
  */
@@ -645,6 +875,11 @@ Account names must be unique across all EVM accounts in the developer's CDP Proj
645
875
  * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
646
876
  */
647
877
  name?: string;
878
+ /**
879
+ * The ID of the account-level policy to apply to the account.
880
+ * @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
881
+ */
882
+ accountPolicy?: string;
648
883
  };
649
884
 
650
885
  export type UpdateEvmAccountBody = {
@@ -744,6 +979,18 @@ export type CreateEvmSmartAccountBody = {
744
979
  owners: string[];
745
980
  };
746
981
 
982
+ export type ImportEvmAccountBody = {
983
+ /** The base64-encoded, encrypted private key of the EVM account. The private key must be encrypted using the CDP SDK's encryption scheme. */
984
+ encryptedPrivateKey: string;
985
+ /**
986
+ * An optional name for the account.
987
+ Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
988
+ Account names must be unique across all EVM accounts in the developer's CDP Project.
989
+ * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
990
+ */
991
+ name?: string;
992
+ };
993
+
747
994
  /**
748
995
  * The network to prepare the user operation for.
749
996
  */
@@ -924,6 +1171,11 @@ Account names must be unique across all Solana accounts in the developer's CDP P
924
1171
  * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
925
1172
  */
926
1173
  name?: string;
1174
+ /**
1175
+ * The ID of the account-level policy to apply to the account.
1176
+ * @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
1177
+ */
1178
+ accountPolicy?: string;
927
1179
  };
928
1180
 
929
1181
  export type UpdateSolanaAccountBody = {
@@ -986,3 +1238,51 @@ export type RequestSolanaFaucet200 = {
986
1238
  /** The signature identifying the transaction that requested the funds. */
987
1239
  transactionSignature: string;
988
1240
  };
1241
+
1242
+ export type GetCryptoRailsParams = {
1243
+ /**
1244
+ * Comma separated list of networks to filter the rails by.
1245
+ */
1246
+ networks?: string;
1247
+ };
1248
+
1249
+ /**
1250
+ * The type of the source of the transfer.
1251
+ */
1252
+ export type CreatePaymentTransferQuoteBodySourceType =
1253
+ (typeof CreatePaymentTransferQuoteBodySourceType)[keyof typeof CreatePaymentTransferQuoteBodySourceType];
1254
+
1255
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1256
+ export const CreatePaymentTransferQuoteBodySourceType = {
1257
+ payment_method: "payment_method",
1258
+ } as const;
1259
+
1260
+ /**
1261
+ * The type of the target of the transfer.
1262
+ */
1263
+ export type CreatePaymentTransferQuoteBodyTargetType =
1264
+ (typeof CreatePaymentTransferQuoteBodyTargetType)[keyof typeof CreatePaymentTransferQuoteBodyTargetType];
1265
+
1266
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1267
+ export const CreatePaymentTransferQuoteBodyTargetType = {
1268
+ crypto_rail: "crypto_rail",
1269
+ } as const;
1270
+
1271
+ export type CreatePaymentTransferQuoteBody = {
1272
+ /** The type of the source of the transfer. */
1273
+ sourceType: CreatePaymentTransferQuoteBodySourceType;
1274
+ source: TransferSource;
1275
+ /** The type of the target of the transfer. */
1276
+ targetType: CreatePaymentTransferQuoteBodyTargetType;
1277
+ target: TransferTarget;
1278
+ /** The amount of the transfer, which is either for the source currency to buy, or the target currency to receive. */
1279
+ amount: string;
1280
+ /** The currency of the transfer. This can be specified as the source currency, which would be used to buy, or else the target currency, which is how much will be received. */
1281
+ currency: string;
1282
+ /** Whether to execute the transfer. If true, the transfer will be committed and executed. If false, the quote will be generated and returned. */
1283
+ execute?: boolean;
1284
+ };
1285
+
1286
+ export type CreatePaymentTransferQuote201 = {
1287
+ transfer: Transfer;
1288
+ };
@@ -138,6 +138,25 @@ export const getSignEvmTypedDataResponseMock = (
138
138
  overrideResponse: Partial<SignEvmTypedData200> = {},
139
139
  ): SignEvmTypedData200 => ({ signature: faker.string.alpha(20), ...overrideResponse });
140
140
 
141
+ export const getImportEvmAccountResponseMock = (
142
+ overrideResponse: Partial<EvmAccount> = {},
143
+ ): EvmAccount => ({
144
+ address: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
145
+ name: faker.helpers.arrayElement([
146
+ faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
147
+ undefined,
148
+ ]),
149
+ policies: faker.helpers.arrayElement([
150
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
151
+ faker.helpers.fromRegExp(
152
+ "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
153
+ ),
154
+ ),
155
+ undefined,
156
+ ]),
157
+ ...overrideResponse,
158
+ });
159
+
141
160
  export const getListEvmAccountsMockHandler = (
142
161
  overrideResponse?:
143
162
  | ListEvmAccounts200
@@ -359,6 +378,27 @@ export const getSignEvmTypedDataMockHandler = (
359
378
  );
360
379
  });
361
380
  };
381
+
382
+ export const getImportEvmAccountMockHandler = (
383
+ overrideResponse?:
384
+ | EvmAccount
385
+ | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<EvmAccount> | EvmAccount),
386
+ ) => {
387
+ return http.post("*/v2/evm/accounts/import", async info => {
388
+ await delay(0);
389
+
390
+ return new HttpResponse(
391
+ JSON.stringify(
392
+ overrideResponse !== undefined
393
+ ? typeof overrideResponse === "function"
394
+ ? await overrideResponse(info)
395
+ : overrideResponse
396
+ : getImportEvmAccountResponseMock(),
397
+ ),
398
+ { status: 201, headers: { "Content-Type": "application/json" } },
399
+ );
400
+ });
401
+ };
362
402
  export const getEvmAccountsMock = () => [
363
403
  getListEvmAccountsMockHandler(),
364
404
  getCreateEvmAccountMockHandler(),
@@ -370,4 +410,5 @@ export const getEvmAccountsMock = () => [
370
410
  getSignEvmHashMockHandler(),
371
411
  getSignEvmMessageMockHandler(),
372
412
  getSignEvmTypedDataMockHandler(),
413
+ getImportEvmAccountMockHandler(),
373
414
  ];
@@ -9,6 +9,7 @@ import type {
9
9
  CreateEvmAccountBody,
10
10
  EIP712Message,
11
11
  EvmAccount,
12
+ ImportEvmAccountBody,
12
13
  ListEvmAccounts200,
13
14
  ListEvmAccountsParams,
14
15
  SendEvmTransaction200,
@@ -223,6 +224,24 @@ export const signEvmTypedData = (
223
224
  options,
224
225
  );
225
226
  };
227
+ /**
228
+ * Import an existing EVM account into the developer's CDP Project. This API should be called from the [CDP SDK](https://github.com/coinbase/cdp-sdk) to ensure that the associated private key is properly encrypted.
229
+ * @summary Import an EVM account
230
+ */
231
+ export const importEvmAccount = (
232
+ importEvmAccountBody: ImportEvmAccountBody,
233
+ options?: SecondParameter<typeof cdpApiClient>,
234
+ ) => {
235
+ return cdpApiClient<EvmAccount>(
236
+ {
237
+ url: `/v2/evm/accounts/import`,
238
+ method: "POST",
239
+ headers: { "Content-Type": "application/json" },
240
+ data: importEvmAccountBody,
241
+ },
242
+ options,
243
+ );
244
+ };
226
245
  export type ListEvmAccountsResult = NonNullable<Awaited<ReturnType<typeof listEvmAccounts>>>;
227
246
  export type CreateEvmAccountResult = NonNullable<Awaited<ReturnType<typeof createEvmAccount>>>;
228
247
  export type GetEvmAccountResult = NonNullable<Awaited<ReturnType<typeof getEvmAccount>>>;
@@ -235,3 +254,4 @@ export type SignEvmTransactionResult = NonNullable<Awaited<ReturnType<typeof sig
235
254
  export type SignEvmHashResult = NonNullable<Awaited<ReturnType<typeof signEvmHash>>>;
236
255
  export type SignEvmMessageResult = NonNullable<Awaited<ReturnType<typeof signEvmMessage>>>;
237
256
  export type SignEvmTypedDataResult = NonNullable<Awaited<ReturnType<typeof signEvmTypedData>>>;
257
+ export type ImportEvmAccountResult = NonNullable<Awaited<ReturnType<typeof importEvmAccount>>>;
@@ -1,6 +1,7 @@
1
+ export * from "./evm-token-balances/evm-token-balances.msw.js";
2
+ export * from "./evm-accounts/evm-accounts.msw.js";
1
3
  export * from "./faucets/faucets.msw.js";
4
+ export * from "./solana-accounts/solana-accounts.msw.js";
5
+ export * from "./payments-alpha/payments-alpha.msw.js";
2
6
  export * from "./policy-engine/policy-engine.msw.js";
3
- export * from "./evm-accounts/evm-accounts.msw.js";
4
7
  export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
5
- export * from "./evm-token-balances/evm-token-balances.msw.js";
6
- export * from "./solana-accounts/solana-accounts.msw.js";