@lightsparkdev/lightspark-sdk 0.2.2 → 0.2.4
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.
- package/CHANGELOG.md +14 -0
- package/README.md +0 -1
- package/dist/.DS_Store +0 -0
- package/dist/{Withdrawal-ebb4865c.d.ts → Withdrawal-6e015ff8.d.ts} +55 -4
- package/dist/{Withdrawal-27a4d10d.d.ts → Withdrawal-f68ab02c.d.ts} +98 -31
- package/dist/Withdrawal-f8570ed4.d.ts +1739 -0
- package/dist/{chunk-5Z7FB6OT.js → chunk-OKTW3ZBO.js} +257 -31
- package/dist/{chunk-XFOVS6EY.js → chunk-ZBDRJ7IU.js} +263 -31
- package/dist/index.cjs +284 -49
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -21
- package/dist/objects/index.cjs +251 -24
- package/dist/objects/index.d.ts +1 -1
- package/dist/objects/index.js +3 -1
- package/package.json +2 -2
- package/src/.DS_Store +0 -0
- package/src/client.ts +29 -21
- package/src/objects/{WalletDashboard.ts → SingleNodeDashboard.ts} +2 -2
- package/src/objects/index.ts +1 -1
- package/dist/chunk-3VRI7CHE.js +0 -5508
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ var require_package = __commonJS({
|
|
|
35
35
|
"package.json"(exports, module2) {
|
|
36
36
|
module2.exports = {
|
|
37
37
|
name: "@lightsparkdev/lightspark-sdk",
|
|
38
|
-
version: "0.2.
|
|
38
|
+
version: "0.2.3",
|
|
39
39
|
description: "Lightspark JS SDK",
|
|
40
40
|
author: "Lightspark Inc.",
|
|
41
41
|
keywords: [
|
|
@@ -103,7 +103,7 @@ var require_package = __commonJS({
|
|
|
103
103
|
},
|
|
104
104
|
license: "Apache-2.0",
|
|
105
105
|
dependencies: {
|
|
106
|
-
"@lightsparkdev/core": "^0.2.
|
|
106
|
+
"@lightsparkdev/core": "^0.2.2",
|
|
107
107
|
"auto-bind": "^5.0.1",
|
|
108
108
|
crypto: "^1.0.1",
|
|
109
109
|
"crypto-browserify": "^3.12.0",
|
|
@@ -158,6 +158,7 @@ __export(src_exports, {
|
|
|
158
158
|
RoutingTransactionFailureReason: () => RoutingTransactionFailureReason_default,
|
|
159
159
|
TransactionStatus: () => TransactionStatus_default,
|
|
160
160
|
TransactionType: () => TransactionType_default,
|
|
161
|
+
Wallet: () => Wallet_default,
|
|
161
162
|
WebhookEventType: () => WebhookEventType_default,
|
|
162
163
|
WithdrawalMode: () => WithdrawalMode_default,
|
|
163
164
|
WithdrawalRequest: () => WithdrawalRequest_default,
|
|
@@ -209,8 +210,9 @@ var AccountTokenAuthProvider = class {
|
|
|
209
210
|
var AccountTokenAuthProvider_default = AccountTokenAuthProvider;
|
|
210
211
|
|
|
211
212
|
// src/client.ts
|
|
212
|
-
var import_auto_bind12 = __toESM(require("auto-bind"), 1);
|
|
213
213
|
var import_core6 = require("@lightsparkdev/core");
|
|
214
|
+
var import_auto_bind13 = __toESM(require("auto-bind"), 1);
|
|
215
|
+
var import_core7 = require("@lightsparkdev/core");
|
|
214
216
|
|
|
215
217
|
// src/objects/CurrencyUnit.ts
|
|
216
218
|
var CurrencyUnit = /* @__PURE__ */ ((CurrencyUnit2) => {
|
|
@@ -3559,9 +3561,9 @@ ${FRAGMENT18}
|
|
|
3559
3561
|
};
|
|
3560
3562
|
};
|
|
3561
3563
|
|
|
3562
|
-
// src/graphql/
|
|
3563
|
-
var
|
|
3564
|
-
query
|
|
3564
|
+
// src/graphql/SinglesNodeDashboard.ts
|
|
3565
|
+
var SinglesNodeDashboard = `
|
|
3566
|
+
query SinglesNodeDashboard(
|
|
3565
3567
|
$network: BitcoinNetwork!,
|
|
3566
3568
|
$nodeId: ID!,
|
|
3567
3569
|
$numTransactions: Int,
|
|
@@ -3758,7 +3760,7 @@ ${FRAGMENT19}
|
|
|
3758
3760
|
`;
|
|
3759
3761
|
|
|
3760
3762
|
// src/objects/Account.ts
|
|
3761
|
-
var
|
|
3763
|
+
var import_auto_bind12 = __toESM(require("auto-bind"), 1);
|
|
3762
3764
|
|
|
3763
3765
|
// src/objects/AccountToApiTokensConnection.ts
|
|
3764
3766
|
var AccountToApiTokensConnectionFromJson = (obj) => {
|
|
@@ -4043,6 +4045,168 @@ var AccountToTransactionsConnectionFromJson = (obj) => {
|
|
|
4043
4045
|
};
|
|
4044
4046
|
};
|
|
4045
4047
|
|
|
4048
|
+
// src/objects/Wallet.ts
|
|
4049
|
+
var import_auto_bind11 = __toESM(require("auto-bind"), 1);
|
|
4050
|
+
|
|
4051
|
+
// src/objects/Balances.ts
|
|
4052
|
+
var BalancesFromJson = (obj) => {
|
|
4053
|
+
return {
|
|
4054
|
+
ownedBalance: CurrencyAmountFromJson(obj["balances_owned_balance"]),
|
|
4055
|
+
availableToSendBalance: CurrencyAmountFromJson(
|
|
4056
|
+
obj["balances_available_to_send_balance"]
|
|
4057
|
+
),
|
|
4058
|
+
availableToWithdrawBalance: CurrencyAmountFromJson(
|
|
4059
|
+
obj["balances_available_to_withdraw_balance"]
|
|
4060
|
+
)
|
|
4061
|
+
};
|
|
4062
|
+
};
|
|
4063
|
+
|
|
4064
|
+
// src/objects/Wallet.ts
|
|
4065
|
+
var Wallet = class {
|
|
4066
|
+
constructor(id, createdAt, updatedAt, thirdPartyIdentifier, typename, lastLoginAt, balances) {
|
|
4067
|
+
this.id = id;
|
|
4068
|
+
this.createdAt = createdAt;
|
|
4069
|
+
this.updatedAt = updatedAt;
|
|
4070
|
+
this.thirdPartyIdentifier = thirdPartyIdentifier;
|
|
4071
|
+
this.typename = typename;
|
|
4072
|
+
this.lastLoginAt = lastLoginAt;
|
|
4073
|
+
this.balances = balances;
|
|
4074
|
+
(0, import_auto_bind11.default)(this);
|
|
4075
|
+
}
|
|
4076
|
+
async getTotalAmountReceived(client, createdAfterDate = void 0, createdBeforeDate = void 0) {
|
|
4077
|
+
return await client.executeRawQuery({
|
|
4078
|
+
queryPayload: `
|
|
4079
|
+
query FetchWalletTotalAmountReceived($created_after_date: DateTime, $created_before_date: DateTime) {
|
|
4080
|
+
current_wallet {
|
|
4081
|
+
... on Wallet {
|
|
4082
|
+
total_amount_received(, created_after_date: $created_after_date, created_before_date: $created_before_date) {
|
|
4083
|
+
__typename
|
|
4084
|
+
currency_amount_original_value: original_value
|
|
4085
|
+
currency_amount_original_unit: original_unit
|
|
4086
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
4087
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
4088
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
}
|
|
4092
|
+
}
|
|
4093
|
+
`,
|
|
4094
|
+
variables: {
|
|
4095
|
+
created_after_date: createdAfterDate,
|
|
4096
|
+
created_before_date: createdBeforeDate
|
|
4097
|
+
},
|
|
4098
|
+
constructObject: (json) => {
|
|
4099
|
+
const connection = json["current_wallet"]["total_amount_received"];
|
|
4100
|
+
return CurrencyAmountFromJson(connection);
|
|
4101
|
+
}
|
|
4102
|
+
});
|
|
4103
|
+
}
|
|
4104
|
+
async getTotalAmountSent(client, createdAfterDate = void 0, createdBeforeDate = void 0) {
|
|
4105
|
+
return await client.executeRawQuery({
|
|
4106
|
+
queryPayload: `
|
|
4107
|
+
query FetchWalletTotalAmountSent($created_after_date: DateTime, $created_before_date: DateTime) {
|
|
4108
|
+
current_wallet {
|
|
4109
|
+
... on Wallet {
|
|
4110
|
+
total_amount_sent(, created_after_date: $created_after_date, created_before_date: $created_before_date) {
|
|
4111
|
+
__typename
|
|
4112
|
+
currency_amount_original_value: original_value
|
|
4113
|
+
currency_amount_original_unit: original_unit
|
|
4114
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
4115
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
4116
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
}
|
|
4121
|
+
`,
|
|
4122
|
+
variables: {
|
|
4123
|
+
created_after_date: createdAfterDate,
|
|
4124
|
+
created_before_date: createdBeforeDate
|
|
4125
|
+
},
|
|
4126
|
+
constructObject: (json) => {
|
|
4127
|
+
const connection = json["current_wallet"]["total_amount_sent"];
|
|
4128
|
+
return CurrencyAmountFromJson(connection);
|
|
4129
|
+
}
|
|
4130
|
+
});
|
|
4131
|
+
}
|
|
4132
|
+
static getWalletQuery() {
|
|
4133
|
+
return {
|
|
4134
|
+
queryPayload: `
|
|
4135
|
+
query GetWallet {
|
|
4136
|
+
current_wallet {
|
|
4137
|
+
... on Wallet {
|
|
4138
|
+
...WalletFragment
|
|
4139
|
+
}
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4142
|
+
|
|
4143
|
+
${FRAGMENT21}
|
|
4144
|
+
`,
|
|
4145
|
+
variables: {},
|
|
4146
|
+
constructObject: (data) => WalletFromJson(data.current_wallet)
|
|
4147
|
+
};
|
|
4148
|
+
}
|
|
4149
|
+
};
|
|
4150
|
+
var WalletFromJson = (obj) => {
|
|
4151
|
+
return new Wallet(
|
|
4152
|
+
obj["wallet_id"],
|
|
4153
|
+
obj["wallet_created_at"],
|
|
4154
|
+
obj["wallet_updated_at"],
|
|
4155
|
+
obj["wallet_third_party_identifier"],
|
|
4156
|
+
"Wallet",
|
|
4157
|
+
obj["wallet_last_login_at"],
|
|
4158
|
+
!!obj["wallet_balances"] ? BalancesFromJson(obj["wallet_balances"]) : void 0
|
|
4159
|
+
);
|
|
4160
|
+
};
|
|
4161
|
+
var FRAGMENT21 = `
|
|
4162
|
+
fragment WalletFragment on Wallet {
|
|
4163
|
+
__typename
|
|
4164
|
+
wallet_id: id
|
|
4165
|
+
wallet_created_at: created_at
|
|
4166
|
+
wallet_updated_at: updated_at
|
|
4167
|
+
wallet_last_login_at: last_login_at
|
|
4168
|
+
wallet_balances: balances {
|
|
4169
|
+
__typename
|
|
4170
|
+
balances_owned_balance: owned_balance {
|
|
4171
|
+
__typename
|
|
4172
|
+
currency_amount_original_value: original_value
|
|
4173
|
+
currency_amount_original_unit: original_unit
|
|
4174
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
4175
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
4176
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
4177
|
+
}
|
|
4178
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
4179
|
+
__typename
|
|
4180
|
+
currency_amount_original_value: original_value
|
|
4181
|
+
currency_amount_original_unit: original_unit
|
|
4182
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
4183
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
4184
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
4185
|
+
}
|
|
4186
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
4187
|
+
__typename
|
|
4188
|
+
currency_amount_original_value: original_value
|
|
4189
|
+
currency_amount_original_unit: original_unit
|
|
4190
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
4191
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
4192
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
4193
|
+
}
|
|
4194
|
+
}
|
|
4195
|
+
wallet_third_party_identifier: third_party_identifier
|
|
4196
|
+
}`;
|
|
4197
|
+
var Wallet_default = Wallet;
|
|
4198
|
+
|
|
4199
|
+
// src/objects/AccountToWalletsConnection.ts
|
|
4200
|
+
var AccountToWalletsConnectionFromJson = (obj) => {
|
|
4201
|
+
return {
|
|
4202
|
+
pageInfo: PageInfoFromJson(obj["account_to_wallets_connection_page_info"]),
|
|
4203
|
+
count: obj["account_to_wallets_connection_count"],
|
|
4204
|
+
entities: obj["account_to_wallets_connection_entities"].map(
|
|
4205
|
+
(e) => WalletFromJson(e)
|
|
4206
|
+
)
|
|
4207
|
+
};
|
|
4208
|
+
};
|
|
4209
|
+
|
|
4046
4210
|
// src/objects/Account.ts
|
|
4047
4211
|
var Account = class {
|
|
4048
4212
|
constructor(id, createdAt, updatedAt, typename, name) {
|
|
@@ -4051,7 +4215,7 @@ var Account = class {
|
|
|
4051
4215
|
this.updatedAt = updatedAt;
|
|
4052
4216
|
this.typename = typename;
|
|
4053
4217
|
this.name = name;
|
|
4054
|
-
(0,
|
|
4218
|
+
(0, import_auto_bind12.default)(this);
|
|
4055
4219
|
}
|
|
4056
4220
|
async getApiTokens(client, first = void 0) {
|
|
4057
4221
|
return await client.executeRawQuery({
|
|
@@ -5129,6 +5293,69 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
|
|
|
5129
5293
|
}
|
|
5130
5294
|
});
|
|
5131
5295
|
}
|
|
5296
|
+
async getWallets(client, first = void 0) {
|
|
5297
|
+
return await client.executeRawQuery({
|
|
5298
|
+
queryPayload: `
|
|
5299
|
+
query FetchAccountToWalletsConnection($first: Int) {
|
|
5300
|
+
current_account {
|
|
5301
|
+
... on Account {
|
|
5302
|
+
wallets(, first: $first) {
|
|
5303
|
+
__typename
|
|
5304
|
+
account_to_wallets_connection_page_info: page_info {
|
|
5305
|
+
__typename
|
|
5306
|
+
page_info_has_next_page: has_next_page
|
|
5307
|
+
page_info_has_previous_page: has_previous_page
|
|
5308
|
+
page_info_start_cursor: start_cursor
|
|
5309
|
+
page_info_end_cursor: end_cursor
|
|
5310
|
+
}
|
|
5311
|
+
account_to_wallets_connection_count: count
|
|
5312
|
+
account_to_wallets_connection_entities: entities {
|
|
5313
|
+
__typename
|
|
5314
|
+
wallet_id: id
|
|
5315
|
+
wallet_created_at: created_at
|
|
5316
|
+
wallet_updated_at: updated_at
|
|
5317
|
+
wallet_last_login_at: last_login_at
|
|
5318
|
+
wallet_balances: balances {
|
|
5319
|
+
__typename
|
|
5320
|
+
balances_owned_balance: owned_balance {
|
|
5321
|
+
__typename
|
|
5322
|
+
currency_amount_original_value: original_value
|
|
5323
|
+
currency_amount_original_unit: original_unit
|
|
5324
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
5325
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
5326
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
5327
|
+
}
|
|
5328
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
5329
|
+
__typename
|
|
5330
|
+
currency_amount_original_value: original_value
|
|
5331
|
+
currency_amount_original_unit: original_unit
|
|
5332
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
5333
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
5334
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
5335
|
+
}
|
|
5336
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
5337
|
+
__typename
|
|
5338
|
+
currency_amount_original_value: original_value
|
|
5339
|
+
currency_amount_original_unit: original_unit
|
|
5340
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
5341
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
5342
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
5343
|
+
}
|
|
5344
|
+
}
|
|
5345
|
+
wallet_third_party_identifier: third_party_identifier
|
|
5346
|
+
}
|
|
5347
|
+
}
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
}
|
|
5351
|
+
`,
|
|
5352
|
+
variables: { first },
|
|
5353
|
+
constructObject: (json) => {
|
|
5354
|
+
const connection = json["current_account"]["wallets"];
|
|
5355
|
+
return AccountToWalletsConnectionFromJson(connection);
|
|
5356
|
+
}
|
|
5357
|
+
});
|
|
5358
|
+
}
|
|
5132
5359
|
static getAccountQuery() {
|
|
5133
5360
|
return {
|
|
5134
5361
|
queryPayload: `
|
|
@@ -5140,7 +5367,7 @@ query GetAccount {
|
|
|
5140
5367
|
}
|
|
5141
5368
|
}
|
|
5142
5369
|
|
|
5143
|
-
${
|
|
5370
|
+
${FRAGMENT22}
|
|
5144
5371
|
`,
|
|
5145
5372
|
variables: {},
|
|
5146
5373
|
constructObject: (data) => AccountFromJson(data.current_account)
|
|
@@ -5156,7 +5383,7 @@ var AccountFromJson = (obj) => {
|
|
|
5156
5383
|
obj["account_name"]
|
|
5157
5384
|
);
|
|
5158
5385
|
};
|
|
5159
|
-
var
|
|
5386
|
+
var FRAGMENT22 = `
|
|
5160
5387
|
fragment AccountFragment on Account {
|
|
5161
5388
|
__typename
|
|
5162
5389
|
account_id: id
|
|
@@ -5177,21 +5404,24 @@ var LightsparkClient = class {
|
|
|
5177
5404
|
* @param nodeKeyCache This is used to cache node keys for the duration of the session. Defaults to a new instance of
|
|
5178
5405
|
* `NodeKeyCache`. You should not need to change this.
|
|
5179
5406
|
*/
|
|
5180
|
-
constructor(authProvider = new
|
|
5407
|
+
constructor(authProvider = new import_core7.StubAuthProvider(), serverUrl = "api.lightspark.com", cryptoImpl = import_core7.DefaultCrypto) {
|
|
5181
5408
|
this.authProvider = authProvider;
|
|
5182
5409
|
this.serverUrl = serverUrl;
|
|
5183
|
-
this.
|
|
5410
|
+
this.cryptoImpl = cryptoImpl;
|
|
5184
5411
|
const sdkVersion = require_package().version;
|
|
5185
|
-
this.
|
|
5412
|
+
this.nodeKeyCache = new import_core7.NodeKeyCache(this.cryptoImpl);
|
|
5413
|
+
this.requester = new import_core7.Requester(
|
|
5186
5414
|
this.nodeKeyCache,
|
|
5187
5415
|
LIGHTSPARK_SDK_ENDPOINT,
|
|
5188
5416
|
`js-lightspark-sdk/${sdkVersion}`,
|
|
5189
5417
|
authProvider,
|
|
5190
|
-
serverUrl
|
|
5418
|
+
serverUrl,
|
|
5419
|
+
this.cryptoImpl
|
|
5191
5420
|
);
|
|
5192
|
-
(0,
|
|
5421
|
+
(0, import_auto_bind13.default)(this);
|
|
5193
5422
|
}
|
|
5194
5423
|
requester;
|
|
5424
|
+
nodeKeyCache;
|
|
5195
5425
|
/**
|
|
5196
5426
|
* Sets the auth provider for the client. This is useful for switching between auth providers if you are using
|
|
5197
5427
|
* multiple accounts or waiting for the user to log in.
|
|
@@ -5200,12 +5430,13 @@ var LightsparkClient = class {
|
|
|
5200
5430
|
*/
|
|
5201
5431
|
async setAuthProvider(authProvider) {
|
|
5202
5432
|
const sdkVersion = require_package().version;
|
|
5203
|
-
this.requester = new
|
|
5433
|
+
this.requester = new import_core7.Requester(
|
|
5204
5434
|
this.nodeKeyCache,
|
|
5205
5435
|
LIGHTSPARK_SDK_ENDPOINT,
|
|
5206
5436
|
`js-lightspark-sdk/${sdkVersion}`,
|
|
5207
5437
|
authProvider,
|
|
5208
|
-
this.serverUrl
|
|
5438
|
+
this.serverUrl,
|
|
5439
|
+
this.cryptoImpl
|
|
5209
5440
|
);
|
|
5210
5441
|
this.authProvider = authProvider;
|
|
5211
5442
|
}
|
|
@@ -5272,10 +5503,10 @@ var LightsparkClient = class {
|
|
|
5272
5503
|
network: bitcoinNetwork
|
|
5273
5504
|
});
|
|
5274
5505
|
if (!response.current_account) {
|
|
5275
|
-
throw new
|
|
5506
|
+
throw new import_core7.LightsparkAuthException("No current account");
|
|
5276
5507
|
}
|
|
5277
5508
|
if (!response.current_account.dashboard_overview_nodes || response.current_account.dashboard_overview_nodes.entities.length === 0) {
|
|
5278
|
-
throw new
|
|
5509
|
+
throw new import_core7.LightsparkException(
|
|
5279
5510
|
"NO_NODES_FOUND",
|
|
5280
5511
|
`No nodes found for this dashboard request. This could mean one of a few things:
|
|
5281
5512
|
1. You are requesting MAINNET nodes, but you have no MAINNET nodes yet. In this case, request BitcoinNetwork.REGTEST instead.
|
|
@@ -5327,7 +5558,7 @@ var LightsparkClient = class {
|
|
|
5327
5558
|
};
|
|
5328
5559
|
}
|
|
5329
5560
|
/**
|
|
5330
|
-
* Gets a basic dashboard for a single node, including recent transactions. See `
|
|
5561
|
+
* Gets a basic dashboard for a single node, including recent transactions. See `SinglesNodeDashboard` for which info is
|
|
5331
5562
|
* included.
|
|
5332
5563
|
*
|
|
5333
5564
|
* @param nodeId The node ID for which to get a dashboard.
|
|
@@ -5336,19 +5567,22 @@ var LightsparkClient = class {
|
|
|
5336
5567
|
* Defaults to undefined (no limit).
|
|
5337
5568
|
* @returns A basic dashboard for the given node ID.
|
|
5338
5569
|
*/
|
|
5339
|
-
async
|
|
5340
|
-
const response = await this.requester.makeRawRequest(
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5570
|
+
async getSinglesNodeDashboard(nodeId, bitcoinNetwork = BitcoinNetwork_default.MAINNET, transactionsAfterDate = void 0) {
|
|
5571
|
+
const response = await this.requester.makeRawRequest(
|
|
5572
|
+
SinglesNodeDashboard,
|
|
5573
|
+
{
|
|
5574
|
+
nodeId,
|
|
5575
|
+
network: bitcoinNetwork,
|
|
5576
|
+
numTransactions: 20,
|
|
5577
|
+
transactionsAfterDate
|
|
5578
|
+
}
|
|
5579
|
+
);
|
|
5346
5580
|
if (!response.current_account) {
|
|
5347
|
-
throw new
|
|
5581
|
+
throw new import_core7.LightsparkAuthException("No current account");
|
|
5348
5582
|
}
|
|
5349
5583
|
const account = response.current_account;
|
|
5350
5584
|
if (!account.dashboard_overview_nodes || !account.dashboard_overview_nodes.entities || account.dashboard_overview_nodes.entities.length === 0) {
|
|
5351
|
-
throw new
|
|
5585
|
+
throw new import_core7.LightsparkException(
|
|
5352
5586
|
"InvalidOrMissingNode",
|
|
5353
5587
|
"No nodes found for node dashboard"
|
|
5354
5588
|
);
|
|
@@ -5497,7 +5731,7 @@ var LightsparkClient = class {
|
|
|
5497
5731
|
console.warn("No encrypted key found for node " + nodeId);
|
|
5498
5732
|
return false;
|
|
5499
5733
|
}
|
|
5500
|
-
const signingPrivateKey = await
|
|
5734
|
+
const signingPrivateKey = await this.cryptoImpl.decryptSecretWithNodePassword(
|
|
5501
5735
|
encryptedKey.cipher,
|
|
5502
5736
|
encryptedKey.encrypted_value,
|
|
5503
5737
|
password
|
|
@@ -5509,7 +5743,7 @@ var LightsparkClient = class {
|
|
|
5509
5743
|
}
|
|
5510
5744
|
let signingPrivateKeyPEM = "";
|
|
5511
5745
|
if (new Uint8Array(signingPrivateKey)[0] === 48) {
|
|
5512
|
-
signingPrivateKeyPEM = (0,
|
|
5746
|
+
signingPrivateKeyPEM = (0, import_core7.b64encode)(signingPrivateKey);
|
|
5513
5747
|
} else {
|
|
5514
5748
|
const dec = new TextDecoder();
|
|
5515
5749
|
signingPrivateKeyPEM = dec.decode(signingPrivateKey);
|
|
@@ -5569,7 +5803,7 @@ var LightsparkClient = class {
|
|
|
5569
5803
|
payerNodeId
|
|
5570
5804
|
);
|
|
5571
5805
|
if (response.pay_invoice?.payment.outgoing_payment_failure_message) {
|
|
5572
|
-
throw new
|
|
5806
|
+
throw new import_core7.LightsparkException(
|
|
5573
5807
|
"PaymentError",
|
|
5574
5808
|
response.pay_invoice?.payment.outgoing_payment_failure_message.rich_text_text
|
|
5575
5809
|
);
|
|
@@ -5604,7 +5838,7 @@ var LightsparkClient = class {
|
|
|
5604
5838
|
payerNodeId
|
|
5605
5839
|
);
|
|
5606
5840
|
if (response.send_payment?.payment.outgoing_payment_failure_message) {
|
|
5607
|
-
throw new
|
|
5841
|
+
throw new import_core7.LightsparkException(
|
|
5608
5842
|
"PaymentError",
|
|
5609
5843
|
response.send_payment?.payment.outgoing_payment_failure_message.rich_text_text
|
|
5610
5844
|
);
|
|
@@ -5748,7 +5982,7 @@ var DepositFromJson = (obj) => {
|
|
|
5748
5982
|
numConfirmations: obj["deposit_num_confirmations"]
|
|
5749
5983
|
};
|
|
5750
5984
|
};
|
|
5751
|
-
var
|
|
5985
|
+
var FRAGMENT23 = `
|
|
5752
5986
|
fragment DepositFragment on Deposit {
|
|
5753
5987
|
__typename
|
|
5754
5988
|
deposit_id: id
|
|
@@ -5792,7 +6026,7 @@ query GetDeposit($id: ID!) {
|
|
|
5792
6026
|
}
|
|
5793
6027
|
}
|
|
5794
6028
|
|
|
5795
|
-
${
|
|
6029
|
+
${FRAGMENT23}
|
|
5796
6030
|
`,
|
|
5797
6031
|
variables: { id },
|
|
5798
6032
|
constructObject: (data) => DepositFromJson(data.entity)
|
|
@@ -5811,7 +6045,7 @@ var InvoiceFromJson = (obj) => {
|
|
|
5811
6045
|
amountPaid: !!obj["invoice_amount_paid"] ? CurrencyAmountFromJson(obj["invoice_amount_paid"]) : void 0
|
|
5812
6046
|
};
|
|
5813
6047
|
};
|
|
5814
|
-
var
|
|
6048
|
+
var FRAGMENT24 = `
|
|
5815
6049
|
fragment InvoiceFragment on Invoice {
|
|
5816
6050
|
__typename
|
|
5817
6051
|
invoice_id: id
|
|
@@ -5975,7 +6209,7 @@ query GetInvoice($id: ID!) {
|
|
|
5975
6209
|
}
|
|
5976
6210
|
}
|
|
5977
6211
|
|
|
5978
|
-
${
|
|
6212
|
+
${FRAGMENT24}
|
|
5979
6213
|
`,
|
|
5980
6214
|
variables: { id },
|
|
5981
6215
|
constructObject: (data) => InvoiceFromJson(data.entity)
|
|
@@ -5983,7 +6217,7 @@ ${FRAGMENT23}
|
|
|
5983
6217
|
};
|
|
5984
6218
|
|
|
5985
6219
|
// src/objects/LightningTransaction.ts
|
|
5986
|
-
var
|
|
6220
|
+
var import_core8 = require("@lightsparkdev/core");
|
|
5987
6221
|
var LightningTransactionFromJson = (obj) => {
|
|
5988
6222
|
if (obj["__typename"] == "IncomingPayment") {
|
|
5989
6223
|
return new IncomingPayment_default(
|
|
@@ -6037,12 +6271,12 @@ var LightningTransactionFromJson = (obj) => {
|
|
|
6037
6271
|
failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
|
|
6038
6272
|
};
|
|
6039
6273
|
}
|
|
6040
|
-
throw new
|
|
6274
|
+
throw new import_core8.LightsparkException(
|
|
6041
6275
|
"DeserializationError",
|
|
6042
6276
|
`Couldn't find a concrete type for interface LightningTransaction corresponding to the typename=${obj["__typename"]}`
|
|
6043
6277
|
);
|
|
6044
6278
|
};
|
|
6045
|
-
var
|
|
6279
|
+
var FRAGMENT25 = `
|
|
6046
6280
|
fragment LightningTransactionFragment on LightningTransaction {
|
|
6047
6281
|
__typename
|
|
6048
6282
|
... on IncomingPayment {
|
|
@@ -6295,7 +6529,7 @@ query GetLightningTransaction($id: ID!) {
|
|
|
6295
6529
|
}
|
|
6296
6530
|
}
|
|
6297
6531
|
|
|
6298
|
-
${
|
|
6532
|
+
${FRAGMENT25}
|
|
6299
6533
|
`,
|
|
6300
6534
|
variables: { id },
|
|
6301
6535
|
constructObject: (data) => LightningTransactionFromJson(data.entity)
|
|
@@ -6303,7 +6537,7 @@ ${FRAGMENT24}
|
|
|
6303
6537
|
};
|
|
6304
6538
|
|
|
6305
6539
|
// src/objects/OnChainTransaction.ts
|
|
6306
|
-
var
|
|
6540
|
+
var import_core9 = require("@lightsparkdev/core");
|
|
6307
6541
|
var OnChainTransactionFromJson = (obj) => {
|
|
6308
6542
|
if (obj["__typename"] == "ChannelClosingTransaction") {
|
|
6309
6543
|
return {
|
|
@@ -6377,12 +6611,12 @@ var OnChainTransactionFromJson = (obj) => {
|
|
|
6377
6611
|
numConfirmations: obj["withdrawal_num_confirmations"]
|
|
6378
6612
|
};
|
|
6379
6613
|
}
|
|
6380
|
-
throw new
|
|
6614
|
+
throw new import_core9.LightsparkException(
|
|
6381
6615
|
"DeserializationError",
|
|
6382
6616
|
`Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`
|
|
6383
6617
|
);
|
|
6384
6618
|
};
|
|
6385
|
-
var
|
|
6619
|
+
var FRAGMENT26 = `
|
|
6386
6620
|
fragment OnChainTransactionFragment on OnChainTransaction {
|
|
6387
6621
|
__typename
|
|
6388
6622
|
... on ChannelClosingTransaction {
|
|
@@ -6525,7 +6759,7 @@ query GetOnChainTransaction($id: ID!) {
|
|
|
6525
6759
|
}
|
|
6526
6760
|
}
|
|
6527
6761
|
|
|
6528
|
-
${
|
|
6762
|
+
${FRAGMENT26}
|
|
6529
6763
|
`,
|
|
6530
6764
|
variables: { id },
|
|
6531
6765
|
constructObject: (data) => OnChainTransactionFromJson(data.entity)
|
|
@@ -6550,7 +6784,7 @@ var RoutingTransactionFromJson = (obj) => {
|
|
|
6550
6784
|
failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
|
|
6551
6785
|
};
|
|
6552
6786
|
};
|
|
6553
|
-
var
|
|
6787
|
+
var FRAGMENT27 = `
|
|
6554
6788
|
fragment RoutingTransactionFragment on RoutingTransaction {
|
|
6555
6789
|
__typename
|
|
6556
6790
|
routing_transaction_id: id
|
|
@@ -6598,7 +6832,7 @@ query GetRoutingTransaction($id: ID!) {
|
|
|
6598
6832
|
}
|
|
6599
6833
|
}
|
|
6600
6834
|
|
|
6601
|
-
${
|
|
6835
|
+
${FRAGMENT27}
|
|
6602
6836
|
`,
|
|
6603
6837
|
variables: { id },
|
|
6604
6838
|
constructObject: (data) => RoutingTransactionFromJson(data.entity)
|
|
@@ -6655,7 +6889,7 @@ var WithdrawalFromJson = (obj) => {
|
|
|
6655
6889
|
numConfirmations: obj["withdrawal_num_confirmations"]
|
|
6656
6890
|
};
|
|
6657
6891
|
};
|
|
6658
|
-
var
|
|
6892
|
+
var FRAGMENT28 = `
|
|
6659
6893
|
fragment WithdrawalFragment on Withdrawal {
|
|
6660
6894
|
__typename
|
|
6661
6895
|
withdrawal_id: id
|
|
@@ -6699,7 +6933,7 @@ query GetWithdrawal($id: ID!) {
|
|
|
6699
6933
|
}
|
|
6700
6934
|
}
|
|
6701
6935
|
|
|
6702
|
-
${
|
|
6936
|
+
${FRAGMENT28}
|
|
6703
6937
|
`,
|
|
6704
6938
|
variables: { id },
|
|
6705
6939
|
constructObject: (data) => WithdrawalFromJson(data.entity)
|
|
@@ -6734,6 +6968,7 @@ ${FRAGMENT27}
|
|
|
6734
6968
|
RoutingTransactionFailureReason,
|
|
6735
6969
|
TransactionStatus,
|
|
6736
6970
|
TransactionType,
|
|
6971
|
+
Wallet,
|
|
6737
6972
|
WebhookEventType,
|
|
6738
6973
|
WithdrawalMode,
|
|
6739
6974
|
WithdrawalRequest,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AuthProvider } from '@lightsparkdev/core';
|
|
2
|
-
export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as ApiToken, B as BitcoinNetwork,
|
|
2
|
+
export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as ApiToken, B as Balances, i as BitcoinNetwork, j as BlockchainBalance, C as Channel, k as ChannelClosingTransaction, m as ChannelFees, n as ChannelOpeningTransaction, p as ChannelStatus, q as ChannelToTransactionsConnection, r as CreateApiTokenInput, s as CreateApiTokenOutput, t as CreateInvoiceInput, u as CreateInvoiceOutput, v as CreateNodeWalletAddressInput, w as CreateNodeWalletAddressOutput, x as CurrencyAmount, y as CurrencyUnit, D as DeleteApiTokenInput, z as DeleteApiTokenOutput, E as Deposit, G as Entity, H as FeeEstimate, I as FundNodeInput, J as FundNodeOutput, K as GraphNode, M as Hop, O as HtlcAttemptFailureCode, P as IncomingPayment, Q as IncomingPaymentAttempt, S as IncomingPaymentAttemptStatus, T as IncomingPaymentToAttemptsConnection, U as Invoice, W as InvoiceData, X as InvoiceType, Y as LightningFeeEstimateForInvoiceInput, Z as LightningFeeEstimateForNodeInput, _ as LightningFeeEstimateOutput, $ as LightningTransaction, L as LightsparkClient, a1 as LightsparkNode, a2 as LightsparkNodePurpose, a3 as LightsparkNodeStatus, a4 as LightsparkNodeToChannelsConnection, a5 as Node, a6 as NodeAddress, a7 as NodeAddressType, a8 as NodeToAddressesConnection, a9 as OnChainTransaction, ab as OutgoingPayment, ac as OutgoingPaymentAttempt, ad as OutgoingPaymentAttemptStatus, ae as OutgoingPaymentAttemptToHopsConnection, af as OutgoingPaymentToAttemptsConnection, ag as PageInfo, ah as PayInvoiceInput, ai as PayInvoiceOutput, aj as PaymentFailureReason, ak as PaymentRequest, am as PaymentRequestData, an as PaymentRequestStatus, ao as Permission, ap as RequestWithdrawalInput, aq as RequestWithdrawalOutput, ar as RichText, as as RoutingTransaction, au as RoutingTransactionFailureReason, av as Secret, aw as SendPaymentInput, ax as SendPaymentOutput, ay as SinglesNodeDashboard, az as Transaction, aB as TransactionFailures, aC as TransactionStatus, aD as TransactionType, aE as TransactionUpdate, aF as Wallet, aG as WebhookEventType, aH as Withdrawal, aJ as WithdrawalMode, aK as WithdrawalRequest, aL as WithdrawalRequestStatus, aM as WithdrawalRequestToChannelClosingTransactionsConnection, aN as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, l as getChannelClosingTransactionQuery, o as getChannelOpeningTransactionQuery, F as getDepositQuery, N as getHopQuery, R as getIncomingPaymentAttemptQuery, V as getInvoiceQuery, a0 as getLightningTransactionQuery, aa as getOnChainTransactionQuery, al as getPaymentRequestQuery, at as getRoutingTransactionQuery, aA as getTransactionQuery, aI as getWithdrawalQuery } from './Withdrawal-f8570ed4.js';
|
|
3
3
|
import 'zen-observable';
|
|
4
4
|
|
|
5
5
|
declare class AccountTokenAuthProvider implements AuthProvider {
|