@lightsparkdev/lightspark-sdk 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{chunk-5RDIWPBE.js → chunk-D32EWIPX.js} +3 -1
  3. package/dist/{chunk-VTPDR6P4.js → chunk-GLL4KTUT.js} +353 -15
  4. package/dist/env.cjs +3 -1
  5. package/dist/env.d.cts +17 -0
  6. package/dist/env.js +2 -2
  7. package/dist/{index-f040db9f.d.ts → index-eb604025.d.ts} +1377 -15
  8. package/dist/index.cjs +682 -94
  9. package/dist/index.d.cts +41 -0
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.js +290 -37
  12. package/dist/objects/index.cjs +345 -5
  13. package/dist/objects/index.d.cts +4 -0
  14. package/dist/objects/index.d.ts +1 -1
  15. package/dist/objects/index.js +10 -2
  16. package/dist/{text-encoding-MDIPJAHL.js → text-encoding-26SMKBAQ.js} +3 -1
  17. package/package.json +4 -4
  18. package/src/auth/AccountTokenAuthProvider.ts +15 -11
  19. package/src/client.ts +201 -7
  20. package/src/graphql/ClaimUmaInvitation.ts +21 -0
  21. package/src/graphql/ClaimUmaInvitationWithIncentives.ts +25 -0
  22. package/src/graphql/CreateUmaInvitation.ts +19 -0
  23. package/src/graphql/CreateUmaInvitationWithIncentives.ts +23 -0
  24. package/src/graphql/FetchUmaInvitation.ts +15 -0
  25. package/src/helpers.ts +3 -1
  26. package/src/objects/Account.ts +8 -0
  27. package/src/objects/AccountToChannelsConnection.ts +5 -0
  28. package/src/objects/Channel.ts +31 -0
  29. package/src/objects/ClaimUmaInvitationInput.ts +26 -0
  30. package/src/objects/ClaimUmaInvitationOutput.ts +30 -0
  31. package/src/objects/ClaimUmaInvitationWithIncentivesInput.ts +44 -0
  32. package/src/objects/ClaimUmaInvitationWithIncentivesOutput.ts +33 -0
  33. package/src/objects/CreateInvitationWithIncentivesInput.ts +37 -0
  34. package/src/objects/CreateInvitationWithIncentivesOutput.ts +32 -0
  35. package/src/objects/CreateUmaInvitationInput.ts +22 -0
  36. package/src/objects/CreateUmaInvitationOutput.ts +30 -0
  37. package/src/objects/Entity.ts +13 -0
  38. package/src/objects/GraphNode.ts +28 -0
  39. package/src/objects/IncentivesIneligibilityReason.ts +24 -0
  40. package/src/objects/IncentivesStatus.ts +18 -0
  41. package/src/objects/IncomingPayment.ts +17 -0
  42. package/src/objects/LightsparkNodeWithOSK.ts +61 -0
  43. package/src/objects/LightsparkNodeWithRemoteSigning.ts +60 -0
  44. package/src/objects/OutgoingPayment.ts +20 -0
  45. package/src/objects/OutgoingPaymentAttempt.ts +31 -0
  46. package/src/objects/RegionCode.ts +510 -0
  47. package/src/objects/UmaInvitation.ts +113 -0
  48. package/src/objects/Wallet.ts +12 -0
  49. package/src/objects/WebhookEventType.ts +4 -0
  50. package/src/objects/WithdrawalRequest.ts +17 -0
  51. package/src/objects/index.ts +15 -0
  52. package/src/tests/integration/constants.ts +10 -0
  53. package/src/tests/integration/general-regtest.test.ts +633 -0
  54. package/src/tests/serialization.test.ts +5 -2
  55. package/src/webhooks.ts +1 -1
  56. package/src/tests/integration/client.test.ts +0 -207
  57. /package/dist/{chunk-NIMBE7W3.js → chunk-BMTV3EA2.js} +0 -0
package/src/client.ts CHANGED
@@ -25,15 +25,20 @@ import {
25
25
  } from "@lightsparkdev/core";
26
26
  import packageJson from "../package.json";
27
27
  import { BitcoinFeeEstimate as BitcoinFeeEstimateQuery } from "./graphql/BitcoinFeeEstimate.js";
