@lightsparkdev/lightspark-sdk 1.1.6 → 1.2.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 (123) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/{chunk-7UNNCH5S.js → chunk-VTPDR6P4.js} +1270 -342
  3. package/dist/{index-5235e43b.d.ts → index-f040db9f.d.ts} +707 -407
  4. package/dist/index.cjs +1247 -319
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +7 -7
  7. package/dist/objects/index.cjs +1180 -306
  8. package/dist/objects/index.d.ts +1 -1
  9. package/dist/objects/index.js +5 -5
  10. package/package.json +2 -2
  11. package/src/objects/Account.ts +175 -2
  12. package/src/objects/AccountToApiTokensConnection.ts +16 -5
  13. package/src/objects/AccountToChannelsConnection.ts +9 -0
  14. package/src/objects/AccountToNodesConnection.ts +19 -5
  15. package/src/objects/AccountToPaymentRequestsConnection.ts +21 -5
  16. package/src/objects/AccountToTransactionsConnection.ts +33 -9
  17. package/src/objects/AccountToWalletsConnection.ts +13 -4
  18. package/src/objects/ApiToken.ts +13 -3
  19. package/src/objects/Balances.ts +17 -3
  20. package/src/objects/BlockchainBalance.ts +34 -9
  21. package/src/objects/Channel.ts +61 -16
  22. package/src/objects/ChannelClosingTransaction.ts +81 -61
  23. package/src/objects/ChannelFees.ts +16 -5
  24. package/src/objects/ChannelOpeningTransaction.ts +81 -61
  25. package/src/objects/ChannelSnapshot.ts +66 -6
  26. package/src/objects/ChannelToTransactionsConnection.ts +26 -6
  27. package/src/objects/Connection.ts +205 -10
  28. package/src/objects/CreateApiTokenInput.ts +8 -2
  29. package/src/objects/CreateApiTokenOutput.ts +9 -3
  30. package/src/objects/CreateInvoiceInput.ts +14 -5
  31. package/src/objects/CreateInvoiceOutput.ts +7 -2
  32. package/src/objects/CreateLnurlInvoiceInput.ts +13 -3
  33. package/src/objects/CreateNodeWalletAddressInput.ts +9 -2
  34. package/src/objects/CreateNodeWalletAddressOutput.ts +10 -2
  35. package/src/objects/CreateTestModeInvoiceInput.ts +14 -4
  36. package/src/objects/CreateTestModeInvoiceOutput.ts +10 -2
  37. package/src/objects/CreateTestModePaymentInput.ts +12 -3
  38. package/src/objects/CreateTestModePaymentoutput.ts +12 -2
  39. package/src/objects/CreateUmaInvoiceInput.ts +13 -3
  40. package/src/objects/CurrencyAmount.ts +13 -2
  41. package/src/objects/DeclineToSignMessagesInput.ts +9 -2
  42. package/src/objects/DeclineToSignMessagesOutput.ts +15 -3
  43. package/src/objects/DeleteApiTokenInput.ts +7 -2
  44. package/src/objects/DeleteApiTokenOutput.ts +7 -2
  45. package/src/objects/Deposit.ts +77 -61
  46. package/src/objects/Entity.ts +184 -2
  47. package/src/objects/FeeEstimate.ts +12 -3
  48. package/src/objects/FundNodeInput.ts +9 -3
  49. package/src/objects/FundNodeOutput.ts +11 -3
  50. package/src/objects/GraphNode.ts +21 -5
  51. package/src/objects/Hop.ts +27 -9
  52. package/src/objects/HtlcAttemptFailureCode.ts +2 -0
  53. package/src/objects/IdAndSignature.ts +8 -2
  54. package/src/objects/IncomingPayment.ts +33 -7
  55. package/src/objects/IncomingPaymentAttempt.ts +21 -5
  56. package/src/objects/IncomingPaymentToAttemptsConnection.ts +21 -5
  57. package/src/objects/Invoice.ts +91 -24
  58. package/src/objects/InvoiceData.ts +75 -6
  59. package/src/objects/LightningFeeEstimateForInvoiceInput.ts +13 -3
  60. package/src/objects/LightningFeeEstimateForNodeInput.ts +12 -2
  61. package/src/objects/LightningFeeEstimateOutput.ts +15 -3
  62. package/src/objects/LightningTransaction.ts +171 -28
  63. package/src/objects/LightsparkNode.ts +311 -208
  64. package/src/objects/LightsparkNodeOwner.ts +35 -4
  65. package/src/objects/LightsparkNodeToChannelsConnection.ts +17 -4
  66. package/src/objects/LightsparkNodeWithOSK.ts +97 -15
  67. package/src/objects/LightsparkNodeWithRemoteSigning.ts +93 -13
  68. package/src/objects/Node.ts +269 -67
  69. package/src/objects/NodeAddress.ts +8 -2
  70. package/src/objects/NodeToAddressesConnection.ts +13 -3
  71. package/src/objects/OnChainTransaction.ts +156 -44
  72. package/src/objects/OutgoingPayment.ts +127 -14
  73. package/src/objects/OutgoingPaymentAttempt.ts +57 -8
  74. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +18 -5
  75. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +17 -4
  76. package/src/objects/OutgoingPaymentsForInvoiceQueryInput.ts +12 -3
  77. package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +11 -2
  78. package/src/objects/PageInfo.ts +14 -6
  79. package/src/objects/PayInvoiceInput.ts +12 -3
  80. package/src/objects/PayInvoiceOutput.ts +7 -2
  81. package/src/objects/PayUmaInvoiceInput.ts +12 -3
  82. package/src/objects/PaymentRequest.ts +81 -5
  83. package/src/objects/PaymentRequestData.ts +81 -4
  84. package/src/objects/PostTransactionData.ts +12 -3
  85. package/src/objects/RegisterPaymentInput.ts +10 -2
  86. package/src/objects/RegisterPaymentOutput.ts +9 -2
  87. package/src/objects/ReleaseChannelPerCommitmentSecretInput.ts +13 -2
  88. package/src/objects/ReleaseChannelPerCommitmentSecretOutput.ts +9 -2
  89. package/src/objects/ReleasePaymentPreimageInput.ts +10 -2
  90. package/src/objects/ReleasePaymentPreimageOutput.ts +9 -2
  91. package/src/objects/RequestWithdrawalInput.ts +12 -2
  92. package/src/objects/RequestWithdrawalOutput.ts +9 -2
  93. package/src/objects/RichText.ts +7 -2
  94. package/src/objects/RoutingTransaction.ts +62 -41
  95. package/src/objects/ScreenNodeInput.ts +8 -2
  96. package/src/objects/ScreenNodeOutput.ts +7 -2
  97. package/src/objects/Secret.ts +8 -2
  98. package/src/objects/SendPaymentInput.ts +11 -2
  99. package/src/objects/SendPaymentOutput.ts +7 -2
  100. package/src/objects/SetInvoicePaymentHashInput.ts +12 -3
  101. package/src/objects/SetInvoicePaymentHashOutput.ts +9 -2
  102. package/src/objects/SignInvoiceInput.ts +9 -2
  103. package/src/objects/SignInvoiceOutput.ts +7 -2
  104. package/src/objects/SignMessagesInput.ts +13 -3
  105. package/src/objects/SignMessagesOutput.ts +13 -3
  106. package/src/objects/Signable.ts +10 -3
  107. package/src/objects/SignablePayload.ts +18 -5
  108. package/src/objects/Transaction.ts +260 -9
  109. package/src/objects/TransactionFailures.ts +11 -4
  110. package/src/objects/UpdateChannelPerCommitmentPointInput.ts +13 -2
  111. package/src/objects/UpdateChannelPerCommitmentPointOutput.ts +9 -2
  112. package/src/objects/UpdateNodeSharedSecretInput.ts +10 -2
  113. package/src/objects/UpdateNodeSharedSecretOutput.ts +9 -2
  114. package/src/objects/Wallet.ts +130 -5
  115. package/src/objects/WalletToPaymentRequestsConnection.ts +21 -5
  116. package/src/objects/WalletToTransactionsConnection.ts +16 -5
  117. package/src/objects/Withdrawal.ts +77 -61
  118. package/src/objects/WithdrawalRequest.ts +25 -4
  119. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +19 -4
  120. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +19 -4
  121. package/src/objects/index.ts +5 -2
  122. package/src/tests/integration/client.test.ts +46 -7
  123. package/src/tests/serialization.test.ts +18 -0
