@lightsparkdev/lightspark-sdk 0.2.2 → 0.2.3
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 +8 -0
- package/dist/Withdrawal-6e015ff8.d.ts +1739 -0
- package/dist/Withdrawal-bf5c1b52.d.ts +1738 -0
- package/dist/Withdrawal-cc441c06.d.ts +1739 -0
- package/dist/Withdrawal-e042fa79.d.ts +1740 -0
- package/dist/chunk-ZBDRJ7IU.js +5756 -0
- package/dist/index.cjs +269 -37
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -9
- 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/client.ts +16 -11
package/dist/objects/index.cjs
CHANGED
|
@@ -55,6 +55,7 @@ __export(objects_exports, {
|
|
|
55
55
|
RoutingTransactionFailureReason: () => RoutingTransactionFailureReason_default,
|
|
56
56
|
TransactionStatus: () => TransactionStatus_default,
|
|
57
57
|
TransactionType: () => TransactionType_default,
|
|
58
|
+
Wallet: () => Wallet_default,
|
|
58
59
|
WebhookEventType: () => WebhookEventType_default,
|
|
59
60
|
WithdrawalMode: () => WithdrawalMode_default,
|
|
60
61
|
WithdrawalRequest: () => WithdrawalRequest_default,
|
|
@@ -76,7 +77,7 @@ __export(objects_exports, {
|
|
|
76
77
|
module.exports = __toCommonJS(objects_exports);
|
|
77
78
|
|
|
78
79
|
// src/objects/Account.ts
|
|
79
|
-
var
|
|
80
|
+
var import_auto_bind10 = __toESM(require("auto-bind"), 1);
|
|
80
81
|
|
|
81
82
|
// src/objects/Permission.ts
|
|
82
83
|
var Permission = /* @__PURE__ */ ((Permission2) => {
|
|
@@ -2819,6 +2820,168 @@ var AccountToTransactionsConnectionFromJson = (obj) => {
|
|
|
2819
2820
|
};
|
|
2820
2821
|
};
|
|
2821
2822
|
|
|
2823
|
+
// src/objects/Wallet.ts
|
|
2824
|
+
var import_auto_bind9 = __toESM(require("auto-bind"), 1);
|
|
2825
|
+
|
|
2826
|
+
// src/objects/Balances.ts
|
|
2827
|
+
var BalancesFromJson = (obj) => {
|
|
2828
|
+
return {
|
|
2829
|
+
ownedBalance: CurrencyAmountFromJson(obj["balances_owned_balance"]),
|
|
2830
|
+
availableToSendBalance: CurrencyAmountFromJson(
|
|
2831
|
+
obj["balances_available_to_send_balance"]
|
|
2832
|
+
),
|
|
2833
|
+
availableToWithdrawBalance: CurrencyAmountFromJson(
|
|
2834
|
+
obj["balances_available_to_withdraw_balance"]
|
|
2835
|
+
)
|
|
2836
|
+
};
|
|
2837
|
+
};
|
|
2838
|
+
|
|
2839
|
+
// src/objects/Wallet.ts
|
|
2840
|
+
var Wallet = class {
|
|
2841
|
+
constructor(id, createdAt, updatedAt, thirdPartyIdentifier, typename, lastLoginAt, balances) {
|
|
2842
|
+
this.id = id;
|
|
2843
|
+
this.createdAt = createdAt;
|
|
2844
|
+
this.updatedAt = updatedAt;
|
|
2845
|
+
this.thirdPartyIdentifier = thirdPartyIdentifier;
|
|
2846
|
+
this.typename = typename;
|
|
2847
|
+
this.lastLoginAt = lastLoginAt;
|
|
2848
|
+
this.balances = balances;
|
|
2849
|
+
(0, import_auto_bind9.default)(this);
|
|
2850
|
+
}
|
|
2851
|
+
async getTotalAmountReceived(client, createdAfterDate = void 0, createdBeforeDate = void 0) {
|
|
2852
|
+
return await client.executeRawQuery({
|
|
2853
|
+
queryPayload: `
|
|
2854
|
+
query FetchWalletTotalAmountReceived($created_after_date: DateTime, $created_before_date: DateTime) {
|
|
2855
|
+
current_wallet {
|
|
2856
|
+
... on Wallet {
|
|
2857
|
+
total_amount_received(, created_after_date: $created_after_date, created_before_date: $created_before_date) {
|
|
2858
|
+
__typename
|
|
2859
|
+
currency_amount_original_value: original_value
|
|
2860
|
+
currency_amount_original_unit: original_unit
|
|
2861
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
2862
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
2863
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
`,
|
|
2869
|
+
variables: {
|
|
2870
|
+
created_after_date: createdAfterDate,
|
|
2871
|
+
created_before_date: createdBeforeDate
|
|
2872
|
+
},
|
|
2873
|
+
constructObject: (json) => {
|
|
2874
|
+
const connection = json["current_wallet"]["total_amount_received"];
|
|
2875
|
+
return CurrencyAmountFromJson(connection);
|
|
2876
|
+
}
|
|
2877
|
+
});
|
|
2878
|
+
}
|
|
2879
|
+
async getTotalAmountSent(client, createdAfterDate = void 0, createdBeforeDate = void 0) {
|
|
2880
|
+
return await client.executeRawQuery({
|
|
2881
|
+
queryPayload: `
|
|
2882
|
+
query FetchWalletTotalAmountSent($created_after_date: DateTime, $created_before_date: DateTime) {
|
|
2883
|
+
current_wallet {
|
|
2884
|
+
... on Wallet {
|
|
2885
|
+
total_amount_sent(, created_after_date: $created_after_date, created_before_date: $created_before_date) {
|
|
2886
|
+
__typename
|
|
2887
|
+
currency_amount_original_value: original_value
|
|
2888
|
+
currency_amount_original_unit: original_unit
|
|
2889
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
2890
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
2891
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
`,
|
|
2897
|
+
variables: {
|
|
2898
|
+
created_after_date: createdAfterDate,
|
|
2899
|
+
created_before_date: createdBeforeDate
|
|
2900
|
+
},
|
|
2901
|
+
constructObject: (json) => {
|
|
2902
|
+
const connection = json["current_wallet"]["total_amount_sent"];
|
|
2903
|
+
return CurrencyAmountFromJson(connection);
|
|
2904
|
+
}
|
|
2905
|
+
});
|
|
2906
|
+
}
|
|
2907
|
+
static getWalletQuery() {
|
|
2908
|
+
return {
|
|
2909
|
+
queryPayload: `
|
|
2910
|
+
query GetWallet {
|
|
2911
|
+
current_wallet {
|
|
2912
|
+
... on Wallet {
|
|
2913
|
+
...WalletFragment
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
${FRAGMENT13}
|
|
2919
|
+
`,
|
|
2920
|
+
variables: {},
|
|
2921
|
+
constructObject: (data) => WalletFromJson(data.current_wallet)
|
|
2922
|
+
};
|
|
2923
|
+
}
|
|
2924
|
+
};
|
|
2925
|
+
var WalletFromJson = (obj) => {
|
|
2926
|
+
return new Wallet(
|
|
2927
|
+
obj["wallet_id"],
|
|
2928
|
+
obj["wallet_created_at"],
|
|
2929
|
+
obj["wallet_updated_at"],
|
|
2930
|
+
obj["wallet_third_party_identifier"],
|
|
2931
|
+
"Wallet",
|
|
2932
|
+
obj["wallet_last_login_at"],
|
|
2933
|
+
!!obj["wallet_balances"] ? BalancesFromJson(obj["wallet_balances"]) : void 0
|
|
2934
|
+
);
|
|
2935
|
+
};
|
|
2936
|
+
var FRAGMENT13 = `
|
|
2937
|
+
fragment WalletFragment on Wallet {
|
|
2938
|
+
__typename
|
|
2939
|
+
wallet_id: id
|
|
2940
|
+
wallet_created_at: created_at
|
|
2941
|
+
wallet_updated_at: updated_at
|
|
2942
|
+
wallet_last_login_at: last_login_at
|
|
2943
|
+
wallet_balances: balances {
|
|
2944
|
+
__typename
|
|
2945
|
+
balances_owned_balance: owned_balance {
|
|
2946
|
+
__typename
|
|
2947
|
+
currency_amount_original_value: original_value
|
|
2948
|
+
currency_amount_original_unit: original_unit
|
|
2949
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
2950
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
2951
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
2952
|
+
}
|
|
2953
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
2954
|
+
__typename
|
|
2955
|
+
currency_amount_original_value: original_value
|
|
2956
|
+
currency_amount_original_unit: original_unit
|
|
2957
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
2958
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
2959
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
2960
|
+
}
|
|
2961
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
2962
|
+
__typename
|
|
2963
|
+
currency_amount_original_value: original_value
|
|
2964
|
+
currency_amount_original_unit: original_unit
|
|
2965
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
2966
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
2967
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
wallet_third_party_identifier: third_party_identifier
|
|
2971
|
+
}`;
|
|
2972
|
+
var Wallet_default = Wallet;
|
|
2973
|
+
|
|
2974
|
+
// src/objects/AccountToWalletsConnection.ts
|
|
2975
|
+
var AccountToWalletsConnectionFromJson = (obj) => {
|
|
2976
|
+
return {
|
|
2977
|
+
pageInfo: PageInfoFromJson(obj["account_to_wallets_connection_page_info"]),
|
|
2978
|
+
count: obj["account_to_wallets_connection_count"],
|
|
2979
|
+
entities: obj["account_to_wallets_connection_entities"].map(
|
|
2980
|
+
(e) => WalletFromJson(e)
|
|
2981
|
+
)
|
|
2982
|
+
};
|
|
2983
|
+
};
|
|
2984
|
+
|
|
2822
2985
|
// src/objects/Account.ts
|
|
2823
2986
|
var Account = class {
|
|
2824
2987
|
constructor(id, createdAt, updatedAt, typename, name) {
|
|
@@ -2827,7 +2990,7 @@ var Account = class {
|
|
|
2827
2990
|
this.updatedAt = updatedAt;
|
|
2828
2991
|
this.typename = typename;
|
|
2829
2992
|
this.name = name;
|
|
2830
|
-
(0,
|
|
2993
|
+
(0, import_auto_bind10.default)(this);
|
|
2831
2994
|
}
|
|
2832
2995
|
async getApiTokens(client, first = void 0) {
|
|
2833
2996
|
return await client.executeRawQuery({
|
|
@@ -3905,6 +4068,69 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
|
|
|
3905
4068
|
}
|
|
3906
4069
|
});
|
|
3907
4070
|
}
|
|
4071
|
+
async getWallets(client, first = void 0) {
|
|
4072
|
+
return await client.executeRawQuery({
|
|
4073
|
+
queryPayload: `
|
|
4074
|
+
query FetchAccountToWalletsConnection($first: Int) {
|
|
4075
|
+
current_account {
|
|
4076
|
+
... on Account {
|
|
4077
|
+
wallets(, first: $first) {
|
|
4078
|
+
__typename
|
|
4079
|
+
account_to_wallets_connection_page_info: page_info {
|
|
4080
|
+
__typename
|
|
4081
|
+
page_info_has_next_page: has_next_page
|
|
4082
|
+
page_info_has_previous_page: has_previous_page
|
|
4083
|
+
page_info_start_cursor: start_cursor
|
|
4084
|
+
page_info_end_cursor: end_cursor
|
|
4085
|
+
}
|
|
4086
|
+
account_to_wallets_connection_count: count
|
|
4087
|
+
account_to_wallets_connection_entities: entities {
|
|
4088
|
+
__typename
|
|
4089
|
+
wallet_id: id
|
|
4090
|
+
wallet_created_at: created_at
|
|
4091
|
+
wallet_updated_at: updated_at
|
|
4092
|
+
wallet_last_login_at: last_login_at
|
|
4093
|
+
wallet_balances: balances {
|
|
4094
|
+
__typename
|
|
4095
|
+
balances_owned_balance: owned_balance {
|
|
4096
|
+
__typename
|
|
4097
|
+
currency_amount_original_value: original_value
|
|
4098
|
+
currency_amount_original_unit: original_unit
|
|
4099
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
4100
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
4101
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
4102
|
+
}
|
|
4103
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
4104
|
+
__typename
|
|
4105
|
+
currency_amount_original_value: original_value
|
|
4106
|
+
currency_amount_original_unit: original_unit
|
|
4107
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
4108
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
4109
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
4110
|
+
}
|
|
4111
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
4112
|
+
__typename
|
|
4113
|
+
currency_amount_original_value: original_value
|
|
4114
|
+
currency_amount_original_unit: original_unit
|
|
4115
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
4116
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
4117
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
wallet_third_party_identifier: third_party_identifier
|
|
4121
|
+
}
|
|
4122
|
+
}
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
}
|
|
4126
|
+
`,
|
|
4127
|
+
variables: { first },
|
|
4128
|
+
constructObject: (json) => {
|
|
4129
|
+
const connection = json["current_account"]["wallets"];
|
|
4130
|
+
return AccountToWalletsConnectionFromJson(connection);
|
|
4131
|
+
}
|
|
4132
|
+
});
|
|
4133
|
+
}
|
|
3908
4134
|
static getAccountQuery() {
|
|
3909
4135
|
return {
|
|
3910
4136
|
queryPayload: `
|
|
@@ -3916,7 +4142,7 @@ query GetAccount {
|
|
|
3916
4142
|
}
|
|
3917
4143
|
}
|
|
3918
4144
|
|
|
3919
|
-
${
|
|
4145
|
+
${FRAGMENT14}
|
|
3920
4146
|
`,
|
|
3921
4147
|
variables: {},
|
|
3922
4148
|
constructObject: (data) => AccountFromJson(data.current_account)
|
|
@@ -3932,7 +4158,7 @@ var AccountFromJson = (obj) => {
|
|
|
3932
4158
|
obj["account_name"]
|
|
3933
4159
|
);
|
|
3934
4160
|
};
|
|
3935
|
-
var
|
|
4161
|
+
var FRAGMENT14 = `
|
|
3936
4162
|
fragment AccountFragment on Account {
|
|
3937
4163
|
__typename
|
|
3938
4164
|
account_id: id
|
|
@@ -3961,7 +4187,7 @@ var ChannelClosingTransactionFromJson = (obj) => {
|
|
|
3961
4187
|
channelId: obj["channel_closing_transaction_channel"]?.id ?? void 0
|
|
3962
4188
|
};
|
|
3963
4189
|
};
|
|
3964
|
-
var
|
|
4190
|
+
var FRAGMENT15 = `
|
|
3965
4191
|
fragment ChannelClosingTransactionFragment on ChannelClosingTransaction {
|
|
3966
4192
|
__typename
|
|
3967
4193
|
channel_closing_transaction_id: id
|
|
@@ -4005,7 +4231,7 @@ query GetChannelClosingTransaction($id: ID!) {
|
|
|
4005
4231
|
}
|
|
4006
4232
|
}
|
|
4007
4233
|
|
|
4008
|
-
${
|
|
4234
|
+
${FRAGMENT15}
|
|
4009
4235
|
`,
|
|
4010
4236
|
variables: { id },
|
|
4011
4237
|
constructObject: (data) => ChannelClosingTransactionFromJson(data.entity)
|
|
@@ -4031,7 +4257,7 @@ var ChannelOpeningTransactionFromJson = (obj) => {
|
|
|
4031
4257
|
channelId: obj["channel_opening_transaction_channel"]?.id ?? void 0
|
|
4032
4258
|
};
|
|
4033
4259
|
};
|
|
4034
|
-
var
|
|
4260
|
+
var FRAGMENT16 = `
|
|
4035
4261
|
fragment ChannelOpeningTransactionFragment on ChannelOpeningTransaction {
|
|
4036
4262
|
__typename
|
|
4037
4263
|
channel_opening_transaction_id: id
|
|
@@ -4075,7 +4301,7 @@ query GetChannelOpeningTransaction($id: ID!) {
|
|
|
4075
4301
|
}
|
|
4076
4302
|
}
|
|
4077
4303
|
|
|
4078
|
-
${
|
|
4304
|
+
${FRAGMENT16}
|
|
4079
4305
|
`,
|
|
4080
4306
|
variables: { id },
|
|
4081
4307
|
constructObject: (data) => ChannelOpeningTransactionFromJson(data.entity)
|
|
@@ -4110,7 +4336,7 @@ var DepositFromJson = (obj) => {
|
|
|
4110
4336
|
numConfirmations: obj["deposit_num_confirmations"]
|
|
4111
4337
|
};
|
|
4112
4338
|
};
|
|
4113
|
-
var
|
|
4339
|
+
var FRAGMENT17 = `
|
|
4114
4340
|
fragment DepositFragment on Deposit {
|
|
4115
4341
|
__typename
|
|
4116
4342
|
deposit_id: id
|
|
@@ -4154,7 +4380,7 @@ query GetDeposit($id: ID!) {
|
|
|
4154
4380
|
}
|
|
4155
4381
|
}
|
|
4156
4382
|
|
|
4157
|
-
${
|
|
4383
|
+
${FRAGMENT17}
|
|
4158
4384
|
`,
|
|
4159
4385
|
variables: { id },
|
|
4160
4386
|
constructObject: (data) => DepositFromJson(data.entity)
|
|
@@ -4173,7 +4399,7 @@ var InvoiceFromJson = (obj) => {
|
|
|
4173
4399
|
amountPaid: !!obj["invoice_amount_paid"] ? CurrencyAmountFromJson(obj["invoice_amount_paid"]) : void 0
|
|
4174
4400
|
};
|
|
4175
4401
|
};
|
|
4176
|
-
var
|
|
4402
|
+
var FRAGMENT18 = `
|
|
4177
4403
|
fragment InvoiceFragment on Invoice {
|
|
4178
4404
|
__typename
|
|
4179
4405
|
invoice_id: id
|
|
@@ -4337,7 +4563,7 @@ query GetInvoice($id: ID!) {
|
|
|
4337
4563
|
}
|
|
4338
4564
|
}
|
|
4339
4565
|
|
|
4340
|
-
${
|
|
4566
|
+
${FRAGMENT18}
|
|
4341
4567
|
`,
|
|
4342
4568
|
variables: { id },
|
|
4343
4569
|
constructObject: (data) => InvoiceFromJson(data.entity)
|
|
@@ -4404,7 +4630,7 @@ var LightningTransactionFromJson = (obj) => {
|
|
|
4404
4630
|
`Couldn't find a concrete type for interface LightningTransaction corresponding to the typename=${obj["__typename"]}`
|
|
4405
4631
|
);
|
|
4406
4632
|
};
|
|
4407
|
-
var
|
|
4633
|
+
var FRAGMENT19 = `
|
|
4408
4634
|
fragment LightningTransactionFragment on LightningTransaction {
|
|
4409
4635
|
__typename
|
|
4410
4636
|
... on IncomingPayment {
|
|
@@ -4657,7 +4883,7 @@ query GetLightningTransaction($id: ID!) {
|
|
|
4657
4883
|
}
|
|
4658
4884
|
}
|
|
4659
4885
|
|
|
4660
|
-
${
|
|
4886
|
+
${FRAGMENT19}
|
|
4661
4887
|
`,
|
|
4662
4888
|
variables: { id },
|
|
4663
4889
|
constructObject: (data) => LightningTransactionFromJson(data.entity)
|
|
@@ -4744,7 +4970,7 @@ var OnChainTransactionFromJson = (obj) => {
|
|
|
4744
4970
|
`Couldn't find a concrete type for interface OnChainTransaction corresponding to the typename=${obj["__typename"]}`
|
|
4745
4971
|
);
|
|
4746
4972
|
};
|
|
4747
|
-
var
|
|
4973
|
+
var FRAGMENT20 = `
|
|
4748
4974
|
fragment OnChainTransactionFragment on OnChainTransaction {
|
|
4749
4975
|
__typename
|
|
4750
4976
|
... on ChannelClosingTransaction {
|
|
@@ -4887,7 +5113,7 @@ query GetOnChainTransaction($id: ID!) {
|
|
|
4887
5113
|
}
|
|
4888
5114
|
}
|
|
4889
5115
|
|
|
4890
|
-
${
|
|
5116
|
+
${FRAGMENT20}
|
|
4891
5117
|
`,
|
|
4892
5118
|
variables: { id },
|
|
4893
5119
|
constructObject: (data) => OnChainTransactionFromJson(data.entity)
|
|
@@ -4921,7 +5147,7 @@ var RoutingTransactionFromJson = (obj) => {
|
|
|
4921
5147
|
failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
|
|
4922
5148
|
};
|
|
4923
5149
|
};
|
|
4924
|
-
var
|
|
5150
|
+
var FRAGMENT21 = `
|
|
4925
5151
|
fragment RoutingTransactionFragment on RoutingTransaction {
|
|
4926
5152
|
__typename
|
|
4927
5153
|
routing_transaction_id: id
|
|
@@ -4969,7 +5195,7 @@ query GetRoutingTransaction($id: ID!) {
|
|
|
4969
5195
|
}
|
|
4970
5196
|
}
|
|
4971
5197
|
|
|
4972
|
-
${
|
|
5198
|
+
${FRAGMENT21}
|
|
4973
5199
|
`,
|
|
4974
5200
|
variables: { id },
|
|
4975
5201
|
constructObject: (data) => RoutingTransactionFromJson(data.entity)
|
|
@@ -5026,7 +5252,7 @@ var WithdrawalFromJson = (obj) => {
|
|
|
5026
5252
|
numConfirmations: obj["withdrawal_num_confirmations"]
|
|
5027
5253
|
};
|
|
5028
5254
|
};
|
|
5029
|
-
var
|
|
5255
|
+
var FRAGMENT22 = `
|
|
5030
5256
|
fragment WithdrawalFragment on Withdrawal {
|
|
5031
5257
|
__typename
|
|
5032
5258
|
withdrawal_id: id
|
|
@@ -5070,7 +5296,7 @@ query GetWithdrawal($id: ID!) {
|
|
|
5070
5296
|
}
|
|
5071
5297
|
}
|
|
5072
5298
|
|
|
5073
|
-
${
|
|
5299
|
+
${FRAGMENT22}
|
|
5074
5300
|
`,
|
|
5075
5301
|
variables: { id },
|
|
5076
5302
|
constructObject: (data) => WithdrawalFromJson(data.entity)
|
|
@@ -5078,7 +5304,7 @@ ${FRAGMENT21}
|
|
|
5078
5304
|
};
|
|
5079
5305
|
|
|
5080
5306
|
// src/objects/WithdrawalRequest.ts
|
|
5081
|
-
var
|
|
5307
|
+
var import_auto_bind11 = __toESM(require("auto-bind"), 1);
|
|
5082
5308
|
|
|
5083
5309
|
// src/objects/WithdrawalRequestStatus.ts
|
|
5084
5310
|
var WithdrawalRequestStatus = /* @__PURE__ */ ((WithdrawalRequestStatus2) => {
|
|
@@ -5126,7 +5352,7 @@ var WithdrawalRequest = class {
|
|
|
5126
5352
|
this.estimatedAmount = estimatedAmount;
|
|
5127
5353
|
this.completedAt = completedAt;
|
|
5128
5354
|
this.withdrawalId = withdrawalId;
|
|
5129
|
-
(0,
|
|
5355
|
+
(0, import_auto_bind11.default)(this);
|
|
5130
5356
|
}
|
|
5131
5357
|
async getChannelClosingTransactions(client, first = void 0) {
|
|
5132
5358
|
return await client.executeRawQuery({
|
|
@@ -5263,7 +5489,7 @@ query GetWithdrawalRequest($id: ID!) {
|
|
|
5263
5489
|
}
|
|
5264
5490
|
}
|
|
5265
5491
|
|
|
5266
|
-
${
|
|
5492
|
+
${FRAGMENT23}
|
|
5267
5493
|
`,
|
|
5268
5494
|
variables: { id },
|
|
5269
5495
|
constructObject: (data) => WithdrawalRequestFromJson(data.entity)
|
|
@@ -5285,7 +5511,7 @@ var WithdrawalRequestFromJson = (obj) => {
|
|
|
5285
5511
|
obj["withdrawal_request_withdrawal"]?.id ?? void 0
|
|
5286
5512
|
);
|
|
5287
5513
|
};
|
|
5288
|
-
var
|
|
5514
|
+
var FRAGMENT23 = `
|
|
5289
5515
|
fragment WithdrawalRequestFragment on WithdrawalRequest {
|
|
5290
5516
|
__typename
|
|
5291
5517
|
withdrawal_request_id: id
|
|
@@ -5343,6 +5569,7 @@ var WithdrawalRequest_default = WithdrawalRequest;
|
|
|
5343
5569
|
RoutingTransactionFailureReason,
|
|
5344
5570
|
TransactionStatus,
|
|
5345
5571
|
TransactionType,
|
|
5572
|
+
Wallet,
|
|
5346
5573
|
WebhookEventType,
|
|
5347
5574
|
WithdrawalMode,
|
|
5348
5575
|
WithdrawalRequest,
|
package/dist/objects/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
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,
|
|
1
|
+
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, 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 Transaction, aA as TransactionFailures, aB as TransactionStatus, aC as TransactionType, aD as TransactionUpdate, aE as Wallet, aF as WalletDashboard, 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, az as getTransactionQuery, aI as getWithdrawalQuery } from '../Withdrawal-6e015ff8.js';
|
|
2
2
|
import '@lightsparkdev/core';
|
|
3
3
|
import 'zen-observable';
|
package/dist/objects/index.js
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
RoutingTransactionFailureReason_default,
|
|
25
25
|
TransactionStatus_default,
|
|
26
26
|
TransactionType_default,
|
|
27
|
+
Wallet_default,
|
|
27
28
|
WebhookEventType_default,
|
|
28
29
|
WithdrawalMode_default,
|
|
29
30
|
WithdrawalRequestStatus_default,
|
|
@@ -41,7 +42,7 @@ import {
|
|
|
41
42
|
getRoutingTransactionQuery,
|
|
42
43
|
getTransactionQuery,
|
|
43
44
|
getWithdrawalQuery
|
|
44
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-ZBDRJ7IU.js";
|
|
45
46
|
export {
|
|
46
47
|
Account_default as Account,
|
|
47
48
|
AccountToChannelsConnection_default as AccountToChannelsConnection,
|
|
@@ -68,6 +69,7 @@ export {
|
|
|
68
69
|
RoutingTransactionFailureReason_default as RoutingTransactionFailureReason,
|
|
69
70
|
TransactionStatus_default as TransactionStatus,
|
|
70
71
|
TransactionType_default as TransactionType,
|
|
72
|
+
Wallet_default as Wallet,
|
|
71
73
|
WebhookEventType_default as WebhookEventType,
|
|
72
74
|
WithdrawalMode_default as WithdrawalMode,
|
|
73
75
|
WithdrawalRequest_default as WithdrawalRequest,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightsparkdev/lightspark-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Lightspark JS SDK",
|
|
5
5
|
"author": "Lightspark Inc.",
|
|
6
6
|
"keywords": [
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"license": "Apache-2.0",
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@lightsparkdev/core": "^0.2.
|
|
71
|
+
"@lightsparkdev/core": "^0.2.2",
|
|
72
72
|
"auto-bind": "^5.0.1",
|
|
73
73
|
"crypto": "^1.0.1",
|
|
74
74
|
"crypto-browserify": "^3.12.0",
|
package/src/client.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
2
|
|
|
3
|
-
import { Query } from "@lightsparkdev/core";
|
|
3
|
+
import { LightsparkSigningException, Query } from "@lightsparkdev/core";
|
|
4
4
|
import autoBind from "auto-bind";
|
|
5
5
|
import Observable from "zen-observable";
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
AuthProvider,
|
|
9
9
|
b64encode,
|
|
10
|
-
|
|
10
|
+
CryptoInterface,
|
|
11
|
+
DefaultCrypto,
|
|
11
12
|
LightsparkAuthException,
|
|
12
13
|
LightsparkException,
|
|
13
|
-
LightsparkSigningException,
|
|
14
14
|
Maybe,
|
|
15
15
|
NodeKeyCache,
|
|
16
16
|
Requester,
|
|
@@ -85,6 +85,7 @@ import WithdrawalRequest, {
|
|
|
85
85
|
*/
|
|
86
86
|
class LightsparkClient {
|
|
87
87
|
private requester: Requester;
|
|
88
|
+
private readonly nodeKeyCache: NodeKeyCache;
|
|
88
89
|
|
|
89
90
|
/**
|
|
90
91
|
* Constructs a new LightsparkClient.
|
|
@@ -98,15 +99,17 @@ class LightsparkClient {
|
|
|
98
99
|
constructor(
|
|
99
100
|
private authProvider: AuthProvider = new StubAuthProvider(),
|
|
100
101
|
private readonly serverUrl: string = "api.lightspark.com",
|
|
101
|
-
private readonly
|
|
102
|
+
private readonly cryptoImpl: CryptoInterface = DefaultCrypto
|
|
102
103
|
) {
|
|
103
104
|
const sdkVersion = require("../package.json").version;
|
|
105
|
+
this.nodeKeyCache = new NodeKeyCache(this.cryptoImpl);
|
|
104
106
|
this.requester = new Requester(
|
|
105
107
|
this.nodeKeyCache,
|
|
106
108
|
LIGHTSPARK_SDK_ENDPOINT,
|
|
107
109
|
`js-lightspark-sdk/${sdkVersion}`,
|
|
108
110
|
authProvider,
|
|
109
|
-
serverUrl
|
|
111
|
+
serverUrl,
|
|
112
|
+
this.cryptoImpl
|
|
110
113
|
);
|
|
111
114
|
|
|
112
115
|
autoBind(this);
|
|
@@ -125,7 +128,8 @@ class LightsparkClient {
|
|
|
125
128
|
LIGHTSPARK_SDK_ENDPOINT,
|
|
126
129
|
`js-lightspark-sdk/${sdkVersion}`,
|
|
127
130
|
authProvider,
|
|
128
|
-
this.serverUrl
|
|
131
|
+
this.serverUrl,
|
|
132
|
+
this.cryptoImpl
|
|
129
133
|
);
|
|
130
134
|
this.authProvider = authProvider;
|
|
131
135
|
}
|
|
@@ -489,11 +493,12 @@ class LightsparkClient {
|
|
|
489
493
|
return false;
|
|
490
494
|
}
|
|
491
495
|
|
|
492
|
-
const signingPrivateKey =
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
496
|
+
const signingPrivateKey =
|
|
497
|
+
await this.cryptoImpl.decryptSecretWithNodePassword(
|
|
498
|
+
encryptedKey.cipher,
|
|
499
|
+
encryptedKey.encrypted_value,
|
|
500
|
+
password
|
|
501
|
+
);
|
|
497
502
|
|
|
498
503
|
if (!signingPrivateKey) {
|
|
499
504
|
throw new LightsparkSigningException(
|