28
+ import { ClaimUmaInvitation } from "./graphql/ClaimUmaInvitation.js";
29
+ import { ClaimUmaInvitationWithIncentives } from "./graphql/ClaimUmaInvitationWithIncentives.js";
28
30
  import { CreateApiToken } from "./graphql/CreateApiToken.js";
29
31
  import { CreateInvoice } from "./graphql/CreateInvoice.js";
30
32
  import { CreateLnurlInvoice } from "./graphql/CreateLnurlInvoice.js";
31
33
  import { CreateNodeWalletAddress } from "./graphql/CreateNodeWalletAddress.js";
32
34
  import { CreateTestModeInvoice } from "./graphql/CreateTestModeInvoice.js";
33
35
  import { CreateTestModePayment } from "./graphql/CreateTestModePayment.js";
36
+ import { CreateUmaInvitation } from "./graphql/CreateUmaInvitation.js";
37
+ import { CreateUmaInvitationWithIncentives } from "./graphql/CreateUmaInvitationWithIncentives.js";
34
38
  import { CreateUmaInvoice } from "./graphql/CreateUmaInvoice.js";
35
39
  import { DecodeInvoice } from "./graphql/DecodeInvoice.js";
36
40
  import { DeleteApiToken } from "./graphql/DeleteApiToken.js";
41
+ import { FetchUmaInvitation } from "./graphql/FetchUmaInvitation.js";
37
42
  import { FundNode } from "./graphql/FundNode.js";
38
43
  import { LightningFeeEstimateForInvoice } from "./graphql/LightningFeeEstimateForInvoice.js";
39
44
  import { LightningFeeEstimateForNode } from "./graphql/LightningFeeEstimateForNode.js";
@@ -47,7 +52,6 @@ import { SendPayment } from "./graphql/SendPayment.js";
47
52
  import { SingleNodeDashboard as SingleNodeDashboardQuery } from "./graphql/SingleNodeDashboard.js";
48
53
  import { TransactionsForNode } from "./graphql/TransactionsForNode.js";
49
54
  import { TransactionSubscription } from "./graphql/TransactionSubscription.js";
50
- import { TransactionStatus } from "./index.js";
51
55
  import NodeKeyLoaderCache from "./NodeKeyLoaderCache.js";
52
56
  import Account from "./objects/Account.js";
53
57
  import { ApiTokenFromJson } from "./objects/ApiToken.js";
@@ -68,14 +72,18 @@ import type OutgoingPayment from "./objects/OutgoingPayment.js";
68
72
  import { OutgoingPaymentFromJson } from "./objects/OutgoingPayment.js";
69
73
  import { PaymentRequestFromJson } from "./objects/PaymentRequest.js";
70
74
  import Permission from "./objects/Permission.js";
75
+ import type RegionCode from "./objects/RegionCode.js";
71
76
  import type SingleNodeDashboard from "./objects/SingleNodeDashboard.js";
72
77
  import type Transaction from "./objects/Transaction.js";
73
78
  import {
74
79
  getTransactionQuery,
75
80
  TransactionFromJson,
76
81
  } from "./objects/Transaction.js";
82
+ import TransactionStatus from "./objects/TransactionStatus.js";
77
83
  import type TransactionUpdate from "./objects/TransactionUpdate.js";
78
84
  import { TransactionUpdateFromJson } from "./objects/TransactionUpdate.js";
85
+ import type UmaInvitation from "./objects/UmaInvitation.js";
86
+ import { UmaInvitationFromJson } from "./objects/UmaInvitation.js";
79
87
  import type WithdrawalMode from "./objects/WithdrawalMode.js";
80
88
  import type WithdrawalRequest from "./objects/WithdrawalRequest.js";
81
89
  import { WithdrawalRequestFromJson } from "./objects/WithdrawalRequest.js";