@@ -1,8 +1,8 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- type CreateTestModeInvoiceOutput = {
3
+ interface CreateTestModeInvoiceOutput {
4
4
  encodedPaymentRequest: string;
5
- };
5
+ }
6
6
 
7
7
  export const CreateTestModeInvoiceOutputFromJson = (
8
8
  obj: any,
@@ -12,6 +12,14 @@ export const CreateTestModeInvoiceOutputFromJson = (
12
12
  obj["create_test_mode_invoice_output_encoded_payment_request"],
13
13
  } as CreateTestModeInvoiceOutput;
14
14
  };
15
+ export const CreateTestModeInvoiceOutputToJson = (
16
+ obj: CreateTestModeInvoiceOutput,
17
+ ): any => {
18
+ return {
19
+ create_test_mode_invoice_output_encoded_payment_request:
20
+ obj.encodedPaymentRequest,
21
+ };
22
+ };
15
23
 
16
24
  export const FRAGMENT = `
17
25
  fragment CreateTestModeInvoiceOutputFragment on CreateTestModeInvoiceOutput {
@@ -1,6 +1,6 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- type CreateTestModePaymentInput = {
3
+ interface CreateTestModePaymentInput {
4
4
  /** The node to where you want to send the payment. **/
5
5
  localNodeId: string;
6
6
 
@@ -11,8 +11,8 @@ type CreateTestModePaymentInput = {
11
11
  * The amount you will be paid for this invoice, expressed in msats. It should ONLY be set when the
12
12
  * invoice amount is zero.
13
13
  **/
14
- amountMsats?: number;
15
- };
14
+ amountMsats?: number | undefined;
15
+ }
16
16
 
17
17
  export const CreateTestModePaymentInputFromJson = (
18
18
  obj: any,
@@ -23,5 +23,14 @@ export const CreateTestModePaymentInputFromJson = (
23
23
  amountMsats: obj["create_test_mode_payment_input_amount_msats"],
24
24
  } as CreateTestModePaymentInput;
25
25
  };
26
+ export const CreateTestModePaymentInputToJson = (
27
+ obj: CreateTestModePaymentInput,
28
+ ): any => {
29
+ return {
30
+ create_test_mode_payment_input_local_node_id: obj.localNodeId,
31
+ create_test_mode_payment_input_encoded_invoice: obj.encodedInvoice,
32
+ create_test_mode_payment_input_amount_msats: obj.amountMsats,
33
+ };
34
+ };
26
35
 
27
36
  export default CreateTestModePaymentInput;
@@ -1,7 +1,7 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
3
  /** This is an object identifying the output of a test mode payment. This object can be used to retrieve the associated payment made from a Test Mode Payment call. **/
4
- type CreateTestModePaymentoutput = {
4
+ interface CreateTestModePaymentoutput {
5
5
  /**
6
6
  * The payment that has been sent.
7
7
  *
@@ -11,7 +11,7 @@ type CreateTestModePaymentoutput = {
11
11
 
12
12
  /** The payment that has been received. **/
13
13
  incomingPaymentId: string;
14
- };
14
+ }
15
15
 
16
16
  export const CreateTestModePaymentoutputFromJson = (
17
17
  obj: any,
@@ -22,6 +22,16 @@ export const CreateTestModePaymentoutputFromJson = (
22
22
  obj["create_test_mode_paymentoutput_incoming_payment"].id,
23
23
  } as CreateTestModePaymentoutput;
24
24
  };
25
+ export const CreateTestModePaymentoutputToJson = (
26
+ obj: CreateTestModePaymentoutput,
27
+ ): any => {
28
+ return {
29
+ create_test_mode_paymentoutput_payment: { id: obj.paymentId },
30
+ create_test_mode_paymentoutput_incoming_payment: {
31
+ id: obj.incomingPaymentId,
32
+ },
33
+ };
34
+ };
25
35
 
26
36
  export const FRAGMENT = `
