From a73d027a1413c2cd41dd775d58af59af6f33d6ec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 8 Mar 2024 15:05:56 -0800 Subject: [PATCH] Regenerate the sdk to pick up internal payment field (#393) * Regenerate the sdk to pick up internal payment field (#9376) GitOrigin-RevId: a77cd0f49148e5d875181eea27dcde6171548084 * Update from public js-sdk main branch (#9379) Update public `js` sources with the latest code from the [public repository](https://github.com/lightsparkdev/js-sdk) main branch. This typically happens when new versions of the SDK are released and version updates need to be synced. The PR should be merged as soon as possible to avoid updates to webdev overwriting the changes in the js-sdk develop branch. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] Co-authored-by: Lightspark Eng Co-authored-by: Corey Martin GitOrigin-RevId: a14bd3a9db928c2e5b6af165eec1e36e812905df * Create spicy-rockets-lay.md --------- Co-authored-by: Jeremy Klein Co-authored-by: lightspark-ci-js-sdk[bot] <134011073+lightspark-ci-js-sdk[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] Co-authored-by: Lightspark Eng Co-authored-by: Corey Martin --- .changeset/spicy-rockets-lay.md | 6 + .../lightspark-sdk/src/objects/Account.ts | 5 + .../lightspark-sdk/src/objects/ApiToken.ts | 6 + .../src/objects/AuditLogActor.ts | 96 +++++ .../src/objects/CancelInvoiceInput.ts | 4 + .../src/objects/CancelInvoiceOutput.ts | 4 + .../src/objects/ChannelSnapshot.ts | 85 ++++- .../src/objects/ClaimUmaInvitationInput.ts | 5 + .../src/objects/ClaimUmaInvitationOutput.ts | 1 + .../ClaimUmaInvitationWithIncentivesInput.ts | 7 + .../ClaimUmaInvitationWithIncentivesOutput.ts | 1 + .../src/objects/CreateApiTokenOutput.ts | 1 + .../CreateInvitationWithIncentivesInput.ts | 6 + .../CreateInvitationWithIncentivesOutput.ts | 1 + .../src/objects/CreateInvoiceInput.ts | 5 +- .../objects/CreateNodeWalletAddressOutput.ts | 34 ++ .../src/objects/CreateUmaInvitationInput.ts | 4 + .../src/objects/CreateUmaInvitationOutput.ts | 1 + packages/lightspark-sdk/src/objects/Entity.ts | 102 +++--- .../src/objects/IncomingPayment.ts | 13 + .../IncomingPaymentsForInvoiceQueryInput.ts | 31 ++ .../IncomingPaymentsForInvoiceQueryOutput.ts | 71 ++++ .../src/objects/LightningTransaction.ts | 12 + .../MultiSigAddressValidationParameters.ts | 45 +++ .../src/objects/OutgoingPayment.ts | 59 +-- .../src/objects/OutgoingPaymentAttempt.ts | 64 +--- .../OutgoingPaymentsForInvoiceQueryOutput.ts | 344 +++++++++++++++++- .../src/objects/PaymentFailureReason.ts | 2 + .../lightspark-sdk/src/objects/Transaction.ts | 12 + packages/lightspark-sdk/src/objects/Wallet.ts | 4 + .../src/objects/WebhookEventType.ts | 2 + .../src/objects/WithdrawalRequestStatus.ts | 2 + packages/lightspark-sdk/src/objects/index.ts | 12 +- .../src/objects/CancelInvoiceInput.ts | 4 + .../src/objects/CancelInvoiceOutput.ts | 4 + .../src/objects/PaymentFailureReason.ts | 2 + .../src/objects/WithdrawalRequestStatus.ts | 2 + 37 files changed, 890 insertions(+), 169 deletions(-) create mode 100644 .changeset/spicy-rockets-lay.md create mode 100644 packages/lightspark-sdk/src/objects/AuditLogActor.ts create mode 100644 packages/lightspark-sdk/src/objects/IncomingPaymentsForInvoiceQueryInput.ts create mode 100644 packages/lightspark-sdk/src/objects/IncomingPaymentsForInvoiceQueryOutput.ts create mode 100644 packages/lightspark-sdk/src/objects/MultiSigAddressValidationParameters.ts diff --git a/.changeset/spicy-rockets-lay.md b/.changeset/spicy-rockets-lay.md new file mode 100644 index 000000000..81ac01c63 --- /dev/null +++ b/.changeset/spicy-rockets-lay.md @@ -0,0 +1,6 @@ +--- +"@lightsparkdev/lightspark-sdk": patch +"@lightsparkdev/wallet-sdk": patch +--- + +Regenerate the sdk to pick up internal payment field diff --git a/packages/lightspark-sdk/src/objects/Account.ts b/packages/lightspark-sdk/src/objects/Account.ts index 32c4becd5..46af3a071 100644 --- a/packages/lightspark-sdk/src/objects/Account.ts +++ b/packages/lightspark-sdk/src/objects/Account.ts @@ -80,6 +80,7 @@ query FetchAccountToApiTokensConnection($first: Int, $after: String) { api_token_client_id: client_id api_token_name: name api_token_permissions: permissions + api_token_is_deleted: is_deleted } } } @@ -885,6 +886,7 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types: currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } incoming_payment_transaction_hash: transaction_hash + incoming_payment_is_uma: is_uma incoming_payment_destination: destination { id } @@ -903,6 +905,7 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types: currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } } + incoming_payment_is_internal_payment: is_internal_payment } ... on OutgoingPayment { __typename @@ -920,6 +923,7 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types: currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } outgoing_payment_transaction_hash: transaction_hash + outgoing_payment_is_uma: is_uma outgoing_payment_origin: origin { id } @@ -1246,6 +1250,7 @@ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types: } } outgoing_payment_payment_preimage: payment_preimage + outgoing_payment_is_internal_payment: is_internal_payment } ... on RoutingTransaction { __typename diff --git a/packages/lightspark-sdk/src/objects/ApiToken.ts b/packages/lightspark-sdk/src/objects/ApiToken.ts index fd4f16b8b..a939ae03b 100644 --- a/packages/lightspark-sdk/src/objects/ApiToken.ts +++ b/packages/lightspark-sdk/src/objects/ApiToken.ts @@ -36,6 +36,9 @@ interface ApiToken { /** A list of permissions granted to the token. **/ permissions: Permission[]; + /** Whether the api token has been deleted. **/ + isDeleted: boolean; + /** The typename of the object **/ typename: string; } @@ -48,6 +51,7 @@ export const ApiTokenFromJson = (obj: any): ApiToken => { clientId: obj["api_token_client_id"], name: obj["api_token_name"], permissions: obj["api_token_permissions"].map((e) => Permission[e]), + isDeleted: obj["api_token_is_deleted"], typename: "ApiToken", } as ApiToken; }; @@ -60,6 +64,7 @@ export const ApiTokenToJson = (obj: ApiToken): any => { api_token_client_id: obj.clientId, api_token_name: obj.name, api_token_permissions: obj.permissions, + api_token_is_deleted: obj.isDeleted, }; }; @@ -72,6 +77,7 @@ fragment ApiTokenFragment on ApiToken { api_token_client_id: client_id api_token_name: name api_token_permissions: permissions + api_token_is_deleted: is_deleted }`; export const getApiTokenQuery = (id: string): Query => { diff --git a/packages/lightspark-sdk/src/objects/AuditLogActor.ts b/packages/lightspark-sdk/src/objects/AuditLogActor.ts new file mode 100644 index 000000000..e7a663a8e --- /dev/null +++ b/packages/lightspark-sdk/src/objects/AuditLogActor.ts @@ -0,0 +1,96 @@ +// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved + +import { LightsparkException, type Query } from "@lightsparkdev/core"; +import type ApiToken from "./ApiToken.js"; +import Permission from "./Permission.js"; + +/** Audit log actor who called the GraphQL mutation **/ +interface AuditLogActor { + /** + * The unique identifier of this entity across all Lightspark systems. Should be treated as an + * opaque string. + **/ + id: string; + + /** The date and time when the entity was first created. **/ + createdAt: string; + + /** The date and time when the entity was last updated. **/ + updatedAt: string; + + /** The typename of the object **/ + typename: string; +} + +export const AuditLogActorFromJson = (obj: any): AuditLogActor => { + if (obj["__typename"] == "ApiToken") { + return { + id: obj["api_token_id"], + createdAt: obj["api_token_created_at"], + updatedAt: obj["api_token_updated_at"], + clientId: obj["api_token_client_id"], + name: obj["api_token_name"], + permissions: obj["api_token_permissions"].map((e) => Permission[e]), + isDeleted: obj["api_token_is_deleted"], + typename: "ApiToken", + } as ApiToken; + } + throw new LightsparkException( + "DeserializationError", + `Couldn't find a concrete type for interface AuditLogActor corresponding to the typename=${obj["__typename"]}`, + ); +}; +export const AuditLogActorToJson = (obj: AuditLogActor): any => { + if (obj.typename == "ApiToken") { + const apiToken = obj as ApiToken; + return { + __typename: "ApiToken", + api_token_id: apiToken.id, + api_token_created_at: apiToken.createdAt, + api_token_updated_at: apiToken.updatedAt, + api_token_client_id: apiToken.clientId, + api_token_name: apiToken.name, + api_token_permissions: apiToken.permissions, + api_token_is_deleted: apiToken.isDeleted, + }; + } + throw new LightsparkException( + "DeserializationError", + `Couldn't find a concrete type for interface AuditLogActor corresponding to the typename=${obj.typename}`, + ); +}; + +export const FRAGMENT = ` +fragment AuditLogActorFragment on AuditLogActor { + __typename + ... on ApiToken { + __typename + api_token_id: id + api_token_created_at: created_at + api_token_updated_at: updated_at + api_token_client_id: client_id + api_token_name: name + api_token_permissions: permissions + api_token_is_deleted: is_deleted + } +}`; + +export const getAuditLogActorQuery = (id: string): Query => { + return { + queryPayload: ` +query GetAuditLogActor($id: ID!) { + entity(id: $id) { + ... on AuditLogActor { + ...AuditLogActorFragment + } + } +} + +${FRAGMENT} +`, + variables: { id }, + constructObject: (data: any) => AuditLogActorFromJson(data.entity), + }; +}; + +export default AuditLogActor; diff --git a/packages/lightspark-sdk/src/objects/CancelInvoiceInput.ts b/packages/lightspark-sdk/src/objects/CancelInvoiceInput.ts index cd4e5e855..633e5b1b8 100644 --- a/packages/lightspark-sdk/src/objects/CancelInvoiceInput.ts +++ b/packages/lightspark-sdk/src/objects/CancelInvoiceInput.ts @@ -1,5 +1,9 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved +/** + * The unique identifier of the Invoice that should be cancelled. The invoice is supposed to be + * open, not settled and not expired. * + */ interface CancelInvoiceInput { invoiceId: string; } diff --git a/packages/lightspark-sdk/src/objects/CancelInvoiceOutput.ts b/packages/lightspark-sdk/src/objects/CancelInvoiceOutput.ts index 95d2fb856..6b6147b52 100644 --- a/packages/lightspark-sdk/src/objects/CancelInvoiceOutput.ts +++ b/packages/lightspark-sdk/src/objects/CancelInvoiceOutput.ts @@ -1,5 +1,9 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved +/** + * The Invoice that was cancelled. If the invoice was already cancelled, the same invoice is + * returned. * + */ interface CancelInvoiceOutput { invoiceId: string; } diff --git a/packages/lightspark-sdk/src/objects/ChannelSnapshot.ts b/packages/lightspark-sdk/src/objects/ChannelSnapshot.ts index c573190f9..7c0fa2092 100644 --- a/packages/lightspark-sdk/src/objects/ChannelSnapshot.ts +++ b/packages/lightspark-sdk/src/objects/ChannelSnapshot.ts @@ -1,5 +1,6 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved +import { type Query } from "@lightsparkdev/core"; import type CurrencyAmount from "./CurrencyAmount.js"; import { CurrencyAmountFromJson, @@ -7,71 +8,98 @@ import { } from "./CurrencyAmount.js"; interface ChannelSnapshot { + /** + * The unique identifier of this entity across all Lightspark systems. Should be treated as an + * opaque string. + **/ + id: string; + + /** The date and time when the entity was first created. **/ + createdAt: string; + + /** The date and time when the entity was last updated. **/ + updatedAt: string; + channelId: string; + /** The timestamp that was used to query the snapshot of the channel **/ timestamp: string; + /** The typename of the object **/ + typename: string; + localBalance?: CurrencyAmount | undefined; localUnsettledBalance?: CurrencyAmount | undefined; - localChannelReserve?: CurrencyAmount | undefined; - remoteBalance?: CurrencyAmount | undefined; remoteUnsettledBalance?: CurrencyAmount | undefined; + + status?: string | undefined; + + localChannelReserve?: CurrencyAmount | undefined; } export const ChannelSnapshotFromJson = (obj: any): ChannelSnapshot => { return { + id: obj["channel_snapshot_id"], + createdAt: obj["channel_snapshot_created_at"], + updatedAt: obj["channel_snapshot_updated_at"], channelId: obj["channel_snapshot_channel"].id, timestamp: obj["channel_snapshot_timestamp"], + typename: "ChannelSnapshot", localBalance: !!obj["channel_snapshot_local_balance"] ? CurrencyAmountFromJson(obj["channel_snapshot_local_balance"]) : undefined, localUnsettledBalance: !!obj["channel_snapshot_local_unsettled_balance"] ? CurrencyAmountFromJson(obj["channel_snapshot_local_unsettled_balance"]) : undefined, - localChannelReserve: !!obj["channel_snapshot_local_channel_reserve"] - ? CurrencyAmountFromJson(obj["channel_snapshot_local_channel_reserve"]) - : undefined, remoteBalance: !!obj["channel_snapshot_remote_balance"] ? CurrencyAmountFromJson(obj["channel_snapshot_remote_balance"]) : undefined, remoteUnsettledBalance: !!obj["channel_snapshot_remote_unsettled_balance"] ? CurrencyAmountFromJson(obj["channel_snapshot_remote_unsettled_balance"]) : undefined, + status: obj["channel_snapshot_status"], + localChannelReserve: !!obj["channel_snapshot_local_channel_reserve"] + ? CurrencyAmountFromJson(obj["channel_snapshot_local_channel_reserve"]) + : undefined, } as ChannelSnapshot; }; export const ChannelSnapshotToJson = (obj: ChannelSnapshot): any => { return { - channel_snapshot_channel: { id: obj.channelId }, - channel_snapshot_timestamp: obj.timestamp, + __typename: "ChannelSnapshot", + channel_snapshot_id: obj.id, + channel_snapshot_created_at: obj.createdAt, + channel_snapshot_updated_at: obj.updatedAt, channel_snapshot_local_balance: obj.localBalance ? CurrencyAmountToJson(obj.localBalance) : undefined, channel_snapshot_local_unsettled_balance: obj.localUnsettledBalance ? CurrencyAmountToJson(obj.localUnsettledBalance) : undefined, - channel_snapshot_local_channel_reserve: obj.localChannelReserve - ? CurrencyAmountToJson(obj.localChannelReserve) - : undefined, channel_snapshot_remote_balance: obj.remoteBalance ? CurrencyAmountToJson(obj.remoteBalance) : undefined, channel_snapshot_remote_unsettled_balance: obj.remoteUnsettledBalance ? CurrencyAmountToJson(obj.remoteUnsettledBalance) : undefined, + channel_snapshot_status: obj.status, + channel_snapshot_channel: { id: obj.channelId }, + channel_snapshot_local_channel_reserve: obj.localChannelReserve + ? CurrencyAmountToJson(obj.localChannelReserve) + : undefined, + channel_snapshot_timestamp: obj.timestamp, }; }; export const FRAGMENT = ` fragment ChannelSnapshotFragment on ChannelSnapshot { __typename - channel_snapshot_channel: channel { - id - } - channel_snapshot_timestamp: timestamp + channel_snapshot_id: id + channel_snapshot_created_at: created_at + channel_snapshot_updated_at: updated_at channel_snapshot_local_balance: local_balance { __typename currency_amount_original_value: original_value @@ -88,7 +116,7 @@ fragment ChannelSnapshotFragment on ChannelSnapshot { currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } - channel_snapshot_local_channel_reserve: local_channel_reserve { + channel_snapshot_remote_balance: remote_balance { __typename currency_amount_original_value: original_value currency_amount_original_unit: original_unit @@ -96,7 +124,7 @@ fragment ChannelSnapshotFragment on ChannelSnapshot { currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } - channel_snapshot_remote_balance: remote_balance { + channel_snapshot_remote_unsettled_balance: remote_unsettled_balance { __typename currency_amount_original_value: original_value currency_amount_original_unit: original_unit @@ -104,7 +132,11 @@ fragment ChannelSnapshotFragment on ChannelSnapshot { currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } - channel_snapshot_remote_unsettled_balance: remote_unsettled_balance { + channel_snapshot_status: status + channel_snapshot_channel: channel { + id + } + channel_snapshot_local_channel_reserve: local_channel_reserve { __typename currency_amount_original_value: original_value currency_amount_original_unit: original_unit @@ -112,6 +144,25 @@ fragment ChannelSnapshotFragment on ChannelSnapshot { currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } + channel_snapshot_timestamp: timestamp }`; +export const getChannelSnapshotQuery = (id: string): Query => { + return { + queryPayload: ` +query GetChannelSnapshot($id: ID!) { + entity(id: $id) { + ... on ChannelSnapshot { + ...ChannelSnapshotFragment + } + } +} + +${FRAGMENT} +`, + variables: { id }, + constructObject: (data: any) => ChannelSnapshotFromJson(data.entity), + }; +}; + export default ChannelSnapshot; diff --git a/packages/lightspark-sdk/src/objects/ClaimUmaInvitationInput.ts b/packages/lightspark-sdk/src/objects/ClaimUmaInvitationInput.ts index 7b99882a5..9b8110d79 100644 --- a/packages/lightspark-sdk/src/objects/ClaimUmaInvitationInput.ts +++ b/packages/lightspark-sdk/src/objects/ClaimUmaInvitationInput.ts @@ -1,8 +1,13 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved interface ClaimUmaInvitationInput { + /** The unique code that identifies this invitation and was shared by the inviter. **/ invitationCode: string; + /** + * The UMA of the user claiming the invitation. It will be sent to the inviter so that they can + * start transacting with the invitee. + **/ inviteeUma: string; } diff --git a/packages/lightspark-sdk/src/objects/ClaimUmaInvitationOutput.ts b/packages/lightspark-sdk/src/objects/ClaimUmaInvitationOutput.ts index 1d1536b55..cdfb766b6 100644 --- a/packages/lightspark-sdk/src/objects/ClaimUmaInvitationOutput.ts +++ b/packages/lightspark-sdk/src/objects/ClaimUmaInvitationOutput.ts @@ -1,6 +1,7 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved interface ClaimUmaInvitationOutput { + /** An UMA.ME invitation object. **/ invitationId: string; } diff --git a/packages/lightspark-sdk/src/objects/ClaimUmaInvitationWithIncentivesInput.ts b/packages/lightspark-sdk/src/objects/ClaimUmaInvitationWithIncentivesInput.ts index 48c35c9ed..00f264668 100644 --- a/packages/lightspark-sdk/src/objects/ClaimUmaInvitationWithIncentivesInput.ts +++ b/packages/lightspark-sdk/src/objects/ClaimUmaInvitationWithIncentivesInput.ts @@ -3,12 +3,19 @@ import RegionCode from "./RegionCode.js"; interface ClaimUmaInvitationWithIncentivesInput { + /** The unique code that identifies this invitation and was shared by the inviter. **/ invitationCode: string; + /** + * The UMA of the user claiming the invitation. It will be sent to the inviter so that they can + * start transacting with the invitee. + **/ inviteeUma: string; + /** The phone hash of the user getting the invitation. **/ inviteePhoneHash: string; + /** The region of the user getting the invitation. **/ inviteeRegion: RegionCode; } diff --git a/packages/lightspark-sdk/src/objects/ClaimUmaInvitationWithIncentivesOutput.ts b/packages/lightspark-sdk/src/objects/ClaimUmaInvitationWithIncentivesOutput.ts index 65878c857..b9d7c8261 100644 --- a/packages/lightspark-sdk/src/objects/ClaimUmaInvitationWithIncentivesOutput.ts +++ b/packages/lightspark-sdk/src/objects/ClaimUmaInvitationWithIncentivesOutput.ts @@ -1,6 +1,7 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved interface ClaimUmaInvitationWithIncentivesOutput { + /** An UMA.ME invitation object. **/ invitationId: string; } diff --git a/packages/lightspark-sdk/src/objects/CreateApiTokenOutput.ts b/packages/lightspark-sdk/src/objects/CreateApiTokenOutput.ts index 48b4568f3..0a4460feb 100644 --- a/packages/lightspark-sdk/src/objects/CreateApiTokenOutput.ts +++ b/packages/lightspark-sdk/src/objects/CreateApiTokenOutput.ts @@ -41,6 +41,7 @@ fragment CreateApiTokenOutputFragment on CreateApiTokenOutput { api_token_client_id: client_id api_token_name: name api_token_permissions: permissions + api_token_is_deleted: is_deleted } create_api_token_output_client_secret: client_secret }`; diff --git a/packages/lightspark-sdk/src/objects/CreateInvitationWithIncentivesInput.ts b/packages/lightspark-sdk/src/objects/CreateInvitationWithIncentivesInput.ts index 3f78db9ea..aa63f8bf5 100644 --- a/packages/lightspark-sdk/src/objects/CreateInvitationWithIncentivesInput.ts +++ b/packages/lightspark-sdk/src/objects/CreateInvitationWithIncentivesInput.ts @@ -3,10 +3,16 @@ import RegionCode from "./RegionCode.js"; interface CreateInvitationWithIncentivesInput { + /** + * The UMA of the user creating the invitation. It will be used to identify the inviter when + * receiving the invitation. + **/ inviterUma: string; + /** The phone hash of the user creating the invitation. **/ inviterPhoneHash: string; + /** The region of the user creating the invitation. **/ inviterRegion: RegionCode; } diff --git a/packages/lightspark-sdk/src/objects/CreateInvitationWithIncentivesOutput.ts b/packages/lightspark-sdk/src/objects/CreateInvitationWithIncentivesOutput.ts index 768824f36..0cf061b73 100644 --- a/packages/lightspark-sdk/src/objects/CreateInvitationWithIncentivesOutput.ts +++ b/packages/lightspark-sdk/src/objects/CreateInvitationWithIncentivesOutput.ts @@ -1,6 +1,7 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved interface CreateInvitationWithIncentivesOutput { + /** The created invitation in the form of a string identifier. **/ invitationId: string; } diff --git a/packages/lightspark-sdk/src/objects/CreateInvoiceInput.ts b/packages/lightspark-sdk/src/objects/CreateInvoiceInput.ts index 847d2d554..69ec35719 100644 --- a/packages/lightspark-sdk/src/objects/CreateInvoiceInput.ts +++ b/packages/lightspark-sdk/src/objects/CreateInvoiceInput.ts @@ -6,7 +6,10 @@ interface CreateInvoiceInput { /** The node from which to create the invoice. **/ nodeId: string; - /** The amount for which the invoice should be created, in millisatoshis. **/ + /** + * The amount for which the invoice should be created, in millisatoshis. Setting the amount to + * 0 will allow the payer to specify an amount. + **/ amountMsats: number; memo?: string | undefined; diff --git a/packages/lightspark-sdk/src/objects/CreateNodeWalletAddressOutput.ts b/packages/lightspark-sdk/src/objects/CreateNodeWalletAddressOutput.ts index c894e19f2..7b031c01b 100644 --- a/packages/lightspark-sdk/src/objects/CreateNodeWalletAddressOutput.ts +++ b/packages/lightspark-sdk/src/objects/CreateNodeWalletAddressOutput.ts @@ -1,9 +1,23 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved +import type MultiSigAddressValidationParameters from "./MultiSigAddressValidationParameters.js"; +import { + MultiSigAddressValidationParametersFromJson, + MultiSigAddressValidationParametersToJson, +} from "./MultiSigAddressValidationParameters.js"; + interface CreateNodeWalletAddressOutput { nodeId: string; walletAddress: string; + + /** + * Vaildation parameters for the 2-of-2 multisig address. None if the address is not a 2-of-2 + * multisig address. + **/ + multisigWalletAddressValidationParameters?: + | MultiSigAddressValidationParameters + | undefined; } export const CreateNodeWalletAddressOutputFromJson = ( @@ -12,6 +26,15 @@ export const CreateNodeWalletAddressOutputFromJson = ( return { nodeId: obj["create_node_wallet_address_output_node"].id, walletAddress: obj["create_node_wallet_address_output_wallet_address"], + multisigWalletAddressValidationParameters: !!obj[ + "create_node_wallet_address_output_multisig_wallet_address_validation_parameters" + ] + ? MultiSigAddressValidationParametersFromJson( + obj[ + "create_node_wallet_address_output_multisig_wallet_address_validation_parameters" + ], + ) + : undefined, } as CreateNodeWalletAddressOutput; }; export const CreateNodeWalletAddressOutputToJson = ( @@ -20,6 +43,12 @@ export const CreateNodeWalletAddressOutputToJson = ( return { create_node_wallet_address_output_node: { id: obj.nodeId }, create_node_wallet_address_output_wallet_address: obj.walletAddress, + create_node_wallet_address_output_multisig_wallet_address_validation_parameters: + obj.multisigWalletAddressValidationParameters + ? MultiSigAddressValidationParametersToJson( + obj.multisigWalletAddressValidationParameters, + ) + : undefined, }; }; @@ -30,6 +59,11 @@ fragment CreateNodeWalletAddressOutputFragment on CreateNodeWalletAddressOutput id } create_node_wallet_address_output_wallet_address: wallet_address + create_node_wallet_address_output_multisig_wallet_address_validation_parameters: multisig_wallet_address_validation_parameters { + __typename + multi_sig_address_validation_parameters_counterparty_funding_pubkey: counterparty_funding_pubkey + multi_sig_address_validation_parameters_funding_pubkey_derivation_path: funding_pubkey_derivation_path + } }`; export default CreateNodeWalletAddressOutput; diff --git a/packages/lightspark-sdk/src/objects/CreateUmaInvitationInput.ts b/packages/lightspark-sdk/src/objects/CreateUmaInvitationInput.ts index 2d4cdf3ed..44b4cbcc8 100644 --- a/packages/lightspark-sdk/src/objects/CreateUmaInvitationInput.ts +++ b/packages/lightspark-sdk/src/objects/CreateUmaInvitationInput.ts @@ -1,6 +1,10 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved interface CreateUmaInvitationInput { + /** + * The UMA of the user creating the invitation. It will be used to identify the inviter when + * receiving the invitation. + **/ inviterUma: string; } diff --git a/packages/lightspark-sdk/src/objects/CreateUmaInvitationOutput.ts b/packages/lightspark-sdk/src/objects/CreateUmaInvitationOutput.ts index 4bdf5cde7..7e0aa7d88 100644 --- a/packages/lightspark-sdk/src/objects/CreateUmaInvitationOutput.ts +++ b/packages/lightspark-sdk/src/objects/CreateUmaInvitationOutput.ts @@ -1,6 +1,7 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved interface CreateUmaInvitationOutput { + /** The created invitation in the form of a string identifier. **/ invitationId: string; } diff --git a/packages/lightspark-sdk/src/objects/Entity.ts b/packages/lightspark-sdk/src/objects/Entity.ts index b9e603846..b66ee96bf 100644 --- a/packages/lightspark-sdk/src/objects/Entity.ts +++ b/packages/lightspark-sdk/src/objects/Entity.ts @@ -40,6 +40,7 @@ fragment EntityFragment on Entity { api_token_client_id: client_id api_token_name: name api_token_permissions: permissions + api_token_is_deleted: is_deleted } ... on Channel { __typename @@ -199,6 +200,57 @@ fragment EntityFragment on Entity { id } } + ... on ChannelSnapshot { + __typename + channel_snapshot_id: id + channel_snapshot_created_at: created_at + channel_snapshot_updated_at: updated_at + channel_snapshot_local_balance: local_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + channel_snapshot_local_unsettled_balance: local_unsettled_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + channel_snapshot_remote_balance: remote_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + channel_snapshot_remote_unsettled_balance: remote_unsettled_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + channel_snapshot_status: status + channel_snapshot_channel: channel { + id + } + channel_snapshot_local_channel_reserve: local_channel_reserve { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + channel_snapshot_timestamp: timestamp + } ... on Deposit { __typename deposit_id: id @@ -287,6 +339,7 @@ fragment EntityFragment on Entity { currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } incoming_payment_transaction_hash: transaction_hash + incoming_payment_is_uma: is_uma incoming_payment_destination: destination { id } @@ -305,6 +358,7 @@ fragment EntityFragment on Entity { currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } } + incoming_payment_is_internal_payment: is_internal_payment } ... on IncomingPaymentAttempt { __typename @@ -906,6 +960,7 @@ fragment EntityFragment on Entity { currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } outgoing_payment_transaction_hash: transaction_hash + outgoing_payment_is_uma: is_uma outgoing_payment_origin: origin { id } @@ -1232,6 +1287,7 @@ fragment EntityFragment on Entity { } } outgoing_payment_payment_preimage: payment_preimage + outgoing_payment_is_internal_payment: is_internal_payment } ... on OutgoingPaymentAttempt { __typename @@ -1263,51 +1319,7 @@ fragment EntityFragment on Entity { id } outgoing_payment_attempt_channel_snapshot: channel_snapshot { - __typename - channel_snapshot_channel: channel { - id - } - channel_snapshot_timestamp: timestamp - channel_snapshot_local_balance: local_balance { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } - channel_snapshot_local_unsettled_balance: local_unsettled_balance { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } - channel_snapshot_local_channel_reserve: local_channel_reserve { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } - channel_snapshot_remote_balance: remote_balance { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } - channel_snapshot_remote_unsettled_balance: remote_unsettled_balance { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } + id } } ... on RoutingTransaction { diff --git a/packages/lightspark-sdk/src/objects/IncomingPayment.ts b/packages/lightspark-sdk/src/objects/IncomingPayment.ts index fed376c02..18c8ac87e 100644 --- a/packages/lightspark-sdk/src/objects/IncomingPayment.ts +++ b/packages/lightspark-sdk/src/objects/IncomingPayment.ts @@ -41,8 +41,15 @@ class IncomingPayment implements LightningTransaction, Transaction, Entity { public readonly status: TransactionStatus, /** The amount of money involved in this transaction. **/ public readonly amount: CurrencyAmount, + /** + * Whether this payment is an UMA payment or not. NOTE: this field is only set if the invoice + * that is being paid has been created using the recommended `create_uma_invoice` function. + **/ + public readonly isUma: boolean, /** The recipient Lightspark node this payment was sent to. **/ public readonly destinationId: string, + /** Whether the payment is made from the same node. **/ + public readonly isInternalPayment: boolean, /** The typename of the object **/ public readonly typename: string, /** The date and time when this transaction was completed or failed. **/ @@ -146,11 +153,13 @@ ${FRAGMENT} incoming_payment_resolved_at: this.resolvedAt, incoming_payment_amount: CurrencyAmountToJson(this.amount), incoming_payment_transaction_hash: this.transactionHash, + incoming_payment_is_uma: this.isUma, incoming_payment_destination: { id: this.destinationId }, incoming_payment_payment_request: { id: this.paymentRequestId } ?? undefined, incoming_payment_uma_post_transaction_data: this.umaPostTransactionData?.map((e) => PostTransactionDataToJson(e)), + incoming_payment_is_internal_payment: this.isInternalPayment, }; } } @@ -163,7 +172,9 @@ export const IncomingPaymentFromJson = (obj: any): IncomingPayment => { TransactionStatus[obj["incoming_payment_status"]] ?? TransactionStatus.FUTURE_VALUE, CurrencyAmountFromJson(obj["incoming_payment_amount"]), + obj["incoming_payment_is_uma"], obj["incoming_payment_destination"].id, + obj["incoming_payment_is_internal_payment"], "IncomingPayment", obj["incoming_payment_resolved_at"], obj["incoming_payment_transaction_hash"], @@ -191,6 +202,7 @@ fragment IncomingPaymentFragment on IncomingPayment { currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } incoming_payment_transaction_hash: transaction_hash + incoming_payment_is_uma: is_uma incoming_payment_destination: destination { id } @@ -209,6 +221,7 @@ fragment IncomingPaymentFragment on IncomingPayment { currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } } + incoming_payment_is_internal_payment: is_internal_payment }`; export default IncomingPayment; diff --git a/packages/lightspark-sdk/src/objects/IncomingPaymentsForInvoiceQueryInput.ts b/packages/lightspark-sdk/src/objects/IncomingPaymentsForInvoiceQueryInput.ts new file mode 100644 index 000000000..5146a3c84 --- /dev/null +++ b/packages/lightspark-sdk/src/objects/IncomingPaymentsForInvoiceQueryInput.ts @@ -0,0 +1,31 @@ +// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved + +import TransactionStatus from "./TransactionStatus.js"; + +interface IncomingPaymentsForInvoiceQueryInput { + invoiceId: string; + + /** An optional filter to only query outgoing payments of given statuses. **/ + statuses?: TransactionStatus[] | undefined; +} + +export const IncomingPaymentsForInvoiceQueryInputFromJson = ( + obj: any, +): IncomingPaymentsForInvoiceQueryInput => { + return { + invoiceId: obj["incoming_payments_for_invoice_query_input_invoice_id"], + statuses: obj["incoming_payments_for_invoice_query_input_statuses"]?.map( + (e) => TransactionStatus[e], + ), + } as IncomingPaymentsForInvoiceQueryInput; +}; +export const IncomingPaymentsForInvoiceQueryInputToJson = ( + obj: IncomingPaymentsForInvoiceQueryInput, +): any => { + return { + incoming_payments_for_invoice_query_input_invoice_id: obj.invoiceId, + incoming_payments_for_invoice_query_input_statuses: obj.statuses, + }; +}; + +export default IncomingPaymentsForInvoiceQueryInput; diff --git a/packages/lightspark-sdk/src/objects/IncomingPaymentsForInvoiceQueryOutput.ts b/packages/lightspark-sdk/src/objects/IncomingPaymentsForInvoiceQueryOutput.ts new file mode 100644 index 000000000..90fa0c8fa --- /dev/null +++ b/packages/lightspark-sdk/src/objects/IncomingPaymentsForInvoiceQueryOutput.ts @@ -0,0 +1,71 @@ +// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved + +import type IncomingPayment from "./IncomingPayment.js"; +import { IncomingPaymentFromJson } from "./IncomingPayment.js"; + +interface IncomingPaymentsForInvoiceQueryOutput { + payments: IncomingPayment[]; +} + +export const IncomingPaymentsForInvoiceQueryOutputFromJson = ( + obj: any, +): IncomingPaymentsForInvoiceQueryOutput => { + return { + payments: obj["incoming_payments_for_invoice_query_output_payments"].map( + (e) => IncomingPaymentFromJson(e), + ), + } as IncomingPaymentsForInvoiceQueryOutput; +}; +export const IncomingPaymentsForInvoiceQueryOutputToJson = ( + obj: IncomingPaymentsForInvoiceQueryOutput, +): any => { + return { + incoming_payments_for_invoice_query_output_payments: obj.payments.map((e) => + e.toJson(), + ), + }; +}; + +export const FRAGMENT = ` +fragment IncomingPaymentsForInvoiceQueryOutputFragment on IncomingPaymentsForInvoiceQueryOutput { + __typename + incoming_payments_for_invoice_query_output_payments: payments { + __typename + incoming_payment_id: id + incoming_payment_created_at: created_at + incoming_payment_updated_at: updated_at + incoming_payment_status: status + incoming_payment_resolved_at: resolved_at + incoming_payment_amount: amount { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + incoming_payment_transaction_hash: transaction_hash + incoming_payment_is_uma: is_uma + incoming_payment_destination: destination { + id + } + incoming_payment_payment_request: payment_request { + id + } + incoming_payment_uma_post_transaction_data: uma_post_transaction_data { + __typename + post_transaction_data_utxo: utxo + post_transaction_data_amount: amount { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + } + incoming_payment_is_internal_payment: is_internal_payment + } +}`; + +export default IncomingPaymentsForInvoiceQueryOutput; diff --git a/packages/lightspark-sdk/src/objects/LightningTransaction.ts b/packages/lightspark-sdk/src/objects/LightningTransaction.ts index 3cd37edf9..7c709e543 100644 --- a/packages/lightspark-sdk/src/objects/LightningTransaction.ts +++ b/packages/lightspark-sdk/src/objects/LightningTransaction.ts @@ -67,7 +67,9 @@ export const LightningTransactionFromJson = ( TransactionStatus[obj["incoming_payment_status"]] ?? TransactionStatus.FUTURE_VALUE, CurrencyAmountFromJson(obj["incoming_payment_amount"]), + obj["incoming_payment_is_uma"], obj["incoming_payment_destination"].id, + obj["incoming_payment_is_internal_payment"], "IncomingPayment", obj["incoming_payment_resolved_at"], obj["incoming_payment_transaction_hash"], @@ -85,7 +87,9 @@ export const LightningTransactionFromJson = ( TransactionStatus[obj["outgoing_payment_status"]] ?? TransactionStatus.FUTURE_VALUE, CurrencyAmountFromJson(obj["outgoing_payment_amount"]), + obj["outgoing_payment_is_uma"], obj["outgoing_payment_origin"].id, + obj["outgoing_payment_is_internal_payment"], "OutgoingPayment", obj["outgoing_payment_resolved_at"], obj["outgoing_payment_transaction_hash"], @@ -157,6 +161,7 @@ export const LightningTransactionToJson = (obj: LightningTransaction): any => { incoming_payment_resolved_at: incomingPayment.resolvedAt, incoming_payment_amount: CurrencyAmountToJson(incomingPayment.amount), incoming_payment_transaction_hash: incomingPayment.transactionHash, + incoming_payment_is_uma: incomingPayment.isUma, incoming_payment_destination: { id: incomingPayment.destinationId }, incoming_payment_payment_request: { id: incomingPayment.paymentRequestId } ?? undefined, @@ -164,6 +169,7 @@ export const LightningTransactionToJson = (obj: LightningTransaction): any => { incomingPayment.umaPostTransactionData?.map((e) => PostTransactionDataToJson(e), ), + incoming_payment_is_internal_payment: incomingPayment.isInternalPayment, }; } if (obj.typename == "OutgoingPayment") { @@ -177,6 +183,7 @@ export const LightningTransactionToJson = (obj: LightningTransaction): any => { outgoing_payment_resolved_at: outgoingPayment.resolvedAt, outgoing_payment_amount: CurrencyAmountToJson(outgoingPayment.amount), outgoing_payment_transaction_hash: outgoingPayment.transactionHash, + outgoing_payment_is_uma: outgoingPayment.isUma, outgoing_payment_origin: { id: outgoingPayment.originId }, outgoing_payment_destination: { id: outgoingPayment.destinationId } ?? undefined, @@ -195,6 +202,7 @@ export const LightningTransactionToJson = (obj: LightningTransaction): any => { PostTransactionDataToJson(e), ), outgoing_payment_payment_preimage: outgoingPayment.paymentPreimage, + outgoing_payment_is_internal_payment: outgoingPayment.isInternalPayment, }; } if (obj.typename == "RoutingTransaction") { @@ -248,6 +256,7 @@ fragment LightningTransactionFragment on LightningTransaction { currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } incoming_payment_transaction_hash: transaction_hash + incoming_payment_is_uma: is_uma incoming_payment_destination: destination { id } @@ -266,6 +275,7 @@ fragment LightningTransactionFragment on LightningTransaction { currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } } + incoming_payment_is_internal_payment: is_internal_payment } ... on OutgoingPayment { __typename @@ -283,6 +293,7 @@ fragment LightningTransactionFragment on LightningTransaction { currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } outgoing_payment_transaction_hash: transaction_hash + outgoing_payment_is_uma: is_uma outgoing_payment_origin: origin { id } @@ -609,6 +620,7 @@ fragment LightningTransactionFragment on LightningTransaction { } } outgoing_payment_payment_preimage: payment_preimage + outgoing_payment_is_internal_payment: is_internal_payment } ... on RoutingTransaction { __typename diff --git a/packages/lightspark-sdk/src/objects/MultiSigAddressValidationParameters.ts b/packages/lightspark-sdk/src/objects/MultiSigAddressValidationParameters.ts new file mode 100644 index 000000000..16f5e2a79 --- /dev/null +++ b/packages/lightspark-sdk/src/objects/MultiSigAddressValidationParameters.ts @@ -0,0 +1,45 @@ +// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved + +interface MultiSigAddressValidationParameters { + /** The counterparty funding public key used to create the 2-of-2 multisig for the address. **/ + counterpartyFundingPubkey: string; + + /** + * The derivation path used to derive the funding public key for the 2-of-2 multisig address. * + */ + fundingPubkeyDerivationPath: string; +} + +export const MultiSigAddressValidationParametersFromJson = ( + obj: any, +): MultiSigAddressValidationParameters => { + return { + counterpartyFundingPubkey: + obj[ + "multi_sig_address_validation_parameters_counterparty_funding_pubkey" + ], + fundingPubkeyDerivationPath: + obj[ + "multi_sig_address_validation_parameters_funding_pubkey_derivation_path" + ], + } as MultiSigAddressValidationParameters; +}; +export const MultiSigAddressValidationParametersToJson = ( + obj: MultiSigAddressValidationParameters, +): any => { + return { + multi_sig_address_validation_parameters_counterparty_funding_pubkey: + obj.counterpartyFundingPubkey, + multi_sig_address_validation_parameters_funding_pubkey_derivation_path: + obj.fundingPubkeyDerivationPath, + }; +}; + +export const FRAGMENT = ` +fragment MultiSigAddressValidationParametersFragment on MultiSigAddressValidationParameters { + __typename + multi_sig_address_validation_parameters_counterparty_funding_pubkey: counterparty_funding_pubkey + multi_sig_address_validation_parameters_funding_pubkey_derivation_path: funding_pubkey_derivation_path +}`; + +export default MultiSigAddressValidationParameters; diff --git a/packages/lightspark-sdk/src/objects/OutgoingPayment.ts b/packages/lightspark-sdk/src/objects/OutgoingPayment.ts index 8d259b8b0..a05ce5540 100644 --- a/packages/lightspark-sdk/src/objects/OutgoingPayment.ts +++ b/packages/lightspark-sdk/src/objects/OutgoingPayment.ts @@ -48,8 +48,15 @@ class OutgoingPayment implements LightningTransaction, Transaction, Entity { public readonly status: TransactionStatus, /** The amount of money involved in this transaction. **/ public readonly amount: CurrencyAmount, + /** + * Whether this payment is an UMA payment or not. NOTE: this field is only set if the payment + * has been sent using the recommended `pay_uma_invoice` function. + **/ + public readonly isUma: boolean, /** The Lightspark node this payment originated from. **/ public readonly originId: string, + /** Whether the payment is made to the same node. **/ + public readonly isInternalPayment: boolean, /** The typename of the object **/ public readonly typename: string, /** The date and time when this transaction was completed or failed. **/ @@ -124,51 +131,7 @@ query FetchOutgoingPaymentToAttemptsConnection($entity_id: ID!, $first: Int, $af id } outgoing_payment_attempt_channel_snapshot: channel_snapshot { - __typename - channel_snapshot_channel: channel { - id - } - channel_snapshot_timestamp: timestamp - channel_snapshot_local_balance: local_balance { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } - channel_snapshot_local_unsettled_balance: local_unsettled_balance { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } - channel_snapshot_local_channel_reserve: local_channel_reserve { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } - channel_snapshot_remote_balance: remote_balance { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } - channel_snapshot_remote_unsettled_balance: remote_unsettled_balance { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } + id } } } @@ -212,6 +175,7 @@ ${FRAGMENT} outgoing_payment_resolved_at: this.resolvedAt, outgoing_payment_amount: CurrencyAmountToJson(this.amount), outgoing_payment_transaction_hash: this.transactionHash, + outgoing_payment_is_uma: this.isUma, outgoing_payment_origin: { id: this.originId }, outgoing_payment_destination: { id: this.destinationId } ?? undefined, outgoing_payment_fees: this.fees @@ -227,6 +191,7 @@ ${FRAGMENT} outgoing_payment_uma_post_transaction_data: this.umaPostTransactionData?.map((e) => PostTransactionDataToJson(e)), outgoing_payment_payment_preimage: this.paymentPreimage, + outgoing_payment_is_internal_payment: this.isInternalPayment, }; } } @@ -239,7 +204,9 @@ export const OutgoingPaymentFromJson = (obj: any): OutgoingPayment => { TransactionStatus[obj["outgoing_payment_status"]] ?? TransactionStatus.FUTURE_VALUE, CurrencyAmountFromJson(obj["outgoing_payment_amount"]), + obj["outgoing_payment_is_uma"], obj["outgoing_payment_origin"].id, + obj["outgoing_payment_is_internal_payment"], "OutgoingPayment", obj["outgoing_payment_resolved_at"], obj["outgoing_payment_transaction_hash"], @@ -281,6 +248,7 @@ fragment OutgoingPaymentFragment on OutgoingPayment { currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } outgoing_payment_transaction_hash: transaction_hash + outgoing_payment_is_uma: is_uma outgoing_payment_origin: origin { id } @@ -607,6 +575,7 @@ fragment OutgoingPaymentFragment on OutgoingPayment { } } outgoing_payment_payment_preimage: payment_preimage + outgoing_payment_is_internal_payment: is_internal_payment }`; export default OutgoingPayment; diff --git a/packages/lightspark-sdk/src/objects/OutgoingPaymentAttempt.ts b/packages/lightspark-sdk/src/objects/OutgoingPaymentAttempt.ts index 18f49bf88..03e75ecfd 100644 --- a/packages/lightspark-sdk/src/objects/OutgoingPaymentAttempt.ts +++ b/packages/lightspark-sdk/src/objects/OutgoingPaymentAttempt.ts @@ -3,11 +3,6 @@ import { type Query } from "@lightsparkdev/core"; import autoBind from "auto-bind"; import type LightsparkClient from "../client.js"; -import type ChannelSnapshot from "./ChannelSnapshot.js"; -import { - ChannelSnapshotFromJson, - ChannelSnapshotToJson, -} from "./ChannelSnapshot.js"; import type CurrencyAmount from "./CurrencyAmount.js"; import { CurrencyAmountFromJson, @@ -66,7 +61,7 @@ class OutgoingPaymentAttempt implements Entity { **/ public readonly fees?: CurrencyAmount | undefined, /** The channel snapshot at the time the outgoing payment attempt was made. **/ - public readonly channelSnapshot?: ChannelSnapshot | undefined, + public readonly channelSnapshotId?: string | undefined, ) { autoBind(this); } @@ -171,9 +166,8 @@ ${FRAGMENT} ? CurrencyAmountToJson(this.fees) : undefined, outgoing_payment_attempt_outgoing_payment: { id: this.outgoingPaymentId }, - outgoing_payment_attempt_channel_snapshot: this.channelSnapshot - ? ChannelSnapshotToJson(this.channelSnapshot) - : undefined, + outgoing_payment_attempt_channel_snapshot: + { id: this.channelSnapshotId } ?? undefined, }; } } @@ -202,11 +196,7 @@ export const OutgoingPaymentAttemptFromJson = ( !!obj["outgoing_payment_attempt_fees"] ? CurrencyAmountFromJson(obj["outgoing_payment_attempt_fees"]) : undefined, - !!obj["outgoing_payment_attempt_channel_snapshot"] - ? ChannelSnapshotFromJson( - obj["outgoing_payment_attempt_channel_snapshot"], - ) - : undefined, + obj["outgoing_payment_attempt_channel_snapshot"]?.id ?? undefined, ); }; @@ -241,51 +231,7 @@ fragment OutgoingPaymentAttemptFragment on OutgoingPaymentAttempt { id } outgoing_payment_attempt_channel_snapshot: channel_snapshot { - __typename - channel_snapshot_channel: channel { - id - } - channel_snapshot_timestamp: timestamp - channel_snapshot_local_balance: local_balance { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } - channel_snapshot_local_unsettled_balance: local_unsettled_balance { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } - channel_snapshot_local_channel_reserve: local_channel_reserve { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } - channel_snapshot_remote_balance: remote_balance { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } - channel_snapshot_remote_unsettled_balance: remote_unsettled_balance { - __typename - currency_amount_original_value: original_value - currency_amount_original_unit: original_unit - currency_amount_preferred_currency_unit: preferred_currency_unit - currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded - currency_amount_preferred_currency_value_approx: preferred_currency_value_approx - } + id } }`; diff --git a/packages/lightspark-sdk/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts b/packages/lightspark-sdk/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts index 50e184c79..4ea040919 100644 --- a/packages/lightspark-sdk/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +++ b/packages/lightspark-sdk/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts @@ -30,7 +30,349 @@ export const FRAGMENT = ` fragment OutgoingPaymentsForInvoiceQueryOutputFragment on OutgoingPaymentsForInvoiceQueryOutput { __typename outgoing_payments_for_invoice_query_output_payments: payments { - id + __typename + outgoing_payment_id: id + outgoing_payment_created_at: created_at + outgoing_payment_updated_at: updated_at + outgoing_payment_status: status + outgoing_payment_resolved_at: resolved_at + outgoing_payment_amount: amount { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + outgoing_payment_transaction_hash: transaction_hash + outgoing_payment_is_uma: is_uma + outgoing_payment_origin: origin { + id + } + outgoing_payment_destination: destination { + id + } + outgoing_payment_fees: fees { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + outgoing_payment_payment_request_data: payment_request_data { + __typename + ... on InvoiceData { + __typename + invoice_data_encoded_payment_request: encoded_payment_request + invoice_data_bitcoin_network: bitcoin_network + invoice_data_payment_hash: payment_hash + invoice_data_amount: amount { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + invoice_data_created_at: created_at + invoice_data_expires_at: expires_at + invoice_data_memo: memo + invoice_data_destination: destination { + __typename + ... on GraphNode { + __typename + graph_node_id: id + graph_node_created_at: created_at + graph_node_updated_at: updated_at + graph_node_alias: alias + graph_node_bitcoin_network: bitcoin_network + graph_node_color: color + graph_node_conductivity: conductivity + graph_node_display_name: display_name + graph_node_public_key: public_key + } + ... on LightsparkNodeWithOSK { + __typename + lightspark_node_with_o_s_k_id: id + lightspark_node_with_o_s_k_created_at: created_at + lightspark_node_with_o_s_k_updated_at: updated_at + lightspark_node_with_o_s_k_alias: alias + lightspark_node_with_o_s_k_bitcoin_network: bitcoin_network + lightspark_node_with_o_s_k_color: color + lightspark_node_with_o_s_k_conductivity: conductivity + lightspark_node_with_o_s_k_display_name: display_name + lightspark_node_with_o_s_k_public_key: public_key + lightspark_node_with_o_s_k_owner: owner { + id + } + lightspark_node_with_o_s_k_status: status + lightspark_node_with_o_s_k_total_balance: total_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + lightspark_node_with_o_s_k_total_local_balance: total_local_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + lightspark_node_with_o_s_k_local_balance: local_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + lightspark_node_with_o_s_k_remote_balance: remote_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + lightspark_node_with_o_s_k_blockchain_balance: blockchain_balance { + __typename + blockchain_balance_total_balance: total_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + blockchain_balance_confirmed_balance: confirmed_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + blockchain_balance_unconfirmed_balance: unconfirmed_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + blockchain_balance_locked_balance: locked_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + blockchain_balance_required_reserve: required_reserve { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + blockchain_balance_available_balance: available_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + } + lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos + lightspark_node_with_o_s_k_balances: balances { + __typename + balances_owned_balance: owned_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + balances_available_to_send_balance: available_to_send_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + balances_available_to_withdraw_balance: available_to_withdraw_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + } + lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key { + __typename + secret_encrypted_value: encrypted_value + secret_cipher: cipher + } + } + ... on LightsparkNodeWithRemoteSigning { + __typename + lightspark_node_with_remote_signing_id: id + lightspark_node_with_remote_signing_created_at: created_at + lightspark_node_with_remote_signing_updated_at: updated_at + lightspark_node_with_remote_signing_alias: alias + lightspark_node_with_remote_signing_bitcoin_network: bitcoin_network + lightspark_node_with_remote_signing_color: color + lightspark_node_with_remote_signing_conductivity: conductivity + lightspark_node_with_remote_signing_display_name: display_name + lightspark_node_with_remote_signing_public_key: public_key + lightspark_node_with_remote_signing_owner: owner { + id + } + lightspark_node_with_remote_signing_status: status + lightspark_node_with_remote_signing_total_balance: total_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + lightspark_node_with_remote_signing_total_local_balance: total_local_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + lightspark_node_with_remote_signing_local_balance: local_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + lightspark_node_with_remote_signing_remote_balance: remote_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + lightspark_node_with_remote_signing_blockchain_balance: blockchain_balance { + __typename + blockchain_balance_total_balance: total_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + blockchain_balance_confirmed_balance: confirmed_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + blockchain_balance_unconfirmed_balance: unconfirmed_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + blockchain_balance_locked_balance: locked_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + blockchain_balance_required_reserve: required_reserve { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + blockchain_balance_available_balance: available_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + } + lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos + lightspark_node_with_remote_signing_balances: balances { + __typename + balances_owned_balance: owned_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + balances_available_to_send_balance: available_to_send_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + balances_available_to_withdraw_balance: available_to_withdraw_balance { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + } + } + } + } + } + outgoing_payment_failure_reason: failure_reason + outgoing_payment_failure_message: failure_message { + __typename + rich_text_text: text + } + outgoing_payment_uma_post_transaction_data: uma_post_transaction_data { + __typename + post_transaction_data_utxo: utxo + post_transaction_data_amount: amount { + __typename + currency_amount_original_value: original_value + currency_amount_original_unit: original_unit + currency_amount_preferred_currency_unit: preferred_currency_unit + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx + } + } + outgoing_payment_payment_preimage: payment_preimage + outgoing_payment_is_internal_payment: is_internal_payment } }`; diff --git a/packages/lightspark-sdk/src/objects/PaymentFailureReason.ts b/packages/lightspark-sdk/src/objects/PaymentFailureReason.ts index 97ee7946d..bb6263f60 100644 --- a/packages/lightspark-sdk/src/objects/PaymentFailureReason.ts +++ b/packages/lightspark-sdk/src/objects/PaymentFailureReason.ts @@ -29,6 +29,8 @@ export enum PaymentFailureReason { INVOICE_EXPIRED = "INVOICE_EXPIRED", + INVOICE_CANCELLED = "INVOICE_CANCELLED", + RISK_SCREENING_FAILED = "RISK_SCREENING_FAILED", } diff --git a/packages/lightspark-sdk/src/objects/Transaction.ts b/packages/lightspark-sdk/src/objects/Transaction.ts index c828af029..a1bc022c1 100644 --- a/packages/lightspark-sdk/src/objects/Transaction.ts +++ b/packages/lightspark-sdk/src/objects/Transaction.ts @@ -137,7 +137,9 @@ export const TransactionFromJson = (obj: any): Transaction => { TransactionStatus[obj["incoming_payment_status"]] ?? TransactionStatus.FUTURE_VALUE, CurrencyAmountFromJson(obj["incoming_payment_amount"]), + obj["incoming_payment_is_uma"], obj["incoming_payment_destination"].id, + obj["incoming_payment_is_internal_payment"], "IncomingPayment", obj["incoming_payment_resolved_at"], obj["incoming_payment_transaction_hash"], @@ -155,7 +157,9 @@ export const TransactionFromJson = (obj: any): Transaction => { TransactionStatus[obj["outgoing_payment_status"]] ?? TransactionStatus.FUTURE_VALUE, CurrencyAmountFromJson(obj["outgoing_payment_amount"]), + obj["outgoing_payment_is_uma"], obj["outgoing_payment_origin"].id, + obj["outgoing_payment_is_internal_payment"], "OutgoingPayment", obj["outgoing_payment_resolved_at"], obj["outgoing_payment_transaction_hash"], @@ -334,6 +338,7 @@ export const TransactionToJson = (obj: Transaction): any => { incoming_payment_resolved_at: incomingPayment.resolvedAt, incoming_payment_amount: CurrencyAmountToJson(incomingPayment.amount), incoming_payment_transaction_hash: incomingPayment.transactionHash, + incoming_payment_is_uma: incomingPayment.isUma, incoming_payment_destination: { id: incomingPayment.destinationId }, incoming_payment_payment_request: { id: incomingPayment.paymentRequestId } ?? undefined, @@ -341,6 +346,7 @@ export const TransactionToJson = (obj: Transaction): any => { incomingPayment.umaPostTransactionData?.map((e) => PostTransactionDataToJson(e), ), + incoming_payment_is_internal_payment: incomingPayment.isInternalPayment, }; } if (obj.typename == "OutgoingPayment") { @@ -354,6 +360,7 @@ export const TransactionToJson = (obj: Transaction): any => { outgoing_payment_resolved_at: outgoingPayment.resolvedAt, outgoing_payment_amount: CurrencyAmountToJson(outgoingPayment.amount), outgoing_payment_transaction_hash: outgoingPayment.transactionHash, + outgoing_payment_is_uma: outgoingPayment.isUma, outgoing_payment_origin: { id: outgoingPayment.originId }, outgoing_payment_destination: { id: outgoingPayment.destinationId } ?? undefined, @@ -372,6 +379,7 @@ export const TransactionToJson = (obj: Transaction): any => { PostTransactionDataToJson(e), ), outgoing_payment_payment_preimage: outgoingPayment.paymentPreimage, + outgoing_payment_is_internal_payment: outgoingPayment.isInternalPayment, }; } if (obj.typename == "RoutingTransaction") { @@ -542,6 +550,7 @@ fragment TransactionFragment on Transaction { currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } incoming_payment_transaction_hash: transaction_hash + incoming_payment_is_uma: is_uma incoming_payment_destination: destination { id } @@ -560,6 +569,7 @@ fragment TransactionFragment on Transaction { currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } } + incoming_payment_is_internal_payment: is_internal_payment } ... on OutgoingPayment { __typename @@ -577,6 +587,7 @@ fragment TransactionFragment on Transaction { currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } outgoing_payment_transaction_hash: transaction_hash + outgoing_payment_is_uma: is_uma outgoing_payment_origin: origin { id } @@ -903,6 +914,7 @@ fragment TransactionFragment on Transaction { } } outgoing_payment_payment_preimage: payment_preimage + outgoing_payment_is_internal_payment: is_internal_payment } ... on RoutingTransaction { __typename diff --git a/packages/lightspark-sdk/src/objects/Wallet.ts b/packages/lightspark-sdk/src/objects/Wallet.ts index b6c2f60ed..f53cbee35 100644 --- a/packages/lightspark-sdk/src/objects/Wallet.ts +++ b/packages/lightspark-sdk/src/objects/Wallet.ts @@ -192,6 +192,7 @@ query FetchWalletToTransactionsConnection($entity_id: ID!, $first: Int, $after: currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } incoming_payment_transaction_hash: transaction_hash + incoming_payment_is_uma: is_uma incoming_payment_destination: destination { id } @@ -210,6 +211,7 @@ query FetchWalletToTransactionsConnection($entity_id: ID!, $first: Int, $after: currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } } + incoming_payment_is_internal_payment: is_internal_payment } ... on OutgoingPayment { __typename @@ -227,6 +229,7 @@ query FetchWalletToTransactionsConnection($entity_id: ID!, $first: Int, $after: currency_amount_preferred_currency_value_approx: preferred_currency_value_approx } outgoing_payment_transaction_hash: transaction_hash + outgoing_payment_is_uma: is_uma outgoing_payment_origin: origin { id } @@ -553,6 +556,7 @@ query FetchWalletToTransactionsConnection($entity_id: ID!, $first: Int, $after: } } outgoing_payment_payment_preimage: payment_preimage + outgoing_payment_is_internal_payment: is_internal_payment } ... on RoutingTransaction { __typename diff --git a/packages/lightspark-sdk/src/objects/WebhookEventType.ts b/packages/lightspark-sdk/src/objects/WebhookEventType.ts index 5b997a1c2..b0a4e2926 100644 --- a/packages/lightspark-sdk/src/objects/WebhookEventType.ts +++ b/packages/lightspark-sdk/src/objects/WebhookEventType.ts @@ -36,6 +36,8 @@ export enum WebhookEventType { REMOTE_SIGNING = "REMOTE_SIGNING", LOW_BALANCE = "LOW_BALANCE", + + HIGH_BALANCE = "HIGH_BALANCE", } export default WebhookEventType; diff --git a/packages/lightspark-sdk/src/objects/WithdrawalRequestStatus.ts b/packages/lightspark-sdk/src/objects/WithdrawalRequestStatus.ts index ef59ede54..3e8f6cfbd 100644 --- a/packages/lightspark-sdk/src/objects/WithdrawalRequestStatus.ts +++ b/packages/lightspark-sdk/src/objects/WithdrawalRequestStatus.ts @@ -15,6 +15,8 @@ export enum WithdrawalRequestStatus { IN_PROGRESS = "IN_PROGRESS", SUCCESSFUL = "SUCCESSFUL", + + PARTIALLY_SUCCESSFUL = "PARTIALLY_SUCCESSFUL", } export default WithdrawalRequestStatus; diff --git a/packages/lightspark-sdk/src/objects/index.ts b/packages/lightspark-sdk/src/objects/index.ts index 5ed7a21a0..d586ec82d 100644 --- a/packages/lightspark-sdk/src/objects/index.ts +++ b/packages/lightspark-sdk/src/objects/index.ts @@ -7,6 +7,10 @@ export { default as AccountToTransactionsConnection } from "./AccountToTransacti export { default as AccountToWalletsConnection } from "./AccountToWalletsConnection.js"; export { default as AccountToWithdrawalRequestsConnection } from "./AccountToWithdrawalRequestsConnection.js"; export { default as ApiToken, getApiTokenQuery } from "./ApiToken.js"; +export { + default as AuditLogActor, + getAuditLogActorQuery, +} from "./AuditLogActor.js"; export { default as Balances } from "./Balances.js"; export { default as BitcoinNetwork } from "./BitcoinNetwork.js"; export { default as BlockchainBalance } from "./BlockchainBalance.js"; @@ -22,7 +26,10 @@ export { default as ChannelOpeningTransaction, getChannelOpeningTransactionQuery, } from "./ChannelOpeningTransaction.js"; -export { default as ChannelSnapshot } from "./ChannelSnapshot.js"; +export { + default as ChannelSnapshot, + getChannelSnapshotQuery, +} from "./ChannelSnapshot.js"; export { default as ChannelStatus } from "./ChannelStatus.js"; export { default as ChannelToTransactionsConnection } from "./ChannelToTransactionsConnection.js"; export { default as ClaimUmaInvitationInput } from "./ClaimUmaInvitationInput.js"; @@ -72,6 +79,8 @@ export { } from "./IncomingPaymentAttempt.js"; export { default as IncomingPaymentAttemptStatus } from "./IncomingPaymentAttemptStatus.js"; export { default as IncomingPaymentToAttemptsConnection } from "./IncomingPaymentToAttemptsConnection.js"; +export { default as IncomingPaymentsForInvoiceQueryInput } from "./IncomingPaymentsForInvoiceQueryInput.js"; +export { default as IncomingPaymentsForInvoiceQueryOutput } from "./IncomingPaymentsForInvoiceQueryOutput.js"; export { default as Invoice, getInvoiceQuery } from "./Invoice.js"; export { default as InvoiceData } from "./InvoiceData.js"; export { default as InvoiceType } from "./InvoiceType.js"; @@ -96,6 +105,7 @@ export { default as LightsparkNodeToChannelsConnection } from "./LightsparkNodeT export { default as LightsparkNodeToDailyLiquidityForecastsConnection } from "./LightsparkNodeToDailyLiquidityForecastsConnection.js"; export { default as LightsparkNodeWithOSK } from "./LightsparkNodeWithOSK.js"; export { default as LightsparkNodeWithRemoteSigning } from "./LightsparkNodeWithRemoteSigning.js"; +export { default as MultiSigAddressValidationParameters } from "./MultiSigAddressValidationParameters.js"; export { default as Node, getNodeQuery } from "./Node.js"; export { default as NodeAddress } from "./NodeAddress.js"; export { default as NodeAddressType } from "./NodeAddressType.js"; diff --git a/packages/wallet-sdk/src/objects/CancelInvoiceInput.ts b/packages/wallet-sdk/src/objects/CancelInvoiceInput.ts index cd4e5e855..633e5b1b8 100644 --- a/packages/wallet-sdk/src/objects/CancelInvoiceInput.ts +++ b/packages/wallet-sdk/src/objects/CancelInvoiceInput.ts @@ -1,5 +1,9 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved +/** + * The unique identifier of the Invoice that should be cancelled. The invoice is supposed to be + * open, not settled and not expired. * + */ interface CancelInvoiceInput { invoiceId: string; } diff --git a/packages/wallet-sdk/src/objects/CancelInvoiceOutput.ts b/packages/wallet-sdk/src/objects/CancelInvoiceOutput.ts index 95d2fb856..6b6147b52 100644 --- a/packages/wallet-sdk/src/objects/CancelInvoiceOutput.ts +++ b/packages/wallet-sdk/src/objects/CancelInvoiceOutput.ts @@ -1,5 +1,9 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved +/** + * The Invoice that was cancelled. If the invoice was already cancelled, the same invoice is + * returned. * + */ interface CancelInvoiceOutput { invoiceId: string; } diff --git a/packages/wallet-sdk/src/objects/PaymentFailureReason.ts b/packages/wallet-sdk/src/objects/PaymentFailureReason.ts index 97ee7946d..bb6263f60 100644 --- a/packages/wallet-sdk/src/objects/PaymentFailureReason.ts +++ b/packages/wallet-sdk/src/objects/PaymentFailureReason.ts @@ -29,6 +29,8 @@ export enum PaymentFailureReason { INVOICE_EXPIRED = "INVOICE_EXPIRED", + INVOICE_CANCELLED = "INVOICE_CANCELLED", + RISK_SCREENING_FAILED = "RISK_SCREENING_FAILED", } diff --git a/packages/wallet-sdk/src/objects/WithdrawalRequestStatus.ts b/packages/wallet-sdk/src/objects/WithdrawalRequestStatus.ts index ef59ede54..3e8f6cfbd 100644 --- a/packages/wallet-sdk/src/objects/WithdrawalRequestStatus.ts +++ b/packages/wallet-sdk/src/objects/WithdrawalRequestStatus.ts @@ -15,6 +15,8 @@ export enum WithdrawalRequestStatus { IN_PROGRESS = "IN_PROGRESS", SUCCESSFUL = "SUCCESSFUL", + + PARTIALLY_SUCCESSFUL = "PARTIALLY_SUCCESSFUL", } export default WithdrawalRequestStatus;