Skip to content

Commit

Permalink
[js] Update to latest schema for 3P packages (#6140)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 74d531dd26dbb7a23a7bd8a7ec75c98383dd8709
  • Loading branch information
coreymartin authored and Lightspark Eng committed Sep 14, 2023
1 parent 79d0c2f commit cdac018
Show file tree
Hide file tree
Showing 62 changed files with 4,142 additions and 649 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import styled from "@emotion/styled";
import {
ChannelClosingTransaction,
ChannelOpeningTransaction,
IncomingPayment,
OutgoingPayment,
RoutingTransaction,
Transaction,
Expand Down Expand Up @@ -43,7 +42,7 @@ const getTransactionOtherNode = (transaction: Transaction): Maybe<string> => {
case "OutgoingPayment":
return (transaction as OutgoingPayment).destinationId;
case "IncomingPayment":
return (transaction as IncomingPayment).originId;
return "Unknown";
case "RoutingTransaction":
return (transaction as RoutingTransaction).incomingChannelId;
default:
Expand Down
2 changes: 0 additions & 2 deletions packages/lightspark-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ class LightsparkClient {
return {
color: node.color,
displayName: node.display_name,
purpose: node.purpose,
id: node.id,
publicKey: node.public_key,
status: node.status,
Expand Down Expand Up @@ -354,7 +353,6 @@ class LightsparkClient {
return {
color: node.color,
displayName: account.name,
purpose: node.purpose,
id: node.id,
publicKey: node.public_key,
status: node.status,
Expand Down
3 changes: 0 additions & 3 deletions packages/lightspark-sdk/src/graphql/MultiNodeDashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import type { Maybe } from "@lightsparkdev/core";
import type CurrencyAmount from "../objects/CurrencyAmount.js";
import { FRAGMENT as CurrencyAmountFragment } from "../objects/CurrencyAmount.js";
import type LightsparkNodePurpose from "../objects/LightsparkNodePurpose.js";
import type LightsparkNodeStatus from "../objects/LightsparkNodeStatus.js";
import type NodeAddressType from "../objects/NodeAddressType.js";

Expand All @@ -14,7 +13,6 @@ export type AccountDashboard = {
id: string;
color: Maybe<string>;
displayName: string;
purpose: Maybe<LightsparkNodePurpose>;
publicKey: Maybe<string>;
status: Maybe<LightsparkNodeStatus>;
addresses: {
Expand Down Expand Up @@ -57,7 +55,6 @@ export const MultiNodeDashboard = `
entities {
color
display_name
purpose
id
addresses(first: 1) {
entities {
Expand Down
1 change: 0 additions & 1 deletion packages/lightspark-sdk/src/graphql/SingleNodeDashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ query SingleNodeDashboard(
entities {
color
display_name
purpose
id
addresses(first: 1) {
entities {
Expand Down
531 changes: 424 additions & 107 deletions packages/lightspark-sdk/src/objects/Account.ts

Large diffs are not rendered by default.

13 changes: 0 additions & 13 deletions packages/lightspark-sdk/src/objects/AccountToNodesConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import type Connection from "./Connection.js";
import type LightsparkNode from "./LightsparkNode.js";
import { LightsparkNodeFromJson } from "./LightsparkNode.js";
import LightsparkNodePurpose from "./LightsparkNodePurpose.js";
import type PageInfo from "./PageInfo.js";
import { PageInfoFromJson } from "./PageInfo.js";

Expand All @@ -23,13 +22,6 @@ type AccountToNodesConnection = Connection & {

/** The typename of the object **/
typename: string;

/**
* The main purpose for the selected set of nodes. It is automatically determined from the nodes that
* are selected in this connection and is used for optimization purposes, as well as to determine the
* variation of the UI that should be presented to the user.
**/
purpose?: LightsparkNodePurpose;
};

export const AccountToNodesConnectionFromJson = (
Expand All @@ -42,10 +34,6 @@ export const AccountToNodesConnectionFromJson = (
LightsparkNodeFromJson(e),
),
typename: "AccountToNodesConnection",
purpose: !!obj["account_to_nodes_connection_purpose"]
? LightsparkNodePurpose[obj["account_to_nodes_connection_purpose"]] ??
LightsparkNodePurpose.FUTURE_VALUE
: null,
} as AccountToNodesConnection;
};

Expand All @@ -60,7 +48,6 @@ fragment AccountToNodesConnectionFragment on AccountToNodesConnection {
page_info_start_cursor: start_cursor
page_info_end_cursor: end_cursor
}
account_to_nodes_connection_purpose: purpose
account_to_nodes_connection_entities: entities {
id
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved

/** This is an enum identifying a type of crypto sanctions screening provider. **/
export enum CryptoSanctionsScreeningProvider {
/** This is an enum identifying a type of compliance provider. **/
export enum ComplianceProvider {
/**
* This is an enum value that represents values that could be added in the future.
* Clients should support unknown values as more of them could be added without notice.
Expand All @@ -11,4 +11,4 @@ export enum CryptoSanctionsScreeningProvider {
CHAINALYSIS = "CHAINALYSIS",
}

export default CryptoSanctionsScreeningProvider;
export default ComplianceProvider;
6 changes: 0 additions & 6 deletions packages/lightspark-sdk/src/objects/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { HopFromJson } from "./Hop.js";
import { IncomingPaymentAttemptFromJson } from "./IncomingPaymentAttempt.js";
import type IncomingPaymentToAttemptsConnection from "./IncomingPaymentToAttemptsConnection.js";
import { LightsparkNodeFromJson } from "./LightsparkNode.js";
import LightsparkNodePurpose from "./LightsparkNodePurpose.js";
import type LightsparkNodeToChannelsConnection from "./LightsparkNodeToChannelsConnection.js";
import { OutgoingPaymentAttemptFromJson } from "./OutgoingPaymentAttempt.js";
import type OutgoingPaymentAttemptToHopsConnection from "./OutgoingPaymentAttemptToHopsConnection.js";
Expand Down Expand Up @@ -61,10 +60,6 @@ export const ConnectionFromJson = (obj: any): Connection => {
LightsparkNodeFromJson(e),
),
typename: "AccountToNodesConnection",
purpose: !!obj["account_to_nodes_connection_purpose"]
? LightsparkNodePurpose[obj["account_to_nodes_connection_purpose"]] ??
LightsparkNodePurpose.FUTURE_VALUE
: null,
} as AccountToNodesConnection;
}
if (obj["__typename"] == "AccountToPaymentRequestsConnection") {
Expand Down Expand Up @@ -227,7 +222,6 @@ fragment ConnectionFragment on Connection {
page_info_start_cursor: start_cursor
page_info_end_cursor: end_cursor
}
account_to_nodes_connection_purpose: purpose
account_to_nodes_connection_entities: entities {
id
}
Expand Down
6 changes: 0 additions & 6 deletions packages/lightspark-sdk/src/objects/CreateInvoiceInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ type CreateInvoiceInput = {

/** The expiry of the invoice in seconds. Default value is 86400 (1 day). **/
expirySecs?: number;

paymentHash?: string;

preimageNonce?: string;
};

export const CreateInvoiceInputFromJson = (obj: any): CreateInvoiceInput => {
Expand All @@ -31,8 +27,6 @@ export const CreateInvoiceInputFromJson = (obj: any): CreateInvoiceInput => {
InvoiceType.FUTURE_VALUE
: null,
expirySecs: obj["create_invoice_input_expiry_secs"],
paymentHash: obj["create_invoice_input_payment_hash"],
preimageNonce: obj["create_invoice_input_preimage_nonce"],
} as CreateInvoiceInput;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ type CreateLnurlInvoiceInput = {

/** The expiry of the invoice in seconds. Default value is 86400 (1 day). **/
expirySecs?: number;

paymentHash?: string;

preimageNonce?: string;
};

export const CreateLnurlInvoiceInputFromJson = (
Expand All @@ -29,8 +25,6 @@ export const CreateLnurlInvoiceInputFromJson = (
amountMsats: obj["create_lnurl_invoice_input_amount_msats"],
metadataHash: obj["create_lnurl_invoice_input_metadata_hash"],
expirySecs: obj["create_lnurl_invoice_input_expiry_secs"],
paymentHash: obj["create_lnurl_invoice_input_payment_hash"],
preimageNonce: obj["create_lnurl_invoice_input_preimage_nonce"],
} as CreateLnurlInvoiceInput;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,24 @@

/** 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. **/
type CreateTestModePaymentoutput = {
/** The payment that has been sent. **/
/**
* The payment that has been sent.
*
* @deprecated Use incoming_payment instead.
**/
paymentId: string;

/** The payment that has been received. **/
incomingPaymentId: string;
};

export const CreateTestModePaymentoutputFromJson = (
obj: any,
): CreateTestModePaymentoutput => {
return {
paymentId: obj["create_test_mode_paymentoutput_payment"].id,
incomingPaymentId:
obj["create_test_mode_paymentoutput_incoming_payment"].id,
} as CreateTestModePaymentoutput;
};

Expand All @@ -20,6 +29,9 @@ fragment CreateTestModePaymentoutputFragment on CreateTestModePaymentoutput {
create_test_mode_paymentoutput_payment: payment {
id
}
create_test_mode_paymentoutput_incoming_payment: incoming_payment {
id
}
}`;

export default CreateTestModePaymentoutput;
24 changes: 24 additions & 0 deletions packages/lightspark-sdk/src/objects/CreateUmaInvoiceInput.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved

type CreateUmaInvoiceInput = {
nodeId: string;

amountMsats: number;

metadataHash: string;

expirySecs?: number;
};

export const CreateUmaInvoiceInputFromJson = (
obj: any,
): CreateUmaInvoiceInput => {
return {
nodeId: obj["create_uma_invoice_input_node_id"],
amountMsats: obj["create_uma_invoice_input_amount_msats"],
metadataHash: obj["create_uma_invoice_input_metadata_hash"],
expirySecs: obj["create_uma_invoice_input_expiry_secs"],
} as CreateUmaInvoiceInput;
};

export default CreateUmaInvoiceInput;
16 changes: 16 additions & 0 deletions packages/lightspark-sdk/src/objects/DeclineToSignMessagesInput.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved

type DeclineToSignMessagesInput = {
/** List of payload ids to decline to sign because validation failed. **/
payloadIds: string[];
};

export const DeclineToSignMessagesInputFromJson = (
obj: any,
): DeclineToSignMessagesInput => {
return {
payloadIds: obj["decline_to_sign_messages_input_payload_ids"],
} as DeclineToSignMessagesInput;
};

export default DeclineToSignMessagesInput;
28 changes: 28 additions & 0 deletions packages/lightspark-sdk/src/objects/DeclineToSignMessagesOutput.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved

import type SignablePayload from "./SignablePayload.js";
import { SignablePayloadFromJson } from "./SignablePayload.js";

type DeclineToSignMessagesOutput = {
declinedPayloads: SignablePayload[];
};

export const DeclineToSignMessagesOutputFromJson = (
obj: any,
): DeclineToSignMessagesOutput => {
return {
declinedPayloads: obj[
"decline_to_sign_messages_output_declined_payloads"
].map((e) => SignablePayloadFromJson(e)),
} as DeclineToSignMessagesOutput;
};

export const FRAGMENT = `
fragment DeclineToSignMessagesOutputFragment on DeclineToSignMessagesOutput {
__typename
decline_to_sign_messages_output_declined_payloads: declined_payloads {
id
}
}`;

export default DeclineToSignMessagesOutput;
Loading

0 comments on commit cdac018

Please sign in to comment.