@@ -116,7 +124,8 @@ class LightsparkClient {
116
124
  /**
117
125
  * Constructs a new LightsparkClient.
118
126
  *
119
- * @param authProvider The auth provider to use for authentication. Defaults to a stub auth provider. For server-side
127
+ * @param authProvider The auth provider to use for authentication. Defaults to a stub auth provider.
128
+ * For server-side
120
129
  * use, you should use the `AccountTokenAuthProvider`.
121
130
  * @param serverUrl The base URL of the server to connect to. Defaults to lightspark production.
122
131
  * @param cryptoImpl The crypto implementation to use. Defaults to web and node compatible crypto.
@@ -179,7 +188,7 @@ class LightsparkClient {
179
188
  *
180
189
  * @param authProvider
181
190
  */
182
- public async setAuthProvider(authProvider: AuthProvider) {
191
+ public setAuthProvider(authProvider: AuthProvider) {
183
192
  this.requester = new Requester(
184
193
  this.nodeKeyCache,
185
194
  this.LIGHTSPARK_SDK_ENDPOINT,
@@ -797,7 +806,7 @@ class LightsparkClient {
797
806
  * @param transactionId The ID of the transaction to wait for
798
807
  * @param pollTimeoutSecs The timeout in seconds that we will wait before throwing an exception
799
808
  */
800
- public async waitForTransactionComplete(
809
+ public async waitForTransactionComplete<T = Transaction>(
801
810
  transactionId: string,
802
811
  pollTimeoutSecs = 60,
803
812
  ) {
@@ -805,7 +814,7 @@ class LightsparkClient {
805
814
  const pollMaxTimeouts = (pollTimeoutSecs * 1000) / pollIntervalMs;
806
815
  const pollIgnoreErrors = false;
807
816
 
808
- const transaction = (await pollUntil(
817
+ const transaction = await pollUntil(
809
818
  () => {
810
819
  return this.getTransaction(transactionId);
811
820
  },
@@ -833,9 +842,9 @@ class LightsparkClient {
833
842
  "Timeout",
834
843
  "Timeout waiting for transaction to complete.",
835
844
  ),
836
- )) as Transaction;
845
+ );
837
846
 
838
- return transaction;
847
+ return transaction as T;
839
848
  }
840
849
 
841
850
  /**
@@ -1069,6 +1078,191 @@ class LightsparkClient {
1069
1078
  });
1070
1079
  }
1071
1080
 
1081
+ /**
1082
+ * Creates an UMA invitation. If you are part of the incentive program, you should use
1083
+ * [createUmaInvitationWithIncentives].
1084
+ *
1085
+ * @param inviterUma The UMA of the inviter.
1086
+ * @returns The invitation that was created.
1087
+ */
1088
+ public async createUmaInvitation(
1089
+ inviterUma: string,
1090
+ ): Promise<UmaInvitation | null> {
1091
+ return await this.executeRawQuery({
1092
+ queryPayload: CreateUmaInvitation,
1093
+ variables: {
1094
+ inviterUma,
1095
+ },
1096
+ constructObject: (responseJson: {
1097
+ create_uma_invitation: {
1098
+ invitation: any; // eslint-disable-line @typescript-eslint/no-explicit-any
1099
+ } | null;
1100
+ }) => {
1101
+ if (!responseJson.create_uma_invitation?.invitation) {
1102
+ throw new LightsparkException(
1103
+ "CreateUmaInvitationError",
1104
+ "Unable to create UMA invitation",
1105
+ );
1106
+ }
1107
+ return UmaInvitationFromJson(
1108
+ responseJson.create_uma_invitation?.invitation,
1109
+ );
1110
+ },
1111
+ });
1112
+ }
1113
+
1114
+ /**
1115
+ * Creates an UMA invitation as part of the incentive program.
1116
+ * @param inviterUma The UMA of the inviter.
1117
+ * @param inviterPhoneNumber The phone number of the inviter in E164 format.
1118
+ * @param inviterRegion The region of the inviter.
1119
+ * @returns The invitation that was created.
1120
+ */
1121
+ public async createUmaInvitationWithIncentives(
1122
+ inviterUma: string,
1123
+ inviterPhoneNumber: string,
1124
+ inviterRegion: RegionCode,
1125
+ ): Promise<UmaInvitation | null> {
1126
+ const inviterPhoneHash = await this.hashPhoneNumber(inviterPhoneNumber);
1127
+ return await this.executeRawQuery({
1128
+ queryPayload: CreateUmaInvitationWithIncentives,
1129
+ variables: {
1130
+ inviterUma,
1131
+ inviterPhoneHash,
1132
+ inviterRegion,
1133
+ },
1134
+ constructObject: (responseJson: {
1135
+ create_uma_invitation_with_incentives: {
1136
+ invitation: any; // eslint-disable-line @typescript-eslint/no-explicit-any
1137
+ } | null;
1138
+ }) => {
1139
+ if (!responseJson.create_uma_invitation_with_incentives?.invitation) {
1140
+ throw new LightsparkException(
1141
+ "CreateUmaInvitationError",
1142
+ "Unable to create UMA invitation",
1143
+ );
1144
+ }
1145
+ return UmaInvitationFromJson(
1146
+ responseJson.create_uma_invitation_with_incentives?.invitation,
1147
+ );
1148
+ },
1149
+ });
1150
+ }
1151
+
1152
+ /**
1153
+ * Claims an UMA invitation. If you are part of the incentive program, you should use
1154
+ * [claimUmaInvitationWithIncentives].
1155
+ *
1156
+ * @param invitationCode The invitation code to claim.
1157
+ * @param inviteeUma The UMA of the invitee.
1158
+ * @returns The invitation that was claimed.
1159
+ */
1160
+ public async claimUmaInvitation(
1161
+ invitationCode: string,
1162
+ inviteeUma: string,
1163
+ ): Promise<UmaInvitation | null> {
1164
+ return await this.executeRawQuery({
1165
+ queryPayload: ClaimUmaInvitation,
1166
+ variables: {
1167
+ invitationCode,
1168
+ inviteeUma,
1169
+ },
1170
+ constructObject: (responseJson: {
1171
+ claim_uma_invitation: {
1172
+ invitation: any; // eslint-disable-line @typescript-eslint/no-explicit-any
1173
+ } | null;
1174
+ }) => {
1175
+ if (!responseJson.claim_uma_invitation?.invitation) {
1176
+ throw new LightsparkException(
1177
+ "ClaimUmaInvitationError",
1178
+ "Unable to claim UMA invitation",
1179
+ );
1180
+ }
1181
+ return UmaInvitationFromJson(
1182
+ responseJson.claim_uma_invitation?.invitation,
1183
+ );
1184
+ },
1185
+ });
1186
+ }
1187
+
1188
+ /**
1189
+ * Claims an UMA invitation as part of the incentive program.
1190
+ *
1191
+ * @param invitationCode The invitation code to claim.
1192
+ * @param inviteeUma The UMA of the invitee.
1193
+ * @param inviteePhoneNumber The phone number of the invitee in E164 format.
1194
+ * @param inviteeRegion The region of the invitee.
1195
+ * @returns The invitation that was claimed.
1196
+ */
1197
+ public async claimUmaInvitationWithIncentives(
1198
+ invitationCode: string,
1199
+ inviteeUma: string,
1200
+ inviteePhoneNumber: string,
1201
+ inviteeRegion: RegionCode,
1202
+ ): Promise<UmaInvitation | null> {
1203
+ const inviteePhoneHash = await this.hashPhoneNumber(inviteePhoneNumber);
1204
+ return await this.executeRawQuery({
1205
+ queryPayload: ClaimUmaInvitationWithIncentives,
1206
+ variables: {
1207
+ invitationCode,
1208
+ inviteeUma,
1209
+ inviteePhoneHash,
1210
+ inviteeRegion,
1211
+ },
1212
+ constructObject: (responseJson: {
1213
+ claim_uma_invitation_with_incentives: {
1214
+ invitation: any; // eslint-disable-line @typescript-eslint/no-explicit-any
1215
+ } | null;
1216
+ }) => {
1217
+ if (!responseJson.claim_uma_invitation_with_incentives?.invitation) {
1218
+ throw new LightsparkException(
1219
+ "ClaimUmaInvitationError",
1220
+ "Unable to claim UMA invitation",
1221
+ );
1222
+ }
1223
+ return UmaInvitationFromJson(
1224
+ responseJson.claim_uma_invitation_with_incentives?.invitation,
1225
+ );
1226
+ },
1227
+ });
1228
+ }
1229
+
1230
+ /**
1231
+ * Fetches an UMA invitation by its invitation code.
1232
+ *
1233
+ * @param invitationCode The code of the invitation to fetch.
1234
+ * @returns The invitation with the given code, or null if no invitation exists with that code.
1235
+ */
1236
+ public async fetchUmaInvitation(
1237
+ invitationCode: string,
1238
+ ): Promise<UmaInvitation | null> {
1239
+ return await this.executeRawQuery({
1240
+ queryPayload: FetchUmaInvitation,
1241
+ variables: {
1242
+ invitationCode,
1243
+ },
1244
+ constructObject: (responseJson: {
1245
+ uma_invitation_by_code: any; // eslint-disable-line @typescript-eslint/no-explicit-any
1246
+ }) => {
1247
+ if (!responseJson.uma_invitation_by_code) {
1248
+ return null;
1249
+ }
1250
+ return UmaInvitationFromJson(responseJson.uma_invitation_by_code);
1251
+ },
1252
+ });
1253
+ }
1254
+
1255
+ private async hashPhoneNumber(e164PhoneNumber: string): Promise<string> {
1256
+ const e164PhoneRegex = /^\+[1-9]\d{1,14}$/;
1257
+ if (!e164PhoneRegex.test(e164PhoneNumber)) {
1258
+ throw new LightsparkException(
1259
+ "InvalidPhoneNumber",
1260
+ "Invalid phone number. Phone number must be in E164 format.",
1261
+ );
1262
+ }
1263
+ return await createSha256Hash(e164PhoneNumber, true);
1264
+ }
1265
+
1072
1266
  /**
1073
1267
  * Executes a raw `Query` against the Lightspark API.
1074
1268
  *
@@ -0,0 +1,21 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
4
+
5
+ export const ClaimUmaInvitation = `
6
+ mutation ClaimUmaInvitation(
7
+ $invitationCode: String!
8
+ $inviteeUma: String!
9
+ ) {
10
+ claim_uma_invitation(input: {
11
+ invitation_code: $invitationCode
12
+ invitee_uma: $inviteeUma
13
+ }) {
14
+ invitation {
15
+ ...UmaInvitationFragment
16
+ }
17
+ }
18
+ }
19
+
20
+ ${UmaInvitationFragment}
21
+ `;
@@ -0,0 +1,25 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
4
+
5
+ export const ClaimUmaInvitationWithIncentives = `
6
+ mutation ClaimUmaInvitationWithIncentives(
7
+ $invitationCode: String!
8
+ $inviteeUma: String!
9
+ $inviteePhoneHash: String!
10
+ $inviteeRegion: RegionCode!
11
+ ) {
12
+ claim_uma_invitation_with_incentives(input: {
13
+ invitation_code: $invitationCode
14
+ invitee_uma: $inviteeUma
15
+ invitee_phone_hash: $inviteePhoneHash
16
+ invitee_region: $inviteeRegion
17
+ }) {
18
+ invitation {
19
+ ...UmaInvitationFragment
20
+ }
21
+ }
22
+ }
23
+
24
+ ${UmaInvitationFragment}
25
+ `;
@@ -0,0 +1,19 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
4
+
5
+ export const CreateUmaInvitation = `
6
+ mutation CreateUmaInvitation(
7
+ $inviterUma: String!
8
+ ) {
9
+ create_uma_invitation(input: {
10
+ inviter_uma: $inviterUma
11
+ }) {
12
+ invitation {
13
+ ...UmaInvitationFragment
14
+ }
15
+ }
16
+ }
17
+
18
+ ${UmaInvitationFragment}
19
+ `;
@@ -0,0 +1,23 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
4
+
5
+ export const CreateUmaInvitationWithIncentives = `
6
+ mutation CreateUmaInvitationWithIncentives(
7
+ $inviterUma: String!
8
+ $inviterPhoneHash: String!
9
+ $inviterRegion: RegionCode!
10
+ ) {
11
+ create_uma_invitation_with_incentives(input: {
12
+ inviter_uma: $inviterUma
13
+ inviter_phone_hash: $inviterPhoneHash
14
+ inviter_region: $inviterRegion
15
+ }) {
16
+ invitation {
17
+ ...UmaInvitationFragment
18
+ }
19
+ }
20
+ }
21
+
22
+ ${UmaInvitationFragment}
23
+ `;
@@ -0,0 +1,15 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as UmaInvitationFragment } from "../objects/UmaInvitation.js";
4
+
5
+ export const FetchUmaInvitation = `
6
+ query FetchUmaInvitation(
7
+ $invitationCode: String!
8
+ ) {
9
+ uma_invitation_by_code(code: $invitationCode) {
10
+ ...UmaInvitationFragment
11
+ }
12
+ }
13
+
14
+ ${UmaInvitationFragment}
15
+ `;
package/src/helpers.ts CHANGED
@@ -18,7 +18,9 @@ export const assertValidBitcoinNetwork = (
18
18
  ): void => {
19
19
  if (!isBitcoinNetwork(bitcoinNetwork)) {
20
20
  throw new Error(
21
- `Invalid bitcoin network ${bitcoinNetwork}. Valid networks: ${BITCOIN_NETWORKS}`,
21
+ `Invalid bitcoin network ${bitcoinNetwork}. Valid networks: ${BITCOIN_NETWORKS.join(
22
+ ", ",
23
+ )}`,
22
24
  );
23
25
  }
24
26
  };
@@ -29,10 +29,18 @@ import type TransactionType from "./TransactionType.js";
29
29
  /** This is an object representing the connected Lightspark account. You can retrieve this object to see your account information and objects tied to your account. **/
30
30
  class Account implements LightsparkNodeOwner, Entity {
31
31
  constructor(
32
+ /**
33
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
34
+ * string.
35
+ **/
32
36
  public readonly id: string,
37
+ /** The date and time when the entity was first created. **/
33
38
  public readonly createdAt: string,
39
+ /** The date and time when the entity was last updated. **/
34
40
  public readonly updatedAt: string,
41
+ /** The typename of the object **/
35
42
  public readonly typename: string,
43
+ /** The name of this account. **/
36
44
  public readonly name?: string | undefined,
37
45
  ) {
38
46
  autoBind(this);
@@ -6,7 +6,12 @@ import { ChannelFromJson } from "./Channel.js";
6
6
 
7
7
  class AccountToChannelsConnection {
8
8
  constructor(
9
+ /**
10
+ * The total count of objects in this connection, using the current filters. It is different from the
11
+ * number of objects returned in the current page (in the `entities` field).
12
+ **/
9
13
  public readonly count: number,
14
+ /** The channels for the current page of this connection. **/
10
15
  public readonly entities: Channel[],
11
16
  ) {
12
17
  autoBind(this);
@@ -19,24 +19,55 @@ import type TransactionType from "./TransactionType.js";
19
19
  /** This is an object representing a channel on the Lightning Network. You can retrieve this object to get detailed information on a specific Lightning Network channel. **/
20
20
  class Channel implements Entity {
21
21
  constructor(
22
+ /**
23
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
24
+ * string.
25
+ **/
22
26
  public readonly id: string,
27
+ /** The date and time when the entity was first created. **/
23
28
  public readonly createdAt: string,
29
+ /** The date and time when the entity was last updated. **/
24
30
  public readonly updatedAt: string,
31
+ /** The local Lightspark node of the channel. **/
25
32
  public readonly localNodeId: string,
33
+ /** The typename of the object **/
26
34
  public readonly typename: string,
35
+ /** The transaction that funded the channel upon channel opening. **/
27
36
  public readonly fundingTransactionId?: string | undefined,
37
+ /**
38
+ * The total amount of funds in this channel, including the channel balance on the local node, the
39
+ * channel balance on the remote node and the on-chain fees to close the channel.
40
+ **/
28
41
  public readonly capacity?: CurrencyAmount | undefined,
42
+ /** The channel balance on the local node. **/
29
43
  public readonly localBalance?: CurrencyAmount | undefined,
44
+ /** The channel balance on the local node that is currently allocated to in-progress payments. **/
30
45
  public readonly localUnsettledBalance?: CurrencyAmount | undefined,
46
+ /** The channel balance on the remote node. **/
31
47
  public readonly remoteBalance?: CurrencyAmount | undefined,
48
+ /** The channel balance on the remote node that is currently allocated to in-progress payments. **/
32
49
  public readonly remoteUnsettledBalance?: CurrencyAmount | undefined,
50
+ /** The channel balance that is currently allocated to in-progress payments. **/
33
51
  public readonly unsettledBalance?: CurrencyAmount | undefined,
52
+ /** The total balance in this channel, including the channel balance on both local and remote nodes. **/
34
53
  public readonly totalBalance?: CurrencyAmount | undefined,
54
+ /** The current status of this channel. **/
35
55
  public readonly status?: ChannelStatus | undefined,
56
+ /**
57
+ * The estimated time to wait for the channel's hash timelock contract to expire when force closing
58
+ * the channel. It is in unit of minutes.
59
+ **/
36
60
  public readonly estimatedForceClosureWaitMinutes?: number | undefined,
61
+ /** The amount to be paid in fees for the current set of commitment transactions. **/
37
62
  public readonly commitFee?: CurrencyAmount | undefined,
63
+ /** The fees charged for routing payments through this channel. **/
38
64
  public readonly fees?: ChannelFees | undefined,
65
+ /** If known, the remote node of the channel. **/
39
66
  public readonly remoteNodeId?: string | undefined,
67
+ /**
68
+ * The unique identifier of the channel on Lightning Network, which is the location in the chain that
69
+ * the channel was confirmed. The format is <block-height>:<tx-index>:<tx-output>.
70
+ **/
40
71
  public readonly shortChannelId?: string | undefined,
41
72
  ) {
42
73
  autoBind(this);
@@ -0,0 +1,26 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ interface ClaimUmaInvitationInput {
4
+ invitationCode: string;
5
+
6
+ inviteeUma: string;
7
+ }
8
+
9
+ export const ClaimUmaInvitationInputFromJson = (
10
+ obj: any,
11
+ ): ClaimUmaInvitationInput => {
12
+ return {
13
+ invitationCode: obj["claim_uma_invitation_input_invitation_code"],
14
+ inviteeUma: obj["claim_uma_invitation_input_invitee_uma"],
15
+ } as ClaimUmaInvitationInput;
16
+ };
17
+ export const ClaimUmaInvitationInputToJson = (
18
+ obj: ClaimUmaInvitationInput,
19
+ ): any => {
20
+ return {
21
+ claim_uma_invitation_input_invitation_code: obj.invitationCode,
22
+ claim_uma_invitation_input_invitee_uma: obj.inviteeUma,
23
+ };
24
+ };
25
+
26
+ export default ClaimUmaInvitationInput;
@@ -0,0 +1,30 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ interface ClaimUmaInvitationOutput {
4
+ invitationId: string;
5
+ }
6
+
7
+ export const ClaimUmaInvitationOutputFromJson = (
8
+ obj: any,
9
+ ): ClaimUmaInvitationOutput => {
10
+ return {
11
+ invitationId: obj["claim_uma_invitation_output_invitation"].id,
12
+ } as ClaimUmaInvitationOutput;
13
+ };
14
+ export const ClaimUmaInvitationOutputToJson = (
15
+ obj: ClaimUmaInvitationOutput,
16
+ ): any => {
17
+ return {
18
+ claim_uma_invitation_output_invitation: { id: obj.invitationId },
19
+ };
20
+ };
21
+
22
+ export const FRAGMENT = `
23
+ fragment ClaimUmaInvitationOutputFragment on ClaimUmaInvitationOutput {
24
+ __typename
25
+ claim_uma_invitation_output_invitation: invitation {
26
+ id
27
+ }
28
+ }`;
29
+
30
+ export default ClaimUmaInvitationOutput;
@@ -0,0 +1,44 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import RegionCode from "./RegionCode.js";
4
+
5
+ interface ClaimUmaInvitationWithIncentivesInput {
6
+ invitationCode: string;
7
+
8
+ inviteeUma: string;
9
+
10
+ inviteePhoneHash: string;
11
+
12
+ inviteeRegion: RegionCode;
13
+ }
14
+
15
+ export const ClaimUmaInvitationWithIncentivesInputFromJson = (
16
+ obj: any,
17
+ ): ClaimUmaInvitationWithIncentivesInput => {
18
+ return {
19
+ invitationCode:
20
+ obj["claim_uma_invitation_with_incentives_input_invitation_code"],
21
+ inviteeUma: obj["claim_uma_invitation_with_incentives_input_invitee_uma"],
22
+ inviteePhoneHash:
23
+ obj["claim_uma_invitation_with_incentives_input_invitee_phone_hash"],
24
+ inviteeRegion:
25
+ RegionCode[
26
+ obj["claim_uma_invitation_with_incentives_input_invitee_region"]
27
+ ] ?? RegionCode.FUTURE_VALUE,
28
+ } as ClaimUmaInvitationWithIncentivesInput;
29
+ };
30
+ export const ClaimUmaInvitationWithIncentivesInputToJson = (
31
+ obj: ClaimUmaInvitationWithIncentivesInput,
32
+ ): any => {
33
+ return {
34
+ claim_uma_invitation_with_incentives_input_invitation_code:
35
+ obj.invitationCode,
36
+ claim_uma_invitation_with_incentives_input_invitee_uma: obj.inviteeUma,
37
+ claim_uma_invitation_with_incentives_input_invitee_phone_hash:
38
+ obj.inviteePhoneHash,
39
+ claim_uma_invitation_with_incentives_input_invitee_region:
40
+ obj.inviteeRegion,
41
+ };
42
+ };
43
+
44
+ export default ClaimUmaInvitationWithIncentivesInput;
@@ -0,0 +1,33 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ interface ClaimUmaInvitationWithIncentivesOutput {
4
+ invitationId: string;
5
+ }
6
+
7
+ export const ClaimUmaInvitationWithIncentivesOutputFromJson = (
8
+ obj: any,
9
+ ): ClaimUmaInvitationWithIncentivesOutput => {
10
+ return {
11
+ invitationId:
12
+ obj["claim_uma_invitation_with_incentives_output_invitation"].id,
13
+ } as ClaimUmaInvitationWithIncentivesOutput;
14
+ };
15
+ export const ClaimUmaInvitationWithIncentivesOutputToJson = (
16
+ obj: ClaimUmaInvitationWithIncentivesOutput,
17
+ ): any => {
18
+ return {
19
+ claim_uma_invitation_with_incentives_output_invitation: {
20
+ id: obj.invitationId,
21
+ },
22
+ };
23
+ };
24
+
25
+ export const FRAGMENT = `
26
+ fragment ClaimUmaInvitationWithIncentivesOutputFragment on ClaimUmaInvitationWithIncentivesOutput {
27
+ __typename
28
+ claim_uma_invitation_with_incentives_output_invitation: invitation {
29
+ id
30
+ }
31
+ }`;
32
+
33
+ export default ClaimUmaInvitationWithIncentivesOutput;
@@ -0,0 +1,37 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import RegionCode from "./RegionCode.js";
4
+
5
+ interface CreateInvitationWithIncentivesInput {
6
+ inviterUma: string;
7
+
8
+ inviterPhoneHash: string;
9
+
10
+ inviterRegion: RegionCode;
11
+ }
12
+
13
+ export const CreateInvitationWithIncentivesInputFromJson = (
14
+ obj: any,
15
+ ): CreateInvitationWithIncentivesInput => {
16
+ return {
17
+ inviterUma: obj["create_invitation_with_incentives_input_inviter_uma"],
18
+ inviterPhoneHash:
19
+ obj["create_invitation_with_incentives_input_inviter_phone_hash"],
20
+ inviterRegion:
21
+ RegionCode[
22
+ obj["create_invitation_with_incentives_input_inviter_region"]
23
+ ] ?? RegionCode.FUTURE_VALUE,
24
+ } as CreateInvitationWithIncentivesInput;
25
+ };
26
+ export const CreateInvitationWithIncentivesInputToJson = (
27
+ obj: CreateInvitationWithIncentivesInput,
28
+ ): any => {
29
+ return {
30
+ create_invitation_with_incentives_input_inviter_uma: obj.inviterUma,
31
+ create_invitation_with_incentives_input_inviter_phone_hash:
32
+ obj.inviterPhoneHash,
33
+ create_invitation_with_incentives_input_inviter_region: obj.inviterRegion,
34
+ };
35
+ };
36
+
37
+ export default CreateInvitationWithIncentivesInput;