27
37
  fragment CreateTestModePaymentoutputFragment on CreateTestModePaymentoutput {
@@ -1,14 +1,14 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- type CreateUmaInvoiceInput = {
3
+ interface CreateUmaInvoiceInput {
4
4
  nodeId: string;
5
5
 
6
6
  amountMsats: number;
7
7
 
8
8
  metadataHash: string;
9
9
 
10
- expirySecs?: number;
11
- };
10
+ expirySecs?: number | undefined;
11
+ }
12
12
 
13
13
  export const CreateUmaInvoiceInputFromJson = (
14
14
  obj: any,
@@ -20,5 +20,15 @@ export const CreateUmaInvoiceInputFromJson = (
20
20
  expirySecs: obj["create_uma_invoice_input_expiry_secs"],
21
21
  } as CreateUmaInvoiceInput;
22
22
  };
23
+ export const CreateUmaInvoiceInputToJson = (
24
+ obj: CreateUmaInvoiceInput,
25
+ ): any => {
26
+ return {
27
+ create_uma_invoice_input_node_id: obj.nodeId,
28
+ create_uma_invoice_input_amount_msats: obj.amountMsats,
29
+ create_uma_invoice_input_metadata_hash: obj.metadataHash,
30
+ create_uma_invoice_input_expiry_secs: obj.expirySecs,
31
+ };
32
+ };
23
33
 
24
34
  export default CreateUmaInvoiceInput;
@@ -3,7 +3,7 @@
3
3
  import CurrencyUnit from "./CurrencyUnit.js";
4
4
 
5
5
  /** This object represents the value and unit for an amount of currency. **/
6
- type CurrencyAmount = {
6
+ interface CurrencyAmount {
7
7
  /** The original numeric value for this CurrencyAmount. **/
8
8
  originalValue: number;
9
9
 
@@ -24,7 +24,7 @@ type CurrencyAmount = {
24
24
  * currency. For example, for USD, the value will be in cents.
25
25
  **/
26
26
  preferredCurrencyValueApprox: number;
27
- };
27
+ }
28
28
 
29
29
  export const CurrencyAmountFromJson = (obj: any): CurrencyAmount => {
30
30
  return {
@@ -41,6 +41,17 @@ export const CurrencyAmountFromJson = (obj: any): CurrencyAmount => {
41
41
  obj["currency_amount_preferred_currency_value_approx"],
42
42
  } as CurrencyAmount;
43
43
  };
44
+ export const CurrencyAmountToJson = (obj: CurrencyAmount): any => {
45
+ return {
46
+ currency_amount_original_value: obj.originalValue,
47
+ currency_amount_original_unit: obj.originalUnit,
48
+ currency_amount_preferred_currency_unit: obj.preferredCurrencyUnit,
49
+ currency_amount_preferred_currency_value_rounded:
50
+ obj.preferredCurrencyValueRounded,
51
+ currency_amount_preferred_currency_value_approx:
52
+ obj.preferredCurrencyValueApprox,
53
+ };
54
+ };
44
55
 
45
56
  export const FRAGMENT = `
46
57
  fragment CurrencyAmountFragment on CurrencyAmount {
@@ -1,9 +1,9 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- type DeclineToSignMessagesInput = {
3
+ interface DeclineToSignMessagesInput {
4
4
  /** List of payload ids to decline to sign because validation failed. **/
5
5
  payloadIds: string[];
6
- };
6
+ }
7
7
 
8
8
  export const DeclineToSignMessagesInputFromJson = (
9
9
  obj: any,
@@ -12,5 +12,12 @@ export const DeclineToSignMessagesInputFromJson = (
12
12
  payloadIds: obj["decline_to_sign_messages_input_payload_ids"],
13
13
  } as DeclineToSignMessagesInput;
14
14
  };
15
+ export const DeclineToSignMessagesInputToJson = (
16
+ obj: DeclineToSignMessagesInput,
17
+ ): any => {
18
+ return {
19
+ decline_to_sign_messages_input_payload_ids: obj.payloadIds,
20
+ };
21
+ };
15
22
 
16
23
  export default DeclineToSignMessagesInput;
@@ -1,11 +1,14 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
3
  import type SignablePayload from "./SignablePayload.js";
4
- import { SignablePayloadFromJson } from "./SignablePayload.js";
4
+ import {
5
+ SignablePayloadFromJson,
6
+ SignablePayloadToJson,
7
+ } from "./SignablePayload.js";
5
8
 
6
- type DeclineToSignMessagesOutput = {
9
+ interface DeclineToSignMessagesOutput {
7
10
  declinedPayloads: SignablePayload[];
8
- };
11
+ }
9
12
 
10
13
  export const DeclineToSignMessagesOutputFromJson = (
11
14
  obj: any,
@@ -16,6 +19,15 @@ export const DeclineToSignMessagesOutputFromJson = (
16
19
  ].map((e) => SignablePayloadFromJson(e)),
17
20
  } as DeclineToSignMessagesOutput;
18
21
  };
22
+ export const DeclineToSignMessagesOutputToJson = (
23
+ obj: DeclineToSignMessagesOutput,
24
+ ): any => {
25
+ return {
26
+ decline_to_sign_messages_output_declined_payloads: obj.declinedPayloads.map(
27
+ (e) => SignablePayloadToJson(e),
28
+ ),
29
+ };
30
+ };
19
31
 
20
32
  export const FRAGMENT = `
21
33
  fragment DeclineToSignMessagesOutputFragment on DeclineToSignMessagesOutput {
@@ -1,13 +1,18 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- type DeleteApiTokenInput = {
3
+ interface DeleteApiTokenInput {
4
4
  apiTokenId: string;
5
- };
5
+ }
6
6
 
7
7
  export const DeleteApiTokenInputFromJson = (obj: any): DeleteApiTokenInput => {
8
8
  return {
9
9
  apiTokenId: obj["delete_api_token_input_api_token_id"],
10
10
  } as DeleteApiTokenInput;
11
11
  };
12
+ export const DeleteApiTokenInputToJson = (obj: DeleteApiTokenInput): any => {
13
+ return {
14
+ delete_api_token_input_api_token_id: obj.apiTokenId,
15
+ };
16
+ };
12
17
 
13
18
  export default DeleteApiTokenInput;
@@ -1,8 +1,8 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- type DeleteApiTokenOutput = {
3
+ interface DeleteApiTokenOutput {
4
4
  accountId: string;
5
- };
5
+ }
6
6
 
7
7
  export const DeleteApiTokenOutputFromJson = (
8
8
  obj: any,
@@ -11,6 +11,11 @@ export const DeleteApiTokenOutputFromJson = (
11
11
  accountId: obj["delete_api_token_output_account"].id,
12
12
  } as DeleteApiTokenOutput;
13
13
  };
14
+ export const DeleteApiTokenOutputToJson = (obj: DeleteApiTokenOutput): any => {
15
+ return {
16
+ delete_api_token_output_account: { id: obj.accountId },
17
+ };
18
+ };
14
19
 
15
20
  export const FRAGMENT = `
16
21
  fragment DeleteApiTokenOutputFragment on DeleteApiTokenOutput {
@@ -2,70 +2,68 @@
2
2
 
3
3
  import { type Query } from "@lightsparkdev/core";
4
4
  import type CurrencyAmount from "./CurrencyAmount.js";
5
- import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
6
- import type Entity from "./Entity.js";
7
- import type OnChainTransaction from "./OnChainTransaction.js";
8
- import type Transaction from "./Transaction.js";
5
+ import {
6
+ CurrencyAmountFromJson,
7
+ CurrencyAmountToJson,
8
+ } from "./CurrencyAmount.js";
9
9
  import TransactionStatus from "./TransactionStatus.js";
10
10
 
11
11
  /** This object represents a Deposit made to a Lightspark node wallet. This operation occurs for any L1 funding transaction to the wallet. You can retrieve this object to receive detailed information about the deposit. **/
12
- type Deposit = OnChainTransaction &
13
- Transaction &
14
- Entity & {
15
- /**
16
- * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
17
- * string.
18
- **/
19
- id: string;
20
-
21
- /** The date and time when this transaction was initiated. **/
22
- createdAt: string;
23
-
24
- /** The date and time when the entity was last updated. **/
25
- updatedAt: string;
26
-
27
- /** The current status of this transaction. **/
28
- status: TransactionStatus;
29
-
30
- /** The amount of money involved in this transaction. **/
31
- amount: CurrencyAmount;
32
-
33
- /**
34
- * The height of the block that included this transaction. This will be zero for unconfirmed
35
- * transactions.
36
- **/
37
- blockHeight: number;
38
-
39
- /** The Bitcoin blockchain addresses this transaction was sent to. **/
40
- destinationAddresses: string[];
41
-
42
- /** The recipient Lightspark node this deposit was sent to. **/
43
- destinationId: string;
44
-
45
- /** The typename of the object **/
46
- typename: string;
47
-
48
- /** The date and time when this transaction was completed or failed. **/
49
- resolvedAt?: string;
50
-
51
- /** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
52
- transactionHash?: string;
53
-
54
- /**
55
- * The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
56
- * blockchain.
57
- **/
58
- fees?: CurrencyAmount;
59
-
60
- /**
61
- * The hash of the block that included this transaction. This will be null for unconfirmed
62
- * transactions.
63
- **/
64
- blockHash?: string;
65
-
66
- /** The number of blockchain confirmations for this transaction in real time. **/
67
- numConfirmations?: number;
68
- };
12
+ interface Deposit {
13
+ /**
14
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
15
+ * string.
16
+ **/
17
+ id: string;
18
+
19
+ /** The date and time when this transaction was initiated. **/
20
+ createdAt: string;
21
+
22
+ /** The date and time when the entity was last updated. **/
23
+ updatedAt: string;
24
+
25
+ /** The current status of this transaction. **/
26
+ status: TransactionStatus;
27
+
28
+ /** The amount of money involved in this transaction. **/
29
+ amount: CurrencyAmount;
30
+
31
+ /**
32
+ * The height of the block that included this transaction. This will be zero for unconfirmed
33
+ * transactions.
34
+ **/
35
+ blockHeight: number;
36
+
37
+ /** The Bitcoin blockchain addresses this transaction was sent to. **/
38
+ destinationAddresses: string[];
39
+
40
+ /** The recipient Lightspark node this deposit was sent to. **/
41
+ destinationId: string;
42
+
43
+ /** The typename of the object **/
44
+ typename: string;
45
+
46
+ /** The date and time when this transaction was completed or failed. **/
47
+ resolvedAt?: string | undefined;
48
+
49
+ /** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
50
+ transactionHash?: string | undefined;
51
+
52
+ /**
53
+ * The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
54
+ * blockchain.
55
+ **/
56
+ fees?: CurrencyAmount | undefined;
57
+
58
+ /**
59
+ * The hash of the block that included this transaction. This will be null for unconfirmed
60
+ * transactions.
61
+ **/
62
+ blockHash?: string | undefined;
63
+
64
+ /** The number of blockchain confirmations for this transaction in real time. **/
65
+ numConfirmations?: number | undefined;
66
+ }
69
67
 
70
68
  export const DepositFromJson = (obj: any): Deposit => {
71
69
  return {
@@ -89,6 +87,24 @@ export const DepositFromJson = (obj: any): Deposit => {
89
87
  numConfirmations: obj["deposit_num_confirmations"],
90
88
  } as Deposit;
91
89
  };
90
+ export const DepositToJson = (obj: Deposit): any => {
91
+ return {
92
+ __typename: "Deposit",
93
+ deposit_id: obj.id,
94
+ deposit_created_at: obj.createdAt,
95
+ deposit_updated_at: obj.updatedAt,
96
+ deposit_status: obj.status,
97
+ deposit_resolved_at: obj.resolvedAt,
98
+ deposit_amount: CurrencyAmountToJson(obj.amount),
99
+ deposit_transaction_hash: obj.transactionHash,
100
+ deposit_fees: obj.fees ? CurrencyAmountToJson(obj.fees) : undefined,
101
+ deposit_block_hash: obj.blockHash,
102
+ deposit_block_height: obj.blockHeight,
103
+ deposit_destination_addresses: obj.destinationAddresses,
104
+ deposit_num_confirmations: obj.numConfirmations,
105
+ deposit_destination: { id: obj.destinationId },
106
+ };
107
+ };
92
108
 
93
109
  export const FRAGMENT = `
94
110
  fragment DepositFragment on Deposit {