@lightsparkdev/lightspark-sdk 1.2.2 → 1.3.0
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 +21 -0
- package/dist/{BitcoinNetwork-a816c0be.d.ts → BitcoinNetwork-972b1d01.d.ts} +4 -1
- package/dist/{chunk-GLL4KTUT.js → chunk-Y55D3PD4.js} +11 -11
- package/dist/env.d.cts +1 -1
- package/dist/env.d.ts +1 -1
- package/dist/{index-eb604025.d.ts → index-a5028d74.d.ts} +866 -451
- package/dist/index.cjs +622 -557
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +363 -298
- package/dist/objects/index.d.cts +2 -2
- package/dist/objects/index.d.ts +2 -2
- package/dist/objects/index.js +1 -1
- package/package.json +4 -4
- package/src/NodeKeyLoaderCache.ts +4 -3
- package/src/SigningKeyLoader.ts +12 -7
- package/src/client.ts +117 -65
- package/src/env.ts +3 -1
- package/src/graphql/CancelInvoice.ts +17 -0
- package/src/objects/Account.ts +7 -3
- package/src/objects/AccountToApiTokensConnection.ts +3 -2
- package/src/objects/AccountToChannelsConnection.ts +3 -2
- package/src/objects/AccountToNodesConnection.ts +3 -2
- package/src/objects/AccountToPaymentRequestsConnection.ts +3 -2
- package/src/objects/AccountToTransactionsConnection.ts +7 -6
- package/src/objects/AccountToWalletsConnection.ts +3 -2
- package/src/objects/ApiToken.ts +10 -5
- package/src/objects/Balances.ts +20 -12
- package/src/objects/BitcoinNetwork.ts +4 -1
- package/src/objects/CancelInvoiceInput.ts +18 -0
- package/src/objects/CancelInvoiceOutput.ts +26 -0
- package/src/objects/Channel.ts +26 -12
- package/src/objects/ChannelClosingTransaction.ts +7 -3
- package/src/objects/ChannelOpeningTransaction.ts +7 -3
- package/src/objects/ChannelStatus.ts +24 -5
- package/src/objects/ChannelToTransactionsConnection.ts +9 -8
- package/src/objects/Connection.ts +3 -2
- package/src/objects/CreateApiTokenOutput.ts +3 -3
- package/src/objects/CreateLnurlInvoiceInput.ts +3 -2
- package/src/objects/CreateTestModePaymentInput.ts +2 -2
- package/src/objects/CreateTestModePaymentoutput.ts +5 -1
- package/src/objects/CurrencyAmount.ts +2 -2
- package/src/objects/CurrencyUnit.ts +29 -6
- package/src/objects/Deposit.ts +8 -3
- package/src/objects/Entity.ts +8 -3
- package/src/objects/FeeEstimate.ts +5 -1
- package/src/objects/GraphNode.ts +20 -11
- package/src/objects/Hop.ts +8 -3
- package/src/objects/HtlcAttemptFailureCode.ts +4 -1
- package/src/objects/IncentivesIneligibilityReason.ts +16 -4
- package/src/objects/IncentivesStatus.ts +9 -2
- package/src/objects/IncomingPayment.ts +9 -5
- package/src/objects/IncomingPaymentAttempt.ts +7 -3
- package/src/objects/IncomingPaymentToAttemptsConnection.ts +3 -2
- package/src/objects/Invoice.ts +2 -2
- package/src/objects/InvoiceData.ts +7 -3
- package/src/objects/LightningFeeEstimateForInvoiceInput.ts +2 -2
- package/src/objects/LightningTransaction.ts +7 -3
- package/src/objects/LightsparkNode.ts +21 -12
- package/src/objects/LightsparkNodeOwner.ts +2 -2
- package/src/objects/LightsparkNodeToChannelsConnection.ts +3 -2
- package/src/objects/LightsparkNodeWithOSK.ts +20 -12
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +16 -11
- package/src/objects/Node.ts +19 -11
- package/src/objects/NodeAddressType.ts +4 -1
- package/src/objects/NodeToAddressesConnection.ts +7 -3
- package/src/objects/OnChainTransaction.ts +8 -3
- package/src/objects/OutgoingPayment.ts +8 -3
- package/src/objects/OutgoingPaymentAttempt.ts +16 -9
- package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +7 -3
- package/src/objects/OutgoingPaymentToAttemptsConnection.ts +3 -2
- package/src/objects/PageInfo.ts +5 -1
- package/src/objects/PayInvoiceInput.ts +4 -1
- package/src/objects/PaymentFailureReason.ts +4 -1
- package/src/objects/PaymentRequest.ts +7 -3
- package/src/objects/PaymentRequestData.ts +5 -1
- package/src/objects/PaymentRequestStatus.ts +4 -1
- package/src/objects/Permission.ts +4 -1
- package/src/objects/RegisterPaymentInput.ts +8 -7
- package/src/objects/RequestWithdrawalInput.ts +2 -2
- package/src/objects/RiskRating.ts +5 -1
- package/src/objects/RoutingTransaction.ts +11 -5
- package/src/objects/RoutingTransactionFailureReason.ts +4 -1
- package/src/objects/ScreenNodeInput.ts +3 -2
- package/src/objects/SendPaymentInput.ts +4 -1
- package/src/objects/SetInvoicePaymentHashInput.ts +3 -2
- package/src/objects/Signable.ts +2 -2
- package/src/objects/SignablePayload.ts +6 -3
- package/src/objects/Transaction.ts +8 -3
- package/src/objects/TransactionStatus.ts +8 -2
- package/src/objects/TransactionType.ts +16 -4
- package/src/objects/TransactionUpdate.ts +6 -3
- package/src/objects/UmaInvitation.ts +2 -2
- package/src/objects/Wallet.ts +12 -4
- package/src/objects/WalletStatus.ts +18 -4
- package/src/objects/WalletToPaymentRequestsConnection.ts +3 -2
- package/src/objects/WalletToTransactionsConnection.ts +3 -2
- package/src/objects/WebhookEventType.ts +4 -1
- package/src/objects/Withdrawal.ts +7 -3
- package/src/objects/WithdrawalRequest.ts +10 -5
- package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +3 -2
- package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +3 -2
- package/src/objects/index.ts +8 -6
- package/src/tests/integration/general-regtest.test.ts +15 -1
package/dist/index.cjs
CHANGED
|
@@ -1949,7 +1949,7 @@ var import_core9 = require("@lightsparkdev/core");
|
|
|
1949
1949
|
// package.json
|
|
1950
1950
|
var package_default = {
|
|
1951
1951
|
name: "@lightsparkdev/lightspark-sdk",
|
|
1952
|
-
version: "1.
|
|
1952
|
+
version: "1.3.0",
|
|
1953
1953
|
description: "Lightspark JS SDK",
|
|
1954
1954
|
author: "Lightspark Inc.",
|
|
1955
1955
|
keywords: [
|
|
@@ -2018,7 +2018,7 @@ var package_default = {
|
|
|
2018
2018
|
],
|
|
2019
2019
|
scripts: {
|
|
2020
2020
|
build: "yarn tsc && tsup",
|
|
2021
|
-
"build:watch": "yarn build --watch",
|
|
2021
|
+
"build:watch": "yarn build --watch --clean=false",
|
|
2022
2022
|
clean: "rm -rf .turbo && rm -rf dist",
|
|
2023
2023
|
dev: "yarn build -- --watch",
|
|
2024
2024
|
docs: "typedoc src",
|
|
@@ -2037,7 +2037,7 @@ var package_default = {
|
|
|
2037
2037
|
},
|
|
2038
2038
|
license: "Apache-2.0",
|
|
2039
2039
|
dependencies: {
|
|
2040
|
-
"@lightsparkdev/core": "1.0.
|
|
2040
|
+
"@lightsparkdev/core": "1.0.12",
|
|
2041
2041
|
"@lightsparkdev/crypto-wasm": "0.1.2",
|
|
2042
2042
|
"auto-bind": "^5.0.1",
|
|
2043
2043
|
"crypto-browserify": "^3.12.0",
|
|
@@ -2064,7 +2064,184 @@ var package_default = {
|
|
|
2064
2064
|
"tsc-absolute": "^1.0.1",
|
|
2065
2065
|
tsup: "^7.2.0",
|
|
2066
2066
|
typedoc: "^0.24.7",
|
|
2067
|
-
typescript: "^
|
|
2067
|
+
typescript: "^5.0.0"
|
|
2068
|
+
}
|
|
2069
|
+
};
|
|
2070
|
+
|
|
2071
|
+
// src/NodeKeyLoaderCache.ts
|
|
2072
|
+
var import_core3 = require("@lightsparkdev/core");
|
|
2073
|
+
|
|
2074
|
+
// src/SigningKeyLoader.ts
|
|
2075
|
+
var import_core2 = require("@lightsparkdev/core");
|
|
2076
|
+
|
|
2077
|
+
// src/graphql/RecoverNodeSigningKey.ts
|
|
2078
|
+
var RecoverNodeSigningKey = `
|
|
2079
|
+
query RecoverNodeSigningKey($nodeId: ID!) {
|
|
2080
|
+
entity(id: $nodeId) {
|
|
2081
|
+
__typename
|
|
2082
|
+
... on LightsparkNodeWithOSK {
|
|
2083
|
+
encrypted_signing_private_key {
|
|
2084
|
+
encrypted_value
|
|
2085
|
+
cipher
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
`;
|
|
2091
|
+
|
|
2092
|
+
// src/SigningKeyLoader.ts
|
|
2093
|
+
var SIGNING_KEY_PATH = "m/5";
|
|
2094
|
+
function isNodeIdAndPasswordSigningKeyLoaderArgs(args) {
|
|
2095
|
+
return args.password !== void 0;
|
|
2096
|
+
}
|
|
2097
|
+
function isMasterSeedSigningKeyLoaderArgs(args) {
|
|
2098
|
+
return args.masterSeed !== void 0;
|
|
2099
|
+
}
|
|
2100
|
+
var NodeIdAndPasswordSigningKeyLoader = class {
|
|
2101
|
+
nodeId;
|
|
2102
|
+
password;
|
|
2103
|
+
requester;
|
|
2104
|
+
cryptoImpl;
|
|
2105
|
+
constructor(args, requester, cryptoImpl) {
|
|
2106
|
+
this.nodeId = args.nodeId;
|
|
2107
|
+
this.password = args.password;
|
|
2108
|
+
this.requester = requester;
|
|
2109
|
+
this.cryptoImpl = cryptoImpl;
|
|
2110
|
+
}
|
|
2111
|
+
async loadSigningKey() {
|
|
2112
|
+
const encryptedKey = await this.recoverNodeSigningKey();
|
|
2113
|
+
if (!encryptedKey) {
|
|
2114
|
+
console.warn("No encrypted key found for node " + this.nodeId);
|
|
2115
|
+
return;
|
|
2116
|
+
}
|
|
2117
|
+
const signingPrivateKey = await this.cryptoImpl.decryptSecretWithNodePassword(
|
|
2118
|
+
encryptedKey.cipher,
|
|
2119
|
+
encryptedKey.encrypted_value,
|
|
2120
|
+
this.password
|
|
2121
|
+
);
|
|
2122
|
+
if (!signingPrivateKey) {
|
|
2123
|
+
throw new import_core2.LightsparkSigningException(
|
|
2124
|
+
"Unable to decrypt signing key with provided password. Please try again."
|
|
2125
|
+
);
|
|
2126
|
+
}
|
|
2127
|
+
let signingPrivateKeyPEM = "";
|
|
2128
|
+
if (new Uint8Array(signingPrivateKey)[0] === 48) {
|
|
2129
|
+
signingPrivateKeyPEM = (0, import_core2.b64encode)(signingPrivateKey);
|
|
2130
|
+
} else {
|
|
2131
|
+
const dec = new TextDecoder();
|
|
2132
|
+
signingPrivateKeyPEM = dec.decode(signingPrivateKey);
|
|
2133
|
+
}
|
|
2134
|
+
return { key: signingPrivateKeyPEM, type: import_core2.SigningKeyType.RSASigningKey };
|
|
2135
|
+
}
|
|
2136
|
+
async recoverNodeSigningKey() {
|
|
2137
|
+
const response = await this.requester.makeRawRequest(
|
|
2138
|
+
RecoverNodeSigningKey,
|
|
2139
|
+
{ nodeId: this.nodeId }
|
|
2140
|
+
);
|
|
2141
|
+
const nodeEntity = response.entity;
|
|
2142
|
+
if (nodeEntity?.__typename === "LightsparkNodeWithOSK") {
|
|
2143
|
+
return nodeEntity.encrypted_signing_private_key;
|
|
2144
|
+
}
|
|
2145
|
+
return null;
|
|
2146
|
+
}
|
|
2147
|
+
};
|
|
2148
|
+
var MasterSeedSigningKeyLoader = class {
|
|
2149
|
+
masterSeed;
|
|
2150
|
+
network;
|
|
2151
|
+
constructor(args) {
|
|
2152
|
+
this.masterSeed = args.masterSeed;
|
|
2153
|
+
this.network = args.network;
|
|
2154
|
+
}
|
|
2155
|
+
async loadSigningKey() {
|
|
2156
|
+
if (import_core2.isBrowser) {
|
|
2157
|
+
throw new import_core2.LightsparkSigningException(
|
|
2158
|
+
"Browser environments not supported for master seed signing key loader."
|
|
2159
|
+
);
|
|
2160
|
+
}
|
|
2161
|
+
const { LightsparkSigner, Network } = await import("@lightsparkdev/crypto-wasm");
|
|
2162
|
+
let cryptoLibNetwork;
|
|
2163
|
+
switch (this.network) {
|
|
2164
|
+
case BitcoinNetwork_default.MAINNET:
|
|
2165
|
+
cryptoLibNetwork = Network.Bitcoin;
|
|
2166
|
+
break;
|
|
2167
|
+
case BitcoinNetwork_default.TESTNET:
|
|
2168
|
+
cryptoLibNetwork = Network.Testnet;
|
|
2169
|
+
break;
|
|
2170
|
+
case BitcoinNetwork_default.REGTEST:
|
|
2171
|
+
cryptoLibNetwork = Network.Regtest;
|
|
2172
|
+
break;
|
|
2173
|
+
default:
|
|
2174
|
+
throw new Error(
|
|
2175
|
+
`Unsupported lightspark_crypto network ${this.network}.`
|
|
2176
|
+
);
|
|
2177
|
+
}
|
|
2178
|
+
const lightsparkSigner = LightsparkSigner.from_bytes(
|
|
2179
|
+
this.masterSeed,
|
|
2180
|
+
cryptoLibNetwork
|
|
2181
|
+
);
|
|
2182
|
+
const privateKey = lightsparkSigner.derive_private_key(SIGNING_KEY_PATH);
|
|
2183
|
+
return { key: privateKey, type: import_core2.SigningKeyType.Secp256k1SigningKey };
|
|
2184
|
+
}
|
|
2185
|
+
};
|
|
2186
|
+
|
|
2187
|
+
// src/NodeKeyLoaderCache.ts
|
|
2188
|
+
var NodeKeyLoaderCache = class {
|
|
2189
|
+
constructor(nodeKeyCache, cryptoImpl = import_core3.DefaultCrypto) {
|
|
2190
|
+
this.nodeKeyCache = nodeKeyCache;
|
|
2191
|
+
this.cryptoImpl = cryptoImpl;
|
|
2192
|
+
this.idToLoader = /* @__PURE__ */ new Map();
|
|
2193
|
+
}
|
|
2194
|
+
idToLoader;
|
|
2195
|
+
/**
|
|
2196
|
+
* Sets the signing key loader for a node.
|
|
2197
|
+
* Instantiates a signing key loader based on the type of args passed in by
|
|
2198
|
+
* the user.
|
|
2199
|
+
*
|
|
2200
|
+
* @param nodeId The ID of the node to get the key for
|
|
2201
|
+
* @param loaderArgs Loader arguments for loading the key
|
|
2202
|
+
* @param requester Requester used for loading the key
|
|
2203
|
+
*/
|
|
2204
|
+
setLoader(nodeId, loaderArgs, requester) {
|
|
2205
|
+
let loader;
|
|
2206
|
+
if (isNodeIdAndPasswordSigningKeyLoaderArgs(loaderArgs)) {
|
|
2207
|
+
loader = new NodeIdAndPasswordSigningKeyLoader(
|
|
2208
|
+
{ nodeId, ...loaderArgs },
|
|
2209
|
+
requester,
|
|
2210
|
+
this.cryptoImpl
|
|
2211
|
+
);
|
|
2212
|
+
} else if (isMasterSeedSigningKeyLoaderArgs(loaderArgs)) {
|
|
2213
|
+
loader = new MasterSeedSigningKeyLoader({ ...loaderArgs });
|
|
2214
|
+
} else {
|
|
2215
|
+
throw new import_core3.LightsparkSigningException("Invalid signing key loader args");
|
|
2216
|
+
}
|
|
2217
|
+
this.idToLoader.set(nodeId, loader);
|
|
2218
|
+
}
|
|
2219
|
+
/**
|
|
2220
|
+
* Gets the key for a node using the loader set by [setLoader]
|
|
2221
|
+
*
|
|
2222
|
+
* @param id The ID of the node to get the key for
|
|
2223
|
+
* @returns The loaded key
|
|
2224
|
+
*/
|
|
2225
|
+
async getKeyWithLoader(id) {
|
|
2226
|
+
if (this.nodeKeyCache.hasKey(id)) {
|
|
2227
|
+
return this.nodeKeyCache.getKey(id);
|
|
2228
|
+
}
|
|
2229
|
+
const loader = this.idToLoader.get(id);
|
|
2230
|
+
if (!loader) {
|
|
2231
|
+
throw new import_core3.LightsparkSigningException(
|
|
2232
|
+
"No signing key loader found for node " + id
|
|
2233
|
+
);
|
|
2234
|
+
}
|
|
2235
|
+
const loaderResult = await loader.loadSigningKey();
|
|
2236
|
+
if (!loaderResult) {
|
|
2237
|
+
return;
|
|
2238
|
+
}
|
|
2239
|
+
const key = await this.nodeKeyCache.loadKey(
|
|
2240
|
+
id,
|
|
2241
|
+
{ key: loaderResult.key },
|
|
2242
|
+
loaderResult.type
|
|
2243
|
+
);
|
|
2244
|
+
return key || void 0;
|
|
2068
2245
|
}
|
|
2069
2246
|
};
|
|
2070
2247
|
|
|
@@ -2150,217 +2327,6 @@ var BitcoinFeeEstimate = `
|
|
|
2150
2327
|
${FRAGMENT2}
|
|
2151
2328
|
`;
|
|
2152
2329
|
|
|
2153
|
-
// src/objects/IncentivesIneligibilityReason.ts
|
|
2154
|
-
var IncentivesIneligibilityReason = /* @__PURE__ */ ((IncentivesIneligibilityReason2) => {
|
|
2155
|
-
IncentivesIneligibilityReason2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
2156
|
-
IncentivesIneligibilityReason2["DISABLED"] = "DISABLED";
|
|
2157
|
-
IncentivesIneligibilityReason2["SENDER_NOT_ELIGIBLE"] = "SENDER_NOT_ELIGIBLE";
|
|
2158
|
-
IncentivesIneligibilityReason2["RECEIVER_NOT_ELIGIBLE"] = "RECEIVER_NOT_ELIGIBLE";
|
|
2159
|
-
IncentivesIneligibilityReason2["SENDING_VASP_NOT_ELIGIBLE"] = "SENDING_VASP_NOT_ELIGIBLE";
|
|
2160
|
-
IncentivesIneligibilityReason2["RECEIVING_VASP_NOT_ELIGIBLE"] = "RECEIVING_VASP_NOT_ELIGIBLE";
|
|
2161
|
-
IncentivesIneligibilityReason2["NOT_CROSS_BORDER"] = "NOT_CROSS_BORDER";
|
|
2162
|
-
return IncentivesIneligibilityReason2;
|
|
2163
|
-
})(IncentivesIneligibilityReason || {});
|
|
2164
|
-
var IncentivesIneligibilityReason_default = IncentivesIneligibilityReason;
|
|
2165
|
-
|
|
2166
|
-
// src/objects/IncentivesStatus.ts
|
|
2167
|
-
var IncentivesStatus = /* @__PURE__ */ ((IncentivesStatus2) => {
|
|
2168
|
-
IncentivesStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
2169
|
-
IncentivesStatus2["PENDING"] = "PENDING";
|
|
2170
|
-
IncentivesStatus2["VALIDATED"] = "VALIDATED";
|
|
2171
|
-
IncentivesStatus2["INELIGIBLE"] = "INELIGIBLE";
|
|
2172
|
-
return IncentivesStatus2;
|
|
2173
|
-
})(IncentivesStatus || {});
|
|
2174
|
-
var IncentivesStatus_default = IncentivesStatus;
|
|
2175
|
-
|
|
2176
|
-
// src/objects/UmaInvitation.ts
|
|
2177
|
-
var UmaInvitationFromJson = (obj) => {
|
|
2178
|
-
return {
|
|
2179
|
-
id: obj["uma_invitation_id"],
|
|
2180
|
-
createdAt: obj["uma_invitation_created_at"],
|
|
2181
|
-
updatedAt: obj["uma_invitation_updated_at"],
|
|
2182
|
-
code: obj["uma_invitation_code"],
|
|
2183
|
-
url: obj["uma_invitation_url"],
|
|
2184
|
-
inviterUma: obj["uma_invitation_inviter_uma"],
|
|
2185
|
-
incentivesStatus: IncentivesStatus_default[obj["uma_invitation_incentives_status"]] ?? IncentivesStatus_default.FUTURE_VALUE,
|
|
2186
|
-
typename: "UmaInvitation",
|
|
2187
|
-
inviteeUma: obj["uma_invitation_invitee_uma"],
|
|
2188
|
-
incentivesIneligibilityReason: !!obj["uma_invitation_incentives_ineligibility_reason"] ? IncentivesIneligibilityReason_default[obj["uma_invitation_incentives_ineligibility_reason"]] ?? IncentivesIneligibilityReason_default.FUTURE_VALUE : null
|
|
2189
|
-
};
|
|
2190
|
-
};
|
|
2191
|
-
var FRAGMENT3 = `
|
|
2192
|
-
fragment UmaInvitationFragment on UmaInvitation {
|
|
2193
|
-
__typename
|
|
2194
|
-
uma_invitation_id: id
|
|
2195
|
-
uma_invitation_created_at: created_at
|
|
2196
|
-
uma_invitation_updated_at: updated_at
|
|
2197
|
-
uma_invitation_code: code
|
|
2198
|
-
uma_invitation_url: url
|
|
2199
|
-
uma_invitation_inviter_uma: inviter_uma
|
|
2200
|
-
uma_invitation_invitee_uma: invitee_uma
|
|
2201
|
-
uma_invitation_incentives_status: incentives_status
|
|
2202
|
-
uma_invitation_incentives_ineligibility_reason: incentives_ineligibility_reason
|
|
2203
|
-
}`;
|
|
2204
|
-
var getUmaInvitationQuery = (id) => {
|
|
2205
|
-
return {
|
|
2206
|
-
queryPayload: `
|
|
2207
|
-
query GetUmaInvitation($id: ID!) {
|
|
2208
|
-
entity(id: $id) {
|
|
2209
|
-
... on UmaInvitation {
|
|
2210
|
-
...UmaInvitationFragment
|
|
2211
|
-
}
|
|
2212
|
-
}
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
|
-
${FRAGMENT3}
|
|
2216
|
-
`,
|
|
2217
|
-
variables: { id },
|
|
2218
|
-
constructObject: (data) => UmaInvitationFromJson(data.entity)
|
|
2219
|
-
};
|
|
2220
|
-
};
|
|
2221
|
-
|
|
2222
|
-
// src/graphql/ClaimUmaInvitation.ts
|
|
2223
|
-
var ClaimUmaInvitation = `
|
|
2224
|
-
mutation ClaimUmaInvitation(
|
|
2225
|
-
$invitationCode: String!
|
|
2226
|
-
$inviteeUma: String!
|
|
2227
|
-
) {
|
|
2228
|
-
claim_uma_invitation(input: {
|
|
2229
|
-
invitation_code: $invitationCode
|
|
2230
|
-
invitee_uma: $inviteeUma
|
|
2231
|
-
}) {
|
|
2232
|
-
invitation {
|
|
2233
|
-
...UmaInvitationFragment
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
|
|
2238
|
-
${FRAGMENT3}
|
|
2239
|
-
`;
|
|
2240
|
-
|
|
2241
|
-
// src/graphql/ClaimUmaInvitationWithIncentives.ts
|
|
2242
|
-
var ClaimUmaInvitationWithIncentives = `
|
|
2243
|
-
mutation ClaimUmaInvitationWithIncentives(
|
|
2244
|
-
$invitationCode: String!
|
|
2245
|
-
$inviteeUma: String!
|
|
2246
|
-
$inviteePhoneHash: String!
|
|
2247
|
-
$inviteeRegion: RegionCode!
|
|
2248
|
-
) {
|
|
2249
|
-
claim_uma_invitation_with_incentives(input: {
|
|
2250
|
-
invitation_code: $invitationCode
|
|
2251
|
-
invitee_uma: $inviteeUma
|
|
2252
|
-
invitee_phone_hash: $inviteePhoneHash
|
|
2253
|
-
invitee_region: $inviteeRegion
|
|
2254
|
-
}) {
|
|
2255
|
-
invitation {
|
|
2256
|
-
...UmaInvitationFragment
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
${FRAGMENT3}
|
|
2262
|
-
`;
|
|
2263
|
-
|
|
2264
|
-
// src/objects/Permission.ts
|
|
2265
|
-
var Permission = /* @__PURE__ */ ((Permission2) => {
|
|
2266
|
-
Permission2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
2267
|
-
Permission2["ALL"] = "ALL";
|
|
2268
|
-
Permission2["MAINNET_VIEW"] = "MAINNET_VIEW";
|
|
2269
|
-
Permission2["MAINNET_TRANSACT"] = "MAINNET_TRANSACT";
|
|
2270
|
-
Permission2["MAINNET_MANAGE"] = "MAINNET_MANAGE";
|
|
2271
|
-
Permission2["TESTNET_VIEW"] = "TESTNET_VIEW";
|
|
2272
|
-
Permission2["TESTNET_TRANSACT"] = "TESTNET_TRANSACT";
|
|
2273
|
-
Permission2["TESTNET_MANAGE"] = "TESTNET_MANAGE";
|
|
2274
|
-
Permission2["REGTEST_VIEW"] = "REGTEST_VIEW";
|
|
2275
|
-
Permission2["REGTEST_TRANSACT"] = "REGTEST_TRANSACT";
|
|
2276
|
-
Permission2["REGTEST_MANAGE"] = "REGTEST_MANAGE";
|
|
2277
|
-
Permission2["USER_VIEW"] = "USER_VIEW";
|
|
2278
|
-
Permission2["USER_MANAGE"] = "USER_MANAGE";
|
|
2279
|
-
Permission2["ACCOUNT_VIEW"] = "ACCOUNT_VIEW";
|
|
2280
|
-
Permission2["ACCOUNT_MANAGE"] = "ACCOUNT_MANAGE";
|
|
2281
|
-
return Permission2;
|
|
2282
|
-
})(Permission || {});
|
|
2283
|
-
var Permission_default = Permission;
|
|
2284
|
-
|
|
2285
|
-
// src/objects/ApiToken.ts
|
|
2286
|
-
var ApiTokenFromJson = (obj) => {
|
|
2287
|
-
return {
|
|
2288
|
-
id: obj["api_token_id"],
|
|
2289
|
-
createdAt: obj["api_token_created_at"],
|
|
2290
|
-
updatedAt: obj["api_token_updated_at"],
|
|
2291
|
-
clientId: obj["api_token_client_id"],
|
|
2292
|
-
name: obj["api_token_name"],
|
|
2293
|
-
permissions: obj["api_token_permissions"].map((e) => Permission_default[e]),
|
|
2294
|
-
typename: "ApiToken"
|
|
2295
|
-
};
|
|
2296
|
-
};
|
|
2297
|
-
var FRAGMENT4 = `
|
|
2298
|
-
fragment ApiTokenFragment on ApiToken {
|
|
2299
|
-
__typename
|
|
2300
|
-
api_token_id: id
|
|
2301
|
-
api_token_created_at: created_at
|
|
2302
|
-
api_token_updated_at: updated_at
|
|
2303
|
-
api_token_client_id: client_id
|
|
2304
|
-
api_token_name: name
|
|
2305
|
-
api_token_permissions: permissions
|
|
2306
|
-
}`;
|
|
2307
|
-
var getApiTokenQuery = (id) => {
|
|
2308
|
-
return {
|
|
2309
|
-
queryPayload: `
|
|
2310
|
-
query GetApiToken($id: ID!) {
|
|
2311
|
-
entity(id: $id) {
|
|
2312
|
-
... on ApiToken {
|
|
2313
|
-
...ApiTokenFragment
|
|
2314
|
-
}
|
|
2315
|
-
}
|
|
2316
|
-
}
|
|
2317
|
-
|
|
2318
|
-
${FRAGMENT4}
|
|
2319
|
-
`,
|
|
2320
|
-
variables: { id },
|
|
2321
|
-
constructObject: (data) => ApiTokenFromJson(data.entity)
|
|
2322
|
-
};
|
|
2323
|
-
};
|
|
2324
|
-
|
|
2325
|
-
// src/graphql/CreateApiToken.ts
|
|
2326
|
-
var CreateApiToken = `
|
|
2327
|
-
mutation CreateApiToken(
|
|
2328
|
-
$name: String!
|
|
2329
|
-
$permissions: [Permission!]!
|
|
2330
|
-
) {
|
|
2331
|
-
create_api_token(input: {
|
|
2332
|
-
name: $name
|
|
2333
|
-
permissions: $permissions
|
|
2334
|
-
}) {
|
|
2335
|
-
api_token {
|
|
2336
|
-
...ApiTokenFragment
|
|
2337
|
-
}
|
|
2338
|
-
client_secret
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
|
|
2342
|
-
${FRAGMENT4}
|
|
2343
|
-
`;
|
|
2344
|
-
|
|
2345
|
-
// src/graphql/CreateInvoice.ts
|
|
2346
|
-
var CreateInvoice = `
|
|
2347
|
-
mutation CreateInvoice(
|
|
2348
|
-
$node_id: ID!
|
|
2349
|
-
$amount_msats: Long!
|
|
2350
|
-
$memo: String
|
|
2351
|
-
$type: InvoiceType = null
|
|
2352
|
-
$expiry_secs: Int = null
|
|
2353
|
-
) {
|
|
2354
|
-
create_invoice(input: { node_id: $node_id, amount_msats: $amount_msats, memo: $memo, invoice_type: $type, expiry_secs: $expiry_secs }) {
|
|
2355
|
-
invoice {
|
|
2356
|
-
data {
|
|
2357
|
-
encoded_payment_request
|
|
2358
|
-
}
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2362
|
-
`;
|
|
2363
|
-
|
|
2364
2330
|
// src/objects/BitcoinNetwork.ts
|
|
2365
2331
|
var BitcoinNetwork = /* @__PURE__ */ ((BitcoinNetwork2) => {
|
|
2366
2332
|
BitcoinNetwork2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
@@ -2373,7 +2339,7 @@ var BitcoinNetwork = /* @__PURE__ */ ((BitcoinNetwork2) => {
|
|
|
2373
2339
|
var BitcoinNetwork_default = BitcoinNetwork;
|
|
2374
2340
|
|
|
2375
2341
|
// src/objects/Node.ts
|
|
2376
|
-
var
|
|
2342
|
+
var import_core4 = require("@lightsparkdev/core");
|
|
2377
2343
|
|
|
2378
2344
|
// src/objects/Balances.ts
|
|
2379
2345
|
var BalancesFromJson = (obj) => {
|
|
@@ -2504,7 +2470,7 @@ query GetGraphNode($id: ID!) {
|
|
|
2504
2470
|
}
|
|
2505
2471
|
}
|
|
2506
2472
|
|
|
2507
|
-
${
|
|
2473
|
+
${FRAGMENT3}
|
|
2508
2474
|
`,
|
|
2509
2475
|
variables: { id },
|
|
2510
2476
|
constructObject: (data) => GraphNodeFromJson(data.entity)
|
|
@@ -2539,7 +2505,7 @@ var GraphNodeFromJson = (obj) => {
|
|
|
2539
2505
|
obj["graph_node_public_key"]
|
|
2540
2506
|
);
|
|
2541
2507
|
};
|
|
2542
|
-
var
|
|
2508
|
+
var FRAGMENT3 = `
|
|
2543
2509
|
fragment GraphNodeFragment on GraphNode {
|
|
2544
2510
|
__typename
|
|
2545
2511
|
graph_node_id: id
|
|
@@ -2728,7 +2694,7 @@ query GetChannel($id: ID!) {
|
|
|
2728
2694
|
}
|
|
2729
2695
|
}
|
|
2730
2696
|
|
|
2731
|
-
${
|
|
2697
|
+
${FRAGMENT4}
|
|
2732
2698
|
`,
|
|
2733
2699
|
variables: { id },
|
|
2734
2700
|
constructObject: (data) => ChannelFromJson(data.entity)
|
|
@@ -2781,7 +2747,7 @@ var ChannelFromJson = (obj) => {
|
|
|
2781
2747
|
obj["channel_short_channel_id"]
|
|
2782
2748
|
);
|
|
2783
2749
|
};
|
|
2784
|
-
var
|
|
2750
|
+
var FRAGMENT4 = `
|
|
2785
2751
|
fragment ChannelFragment on Channel {
|
|
2786
2752
|
__typename
|
|
2787
2753
|
channel_id: id
|
|
@@ -3105,7 +3071,7 @@ query GetLightsparkNodeWithOSK($id: ID!) {
|
|
|
3105
3071
|
}
|
|
3106
3072
|
}
|
|
3107
3073
|
|
|
3108
|
-
${
|
|
3074
|
+
${FRAGMENT5}
|
|
3109
3075
|
`,
|
|
3110
3076
|
variables: { id },
|
|
3111
3077
|
constructObject: (data) => LightsparkNodeWithOSKFromJson(data.entity)
|
|
@@ -3166,7 +3132,7 @@ var LightsparkNodeWithOSKFromJson = (obj) => {
|
|
|
3166
3132
|
) : void 0
|
|
3167
3133
|
);
|
|
3168
3134
|
};
|
|
3169
|
-
var
|
|
3135
|
+
var FRAGMENT5 = `
|
|
3170
3136
|
fragment LightsparkNodeWithOSKFragment on LightsparkNodeWithOSK {
|
|
3171
3137
|
__typename
|
|
3172
3138
|
lightspark_node_with_o_s_k_id: id
|
|
@@ -3490,7 +3456,7 @@ query GetLightsparkNodeWithRemoteSigning($id: ID!) {
|
|
|
3490
3456
|
}
|
|
3491
3457
|
}
|
|
3492
3458
|
|
|
3493
|
-
${
|
|
3459
|
+
${FRAGMENT6}
|
|
3494
3460
|
`,
|
|
3495
3461
|
variables: { id },
|
|
3496
3462
|
constructObject: (data) => LightsparkNodeWithRemoteSigningFromJson(data.entity)
|
|
@@ -3553,7 +3519,7 @@ var LightsparkNodeWithRemoteSigningFromJson = (obj) => {
|
|
|
3553
3519
|
!!obj["lightspark_node_with_remote_signing_balances"] ? BalancesFromJson(obj["lightspark_node_with_remote_signing_balances"]) : void 0
|
|
3554
3520
|
);
|
|
3555
3521
|
};
|
|
3556
|
-
var
|
|
3522
|
+
var FRAGMENT6 = `
|
|
3557
3523
|
fragment LightsparkNodeWithRemoteSigningFragment on LightsparkNodeWithRemoteSigning {
|
|
3558
3524
|
__typename
|
|
3559
3525
|
lightspark_node_with_remote_signing_id: id
|
|
@@ -3768,7 +3734,7 @@ var NodeFromJson = (obj) => {
|
|
|
3768
3734
|
!!obj["lightspark_node_with_remote_signing_balances"] ? BalancesFromJson(obj["lightspark_node_with_remote_signing_balances"]) : void 0
|
|
3769
3735
|
);
|
|
3770
3736
|
}
|
|
3771
|
-
throw new
|
|
3737
|
+
throw new import_core4.LightsparkException(
|
|
3772
3738
|
"DeserializationError",
|
|
3773
3739
|
`Couldn't find a concrete type for interface Node corresponding to the typename=${obj["__typename"]}`
|
|
3774
3740
|
);
|
|
@@ -3844,12 +3810,12 @@ var NodeToJson = (obj) => {
|
|
|
3844
3810
|
lightspark_node_with_remote_signing_balances: lightsparkNodeWithRemoteSigning.balances ? BalancesToJson(lightsparkNodeWithRemoteSigning.balances) : void 0
|
|
3845
3811
|
};
|
|
3846
3812
|
}
|
|
3847
|
-
throw new
|
|
3813
|
+
throw new import_core4.LightsparkException(
|
|
3848
3814
|
"DeserializationError",
|
|
3849
3815
|
`Couldn't find a concrete type for interface Node corresponding to the typename=${obj.typename}`
|
|
3850
3816
|
);
|
|
3851
3817
|
};
|
|
3852
|
-
var
|
|
3818
|
+
var FRAGMENT7 = `
|
|
3853
3819
|
fragment NodeFragment on Node {
|
|
3854
3820
|
__typename
|
|
3855
3821
|
... on GraphNode {
|
|
@@ -4135,7 +4101,7 @@ query GetNode($id: ID!) {
|
|
|
4135
4101
|
}
|
|
4136
4102
|
}
|
|
4137
4103
|
|
|
4138
|
-
${
|
|
4104
|
+
${FRAGMENT7}
|
|
4139
4105
|
`,
|
|
4140
4106
|
variables: { id },
|
|
4141
4107
|
constructObject: (data) => NodeFromJson(data.entity)
|
|
@@ -4156,7 +4122,7 @@ var InvoiceDataFromJson = (obj) => {
|
|
|
4156
4122
|
memo: obj["invoice_data_memo"]
|
|
4157
4123
|
};
|
|
4158
4124
|
};
|
|
4159
|
-
var
|
|
4125
|
+
var FRAGMENT8 = `
|
|
4160
4126
|
fragment InvoiceDataFragment on InvoiceData {
|
|
4161
4127
|
__typename
|
|
4162
4128
|
invoice_data_encoded_payment_request: encoded_payment_request
|
|
@@ -4470,7 +4436,7 @@ var InvoiceFromJson = (obj) => {
|
|
|
4470
4436
|
amountPaid: !!obj["invoice_amount_paid"] ? CurrencyAmountFromJson(obj["invoice_amount_paid"]) : void 0
|
|
4471
4437
|
};
|
|
4472
4438
|
};
|
|
4473
|
-
var
|
|
4439
|
+
var FRAGMENT9 = `
|
|
4474
4440
|
fragment InvoiceFragment on Invoice {
|
|
4475
4441
|
__typename
|
|
4476
4442
|
invoice_id: id
|
|
@@ -4767,23 +4733,210 @@ fragment InvoiceFragment on Invoice {
|
|
|
4767
4733
|
}
|
|
4768
4734
|
}
|
|
4769
4735
|
}
|
|
4770
|
-
invoice_status: status
|
|
4771
|
-
invoice_amount_paid: amount_paid {
|
|
4772
|
-
__typename
|
|
4773
|
-
currency_amount_original_value: original_value
|
|
4774
|
-
currency_amount_original_unit: original_unit
|
|
4775
|
-
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
4776
|
-
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
4777
|
-
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
4736
|
+
invoice_status: status
|
|
4737
|
+
invoice_amount_paid: amount_paid {
|
|
4738
|
+
__typename
|
|
4739
|
+
currency_amount_original_value: original_value
|
|
4740
|
+
currency_amount_original_unit: original_unit
|
|
4741
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
4742
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
4743
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
4744
|
+
}
|
|
4745
|
+
}`;
|
|
4746
|
+
var getInvoiceQuery = (id) => {
|
|
4747
|
+
return {
|
|
4748
|
+
queryPayload: `
|
|
4749
|
+
query GetInvoice($id: ID!) {
|
|
4750
|
+
entity(id: $id) {
|
|
4751
|
+
... on Invoice {
|
|
4752
|
+
...InvoiceFragment
|
|
4753
|
+
}
|
|
4754
|
+
}
|
|
4755
|
+
}
|
|
4756
|
+
|
|
4757
|
+
${FRAGMENT9}
|
|
4758
|
+
`,
|
|
4759
|
+
variables: { id },
|
|
4760
|
+
constructObject: (data) => InvoiceFromJson(data.entity)
|
|
4761
|
+
};
|
|
4762
|
+
};
|
|
4763
|
+
|
|
4764
|
+
// src/graphql/CancelInvoice.ts
|
|
4765
|
+
var CancelInvoice = `
|
|
4766
|
+
mutation CancelInvoice(
|
|
4767
|
+
$invoice_id: ID!
|
|
4768
|
+
) {
|
|
4769
|
+
cancel_invoice(input: { invoice_id: $invoice_id }) {
|
|
4770
|
+
invoice {
|
|
4771
|
+
...InvoiceFragment
|
|
4772
|
+
}
|
|
4773
|
+
}
|
|
4774
|
+
}
|
|
4775
|
+
|
|
4776
|
+
${FRAGMENT9}
|
|
4777
|
+
`;
|
|
4778
|
+
|
|
4779
|
+
// src/objects/IncentivesIneligibilityReason.ts
|
|
4780
|
+
var IncentivesIneligibilityReason = /* @__PURE__ */ ((IncentivesIneligibilityReason2) => {
|
|
4781
|
+
IncentivesIneligibilityReason2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
4782
|
+
IncentivesIneligibilityReason2["DISABLED"] = "DISABLED";
|
|
4783
|
+
IncentivesIneligibilityReason2["SENDER_NOT_ELIGIBLE"] = "SENDER_NOT_ELIGIBLE";
|
|
4784
|
+
IncentivesIneligibilityReason2["RECEIVER_NOT_ELIGIBLE"] = "RECEIVER_NOT_ELIGIBLE";
|
|
4785
|
+
IncentivesIneligibilityReason2["SENDING_VASP_NOT_ELIGIBLE"] = "SENDING_VASP_NOT_ELIGIBLE";
|
|
4786
|
+
IncentivesIneligibilityReason2["RECEIVING_VASP_NOT_ELIGIBLE"] = "RECEIVING_VASP_NOT_ELIGIBLE";
|
|
4787
|
+
IncentivesIneligibilityReason2["NOT_CROSS_BORDER"] = "NOT_CROSS_BORDER";
|
|
4788
|
+
return IncentivesIneligibilityReason2;
|
|
4789
|
+
})(IncentivesIneligibilityReason || {});
|
|
4790
|
+
var IncentivesIneligibilityReason_default = IncentivesIneligibilityReason;
|
|
4791
|
+
|
|
4792
|
+
// src/objects/IncentivesStatus.ts
|
|
4793
|
+
var IncentivesStatus = /* @__PURE__ */ ((IncentivesStatus2) => {
|
|
4794
|
+
IncentivesStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
4795
|
+
IncentivesStatus2["PENDING"] = "PENDING";
|
|
4796
|
+
IncentivesStatus2["VALIDATED"] = "VALIDATED";
|
|
4797
|
+
IncentivesStatus2["INELIGIBLE"] = "INELIGIBLE";
|
|
4798
|
+
return IncentivesStatus2;
|
|
4799
|
+
})(IncentivesStatus || {});
|
|
4800
|
+
var IncentivesStatus_default = IncentivesStatus;
|
|
4801
|
+
|
|
4802
|
+
// src/objects/UmaInvitation.ts
|
|
4803
|
+
var UmaInvitationFromJson = (obj) => {
|
|
4804
|
+
return {
|
|
4805
|
+
id: obj["uma_invitation_id"],
|
|
4806
|
+
createdAt: obj["uma_invitation_created_at"],
|
|
4807
|
+
updatedAt: obj["uma_invitation_updated_at"],
|
|
4808
|
+
code: obj["uma_invitation_code"],
|
|
4809
|
+
url: obj["uma_invitation_url"],
|
|
4810
|
+
inviterUma: obj["uma_invitation_inviter_uma"],
|
|
4811
|
+
incentivesStatus: IncentivesStatus_default[obj["uma_invitation_incentives_status"]] ?? IncentivesStatus_default.FUTURE_VALUE,
|
|
4812
|
+
typename: "UmaInvitation",
|
|
4813
|
+
inviteeUma: obj["uma_invitation_invitee_uma"],
|
|
4814
|
+
incentivesIneligibilityReason: !!obj["uma_invitation_incentives_ineligibility_reason"] ? IncentivesIneligibilityReason_default[obj["uma_invitation_incentives_ineligibility_reason"]] ?? IncentivesIneligibilityReason_default.FUTURE_VALUE : null
|
|
4815
|
+
};
|
|
4816
|
+
};
|
|
4817
|
+
var FRAGMENT10 = `
|
|
4818
|
+
fragment UmaInvitationFragment on UmaInvitation {
|
|
4819
|
+
__typename
|
|
4820
|
+
uma_invitation_id: id
|
|
4821
|
+
uma_invitation_created_at: created_at
|
|
4822
|
+
uma_invitation_updated_at: updated_at
|
|
4823
|
+
uma_invitation_code: code
|
|
4824
|
+
uma_invitation_url: url
|
|
4825
|
+
uma_invitation_inviter_uma: inviter_uma
|
|
4826
|
+
uma_invitation_invitee_uma: invitee_uma
|
|
4827
|
+
uma_invitation_incentives_status: incentives_status
|
|
4828
|
+
uma_invitation_incentives_ineligibility_reason: incentives_ineligibility_reason
|
|
4829
|
+
}`;
|
|
4830
|
+
var getUmaInvitationQuery = (id) => {
|
|
4831
|
+
return {
|
|
4832
|
+
queryPayload: `
|
|
4833
|
+
query GetUmaInvitation($id: ID!) {
|
|
4834
|
+
entity(id: $id) {
|
|
4835
|
+
... on UmaInvitation {
|
|
4836
|
+
...UmaInvitationFragment
|
|
4837
|
+
}
|
|
4838
|
+
}
|
|
4839
|
+
}
|
|
4840
|
+
|
|
4841
|
+
${FRAGMENT10}
|
|
4842
|
+
`,
|
|
4843
|
+
variables: { id },
|
|
4844
|
+
constructObject: (data) => UmaInvitationFromJson(data.entity)
|
|
4845
|
+
};
|
|
4846
|
+
};
|
|
4847
|
+
|
|
4848
|
+
// src/graphql/ClaimUmaInvitation.ts
|
|
4849
|
+
var ClaimUmaInvitation = `
|
|
4850
|
+
mutation ClaimUmaInvitation(
|
|
4851
|
+
$invitationCode: String!
|
|
4852
|
+
$inviteeUma: String!
|
|
4853
|
+
) {
|
|
4854
|
+
claim_uma_invitation(input: {
|
|
4855
|
+
invitation_code: $invitationCode
|
|
4856
|
+
invitee_uma: $inviteeUma
|
|
4857
|
+
}) {
|
|
4858
|
+
invitation {
|
|
4859
|
+
...UmaInvitationFragment
|
|
4860
|
+
}
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4863
|
+
|
|
4864
|
+
${FRAGMENT10}
|
|
4865
|
+
`;
|
|
4866
|
+
|
|
4867
|
+
// src/graphql/ClaimUmaInvitationWithIncentives.ts
|
|
4868
|
+
var ClaimUmaInvitationWithIncentives = `
|
|
4869
|
+
mutation ClaimUmaInvitationWithIncentives(
|
|
4870
|
+
$invitationCode: String!
|
|
4871
|
+
$inviteeUma: String!
|
|
4872
|
+
$inviteePhoneHash: String!
|
|
4873
|
+
$inviteeRegion: RegionCode!
|
|
4874
|
+
) {
|
|
4875
|
+
claim_uma_invitation_with_incentives(input: {
|
|
4876
|
+
invitation_code: $invitationCode
|
|
4877
|
+
invitee_uma: $inviteeUma
|
|
4878
|
+
invitee_phone_hash: $inviteePhoneHash
|
|
4879
|
+
invitee_region: $inviteeRegion
|
|
4880
|
+
}) {
|
|
4881
|
+
invitation {
|
|
4882
|
+
...UmaInvitationFragment
|
|
4883
|
+
}
|
|
4884
|
+
}
|
|
4778
4885
|
}
|
|
4886
|
+
|
|
4887
|
+
${FRAGMENT10}
|
|
4888
|
+
`;
|
|
4889
|
+
|
|
4890
|
+
// src/objects/Permission.ts
|
|
4891
|
+
var Permission = /* @__PURE__ */ ((Permission2) => {
|
|
4892
|
+
Permission2["FUTURE_VALUE"] = "FUTURE_VALUE";
|
|
4893
|
+
Permission2["ALL"] = "ALL";
|
|
4894
|
+
Permission2["MAINNET_VIEW"] = "MAINNET_VIEW";
|
|
4895
|
+
Permission2["MAINNET_TRANSACT"] = "MAINNET_TRANSACT";
|
|
4896
|
+
Permission2["MAINNET_MANAGE"] = "MAINNET_MANAGE";
|
|
4897
|
+
Permission2["TESTNET_VIEW"] = "TESTNET_VIEW";
|
|
4898
|
+
Permission2["TESTNET_TRANSACT"] = "TESTNET_TRANSACT";
|
|
4899
|
+
Permission2["TESTNET_MANAGE"] = "TESTNET_MANAGE";
|
|
4900
|
+
Permission2["REGTEST_VIEW"] = "REGTEST_VIEW";
|
|
4901
|
+
Permission2["REGTEST_TRANSACT"] = "REGTEST_TRANSACT";
|
|
4902
|
+
Permission2["REGTEST_MANAGE"] = "REGTEST_MANAGE";
|
|
4903
|
+
Permission2["USER_VIEW"] = "USER_VIEW";
|
|
4904
|
+
Permission2["USER_MANAGE"] = "USER_MANAGE";
|
|
4905
|
+
Permission2["ACCOUNT_VIEW"] = "ACCOUNT_VIEW";
|
|
4906
|
+
Permission2["ACCOUNT_MANAGE"] = "ACCOUNT_MANAGE";
|
|
4907
|
+
return Permission2;
|
|
4908
|
+
})(Permission || {});
|
|
4909
|
+
var Permission_default = Permission;
|
|
4910
|
+
|
|
4911
|
+
// src/objects/ApiToken.ts
|
|
4912
|
+
var ApiTokenFromJson = (obj) => {
|
|
4913
|
+
return {
|
|
4914
|
+
id: obj["api_token_id"],
|
|
4915
|
+
createdAt: obj["api_token_created_at"],
|
|
4916
|
+
updatedAt: obj["api_token_updated_at"],
|
|
4917
|
+
clientId: obj["api_token_client_id"],
|
|
4918
|
+
name: obj["api_token_name"],
|
|
4919
|
+
permissions: obj["api_token_permissions"].map((e) => Permission_default[e]),
|
|
4920
|
+
typename: "ApiToken"
|
|
4921
|
+
};
|
|
4922
|
+
};
|
|
4923
|
+
var FRAGMENT11 = `
|
|
4924
|
+
fragment ApiTokenFragment on ApiToken {
|
|
4925
|
+
__typename
|
|
4926
|
+
api_token_id: id
|
|
4927
|
+
api_token_created_at: created_at
|
|
4928
|
+
api_token_updated_at: updated_at
|
|
4929
|
+
api_token_client_id: client_id
|
|
4930
|
+
api_token_name: name
|
|
4931
|
+
api_token_permissions: permissions
|
|
4779
4932
|
}`;
|
|
4780
|
-
var
|
|
4933
|
+
var getApiTokenQuery = (id) => {
|
|
4781
4934
|
return {
|
|
4782
4935
|
queryPayload: `
|
|
4783
|
-
query
|
|
4936
|
+
query GetApiToken($id: ID!) {
|
|
4784
4937
|
entity(id: $id) {
|
|
4785
|
-
... on
|
|
4786
|
-
...
|
|
4938
|
+
... on ApiToken {
|
|
4939
|
+
...ApiTokenFragment
|
|
4787
4940
|
}
|
|
4788
4941
|
}
|
|
4789
4942
|
}
|
|
@@ -4791,10 +4944,49 @@ query GetInvoice($id: ID!) {
|
|
|
4791
4944
|
${FRAGMENT11}
|
|
4792
4945
|
`,
|
|
4793
4946
|
variables: { id },
|
|
4794
|
-
constructObject: (data) =>
|
|
4947
|
+
constructObject: (data) => ApiTokenFromJson(data.entity)
|
|
4795
4948
|
};
|
|
4796
4949
|
};
|
|
4797
4950
|
|
|
4951
|
+
// src/graphql/CreateApiToken.ts
|
|
4952
|
+
var CreateApiToken = `
|
|
4953
|
+
mutation CreateApiToken(
|
|
4954
|
+
$name: String!
|
|
4955
|
+
$permissions: [Permission!]!
|
|
4956
|
+
) {
|
|
4957
|
+
create_api_token(input: {
|
|
4958
|
+
name: $name
|
|
4959
|
+
permissions: $permissions
|
|
4960
|
+
}) {
|
|
4961
|
+
api_token {
|
|
4962
|
+
...ApiTokenFragment
|
|
4963
|
+
}
|
|
4964
|
+
client_secret
|
|
4965
|
+
}
|
|
4966
|
+
}
|
|
4967
|
+
|
|
4968
|
+
${FRAGMENT11}
|
|
4969
|
+
`;
|
|
4970
|
+
|
|
4971
|
+
// src/graphql/CreateInvoice.ts
|
|
4972
|
+
var CreateInvoice = `
|
|
4973
|
+
mutation CreateInvoice(
|
|
4974
|
+
$node_id: ID!
|
|
4975
|
+
$amount_msats: Long!
|
|
4976
|
+
$memo: String
|
|
4977
|
+
$type: InvoiceType = null
|
|
4978
|
+
$expiry_secs: Int = null
|
|
4979
|
+
) {
|
|
4980
|
+
create_invoice(input: { node_id: $node_id, amount_msats: $amount_msats, memo: $memo, invoice_type: $type, expiry_secs: $expiry_secs }) {
|
|
4981
|
+
invoice {
|
|
4982
|
+
data {
|
|
4983
|
+
encoded_payment_request
|
|
4984
|
+
}
|
|
4985
|
+
}
|
|
4986
|
+
}
|
|
4987
|
+
}
|
|
4988
|
+
`;
|
|
4989
|
+
|
|
4798
4990
|
// src/graphql/CreateLnurlInvoice.ts
|
|
4799
4991
|
var CreateLnurlInvoice = `
|
|
4800
4992
|
mutation CreateLnurlInvoice(
|
|
@@ -4814,7 +5006,7 @@ mutation CreateLnurlInvoice(
|
|
|
4814
5006
|
}
|
|
4815
5007
|
}
|
|
4816
5008
|
}
|
|
4817
|
-
${
|
|
5009
|
+
${FRAGMENT9}
|
|
4818
5010
|
`;
|
|
4819
5011
|
|
|
4820
5012
|
// src/graphql/CreateNodeWalletAddress.ts
|
|
@@ -5146,7 +5338,7 @@ var CreateUmaInvitation = `
|
|
|
5146
5338
|
}
|
|
5147
5339
|
}
|
|
5148
5340
|
|
|
5149
|
-
${
|
|
5341
|
+
${FRAGMENT10}
|
|
5150
5342
|
`;
|
|
5151
5343
|
|
|
5152
5344
|
// src/graphql/CreateUmaInvitationWithIncentives.ts
|
|
@@ -5167,7 +5359,7 @@ var CreateUmaInvitationWithIncentives = `
|
|
|
5167
5359
|
}
|
|
5168
5360
|
}
|
|
5169
5361
|
|
|
5170
|
-
${
|
|
5362
|
+
${FRAGMENT10}
|
|
5171
5363
|
`;
|
|
5172
5364
|
|
|
5173
5365
|
// src/graphql/CreateUmaInvoice.ts
|
|
@@ -5189,7 +5381,7 @@ mutation CreateUmaInvoice(
|
|
|
5189
5381
|
}
|
|
5190
5382
|
}
|
|
5191
5383
|
}
|
|
5192
|
-
${
|
|
5384
|
+
${FRAGMENT9}
|
|
5193
5385
|
`;
|
|
5194
5386
|
|
|
5195
5387
|
// src/graphql/DecodeInvoice.ts
|
|
@@ -5203,7 +5395,7 @@ var DecodeInvoice = `
|
|
|
5203
5395
|
}
|
|
5204
5396
|
}
|
|
5205
5397
|
|
|
5206
|
-
${
|
|
5398
|
+
${FRAGMENT8}
|
|
5207
5399
|
`;
|
|
5208
5400
|
|
|
5209
5401
|
// src/graphql/DeleteApiToken.ts
|
|
@@ -5229,7 +5421,7 @@ var FetchUmaInvitation = `
|
|
|
5229
5421
|
}
|
|
5230
5422
|
}
|
|
5231
5423
|
|
|
5232
|
-
${
|
|
5424
|
+
${FRAGMENT10}
|
|
5233
5425
|
`;
|
|
5234
5426
|
|
|
5235
5427
|
// src/graphql/FundNode.ts
|
|
@@ -5766,7 +5958,7 @@ var PaymentFailureReason = /* @__PURE__ */ ((PaymentFailureReason2) => {
|
|
|
5766
5958
|
var PaymentFailureReason_default = PaymentFailureReason;
|
|
5767
5959
|
|
|
5768
5960
|
// src/objects/PaymentRequestData.ts
|
|
5769
|
-
var
|
|
5961
|
+
var import_core5 = require("@lightsparkdev/core");
|
|
5770
5962
|
var PaymentRequestDataFromJson = (obj) => {
|
|
5771
5963
|
if (obj["__typename"] == "InvoiceData") {
|
|
5772
5964
|
return {
|
|
@@ -5781,7 +5973,7 @@ var PaymentRequestDataFromJson = (obj) => {
|
|
|
5781
5973
|
memo: obj["invoice_data_memo"]
|
|
5782
5974
|
};
|
|
5783
5975
|
}
|
|
5784
|
-
throw new
|
|
5976
|
+
throw new import_core5.LightsparkException(
|
|
5785
5977
|
"DeserializationError",
|
|
5786
5978
|
`Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj["__typename"]}`
|
|
5787
5979
|
);
|
|
@@ -5801,7 +5993,7 @@ var PaymentRequestDataToJson = (obj) => {
|
|
|
5801
5993
|
invoice_data_destination: NodeToJson(invoiceData.destination)
|
|
5802
5994
|
};
|
|
5803
5995
|
}
|
|
5804
|
-
throw new
|
|
5996
|
+
throw new import_core5.LightsparkException(
|
|
5805
5997
|
"DeserializationError",
|
|
5806
5998
|
`Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj.typename}`
|
|
5807
5999
|
);
|
|
@@ -6378,8 +6570,35 @@ var PayInvoice = `
|
|
|
6378
6570
|
${FRAGMENT17}
|
|
6379
6571
|
`;
|
|
6380
6572
|
|
|
6573
|
+
// src/graphql/PayUmaInvoice.ts
|
|
6574
|
+
var PayUmaInvoice = `
|
|
6575
|
+
mutation PayUmaInvoice(
|
|
6576
|
+
$node_id: ID!
|
|
6577
|
+
$encoded_invoice: String!
|
|
6578
|
+
$timeout_secs: Int!
|
|
6579
|
+
$maximum_fees_msats: Long!
|
|
6580
|
+
$amount_msats: Long
|
|
6581
|
+
) {
|
|
6582
|
+
pay_uma_invoice(
|
|
6583
|
+
input: {
|
|
6584
|
+
node_id: $node_id
|
|
6585
|
+
encoded_invoice: $encoded_invoice
|
|
6586
|
+
timeout_secs: $timeout_secs
|
|
6587
|
+
maximum_fees_msats: $maximum_fees_msats
|
|
6588
|
+
amount_msats: $amount_msats
|
|
6589
|
+
}
|
|
6590
|
+
) {
|
|
6591
|
+
payment {
|
|
6592
|
+
...OutgoingPaymentFragment
|
|
6593
|
+
}
|
|
6594
|
+
}
|
|
6595
|
+
}
|
|
6596
|
+
|
|
6597
|
+
${FRAGMENT17}
|
|
6598
|
+
`;
|
|
6599
|
+
|
|
6381
6600
|
// src/objects/PaymentRequest.ts
|
|
6382
|
-
var
|
|
6601
|
+
var import_core6 = require("@lightsparkdev/core");
|
|
6383
6602
|
var PaymentRequestFromJson = (obj) => {
|
|
6384
6603
|
if (obj["__typename"] == "Invoice") {
|
|
6385
6604
|
return {
|
|
@@ -6392,7 +6611,7 @@ var PaymentRequestFromJson = (obj) => {
|
|
|
6392
6611
|
amountPaid: !!obj["invoice_amount_paid"] ? CurrencyAmountFromJson(obj["invoice_amount_paid"]) : void 0
|
|
6393
6612
|
};
|
|
6394
6613
|
}
|
|
6395
|
-
throw new
|
|
6614
|
+
throw new import_core6.LightsparkException(
|
|
6396
6615
|
"DeserializationError",
|
|
6397
6616
|
`Couldn't find a concrete type for interface PaymentRequest corresponding to the typename=${obj["__typename"]}`
|
|
6398
6617
|
);
|
|
@@ -6744,43 +6963,16 @@ query PaymentRequestsForNode(
|
|
|
6744
6963
|
) {
|
|
6745
6964
|
count
|
|
6746
6965
|
entities {
|
|
6747
|
-
...PaymentRequestFragment
|
|
6748
|
-
__typename
|
|
6749
|
-
}
|
|
6750
|
-
__typename
|
|
6751
|
-
}
|
|
6752
|
-
__typename
|
|
6753
|
-
}
|
|
6754
|
-
}
|
|
6755
|
-
|
|
6756
|
-
${FRAGMENT18}
|
|
6757
|
-
`;
|
|
6758
|
-
|
|
6759
|
-
// src/graphql/PayUmaInvoice.ts
|
|
6760
|
-
var PayUmaInvoice = `
|
|
6761
|
-
mutation PayUmaInvoice(
|
|
6762
|
-
$node_id: ID!
|
|
6763
|
-
$encoded_invoice: String!
|
|
6764
|
-
$timeout_secs: Int!
|
|
6765
|
-
$maximum_fees_msats: Long!
|
|
6766
|
-
$amount_msats: Long
|
|
6767
|
-
) {
|
|
6768
|
-
pay_uma_invoice(
|
|
6769
|
-
input: {
|
|
6770
|
-
node_id: $node_id
|
|
6771
|
-
encoded_invoice: $encoded_invoice
|
|
6772
|
-
timeout_secs: $timeout_secs
|
|
6773
|
-
maximum_fees_msats: $maximum_fees_msats
|
|
6774
|
-
amount_msats: $amount_msats
|
|
6775
|
-
}
|
|
6776
|
-
) {
|
|
6777
|
-
payment {
|
|
6778
|
-
...OutgoingPaymentFragment
|
|
6779
|
-
}
|
|
6966
|
+
...PaymentRequestFragment
|
|
6967
|
+
__typename
|
|
6968
|
+
}
|
|
6969
|
+
__typename
|
|
6970
|
+
}
|
|
6971
|
+
__typename
|
|
6780
6972
|
}
|
|
6781
|
-
|
|
6973
|
+
}
|
|
6782
6974
|
|
|
6783
|
-
|
|
6975
|
+
${FRAGMENT18}
|
|
6784
6976
|
`;
|
|
6785
6977
|
|
|
6786
6978
|
// src/objects/WithdrawalRequest.ts
|
|
@@ -7239,7 +7431,7 @@ var SendPayment = `
|
|
|
7239
7431
|
`;
|
|
7240
7432
|
|
|
7241
7433
|
// src/objects/Transaction.ts
|
|
7242
|
-
var
|
|
7434
|
+
var import_core7 = require("@lightsparkdev/core");
|
|
7243
7435
|
|
|
7244
7436
|
// src/objects/RoutingTransactionFailureReason.ts
|
|
7245
7437
|
var RoutingTransactionFailureReason = /* @__PURE__ */ ((RoutingTransactionFailureReason2) => {
|
|
@@ -7383,7 +7575,7 @@ var TransactionFromJson = (obj) => {
|
|
|
7383
7575
|
numConfirmations: obj["withdrawal_num_confirmations"]
|
|
7384
7576
|
};
|
|
7385
7577
|
}
|
|
7386
|
-
throw new
|
|
7578
|
+
throw new import_core7.LightsparkException(
|
|
7387
7579
|
"DeserializationError",
|
|
7388
7580
|
`Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj["__typename"]}`
|
|
7389
7581
|
);
|
|
@@ -8064,45 +8256,6 @@ ${FRAGMENT22}
|
|
|
8064
8256
|
${FRAGMENT}
|
|
8065
8257
|
`;
|
|
8066
8258
|
|
|
8067
|
-
// src/graphql/TransactionsForNode.ts
|
|
8068
|
-
var TransactionsForNode = `
|
|
8069
|
-
query TransactionsForNode(
|
|
8070
|
-
$network: BitcoinNetwork!,
|
|
8071
|
-
$nodeId: ID!,
|
|
8072
|
-
$numTransactions: Int,
|
|
8073
|
-
$afterDate: DateTime,
|
|
8074
|
-
$transactionTypes: [TransactionType!] = [PAYMENT, PAYMENT_REQUEST, ROUTE, L1_WITHDRAW, L1_DEPOSIT]
|
|
8075
|
-
$transaction_statuses: [TransactionStatus!] = null
|
|
8076
|
-
) {
|
|
8077
|
-
current_account {
|
|
8078
|
-
id
|
|
8079
|
-
name
|
|
8080
|
-
recent_transactions: transactions(
|
|
8081
|
-
first: $numTransactions
|
|
8082
|
-
types: $transactionTypes
|
|
8083
|
-
bitcoin_network: $network
|
|
8084
|
-
lightning_node_id: $nodeId
|
|
8085
|
-
statuses: $transaction_statuses
|
|
8086
|
-
after_date: $afterDate
|
|
8087
|
-
) {
|
|
8088
|
-
count
|
|
8089
|
-
total_amount_transacted {
|
|
8090
|
-
...CurrencyAmountFragment
|
|
8091
|
-
}
|
|
8092
|
-
entities {
|
|
8093
|
-
...TransactionFragment
|
|
8094
|
-
__typename
|
|
8095
|
-
}
|
|
8096
|
-
__typename
|
|
8097
|
-
}
|
|
8098
|
-
__typename
|
|
8099
|
-
}
|
|
8100
|
-
}
|
|
8101
|
-
|
|
8102
|
-
${FRAGMENT22}
|
|
8103
|
-
${FRAGMENT}
|
|
8104
|
-
`;
|
|
8105
|
-
|
|
8106
8259
|
// src/objects/TransactionUpdate.ts
|
|
8107
8260
|
var TransactionUpdateFromJson = (obj) => {
|
|
8108
8261
|
return {
|
|
@@ -8149,181 +8302,44 @@ subscription TransactionSubscription(
|
|
|
8149
8302
|
${FRAGMENT23}
|
|
8150
8303
|
`;
|
|
8151
8304
|
|
|
8152
|
-
// src/
|
|
8153
|
-
var
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8305
|
+
// src/graphql/TransactionsForNode.ts
|
|
8306
|
+
var TransactionsForNode = `
|
|
8307
|
+
query TransactionsForNode(
|
|
8308
|
+
$network: BitcoinNetwork!,
|
|
8309
|
+
$nodeId: ID!,
|
|
8310
|
+
$numTransactions: Int,
|
|
8311
|
+
$afterDate: DateTime,
|
|
8312
|
+
$transactionTypes: [TransactionType!] = [PAYMENT, PAYMENT_REQUEST, ROUTE, L1_WITHDRAW, L1_DEPOSIT]
|
|
8313
|
+
$transaction_statuses: [TransactionStatus!] = null
|
|
8314
|
+
) {
|
|
8315
|
+
current_account {
|
|
8316
|
+
id
|
|
8317
|
+
name
|
|
8318
|
+
recent_transactions: transactions(
|
|
8319
|
+
first: $numTransactions
|
|
8320
|
+
types: $transactionTypes
|
|
8321
|
+
bitcoin_network: $network
|
|
8322
|
+
lightning_node_id: $nodeId
|
|
8323
|
+
statuses: $transaction_statuses
|
|
8324
|
+
after_date: $afterDate
|
|
8325
|
+
) {
|
|
8326
|
+
count
|
|
8327
|
+
total_amount_transacted {
|
|
8328
|
+
...CurrencyAmountFragment
|
|
8329
|
+
}
|
|
8330
|
+
entities {
|
|
8331
|
+
...TransactionFragment
|
|
8332
|
+
__typename
|
|
8333
|
+
}
|
|
8334
|
+
__typename
|
|
8167
8335
|
}
|
|
8168
|
-
|
|
8336
|
+
__typename
|
|
8169
8337
|
}
|
|
8170
|
-
}
|
|
8171
|
-
`;
|
|
8172
|
-
|
|
8173
|
-
// src/SigningKeyLoader.ts
|
|
8174
|
-
var SIGNING_KEY_PATH = "m/5";
|
|
8175
|
-
function isNodeIdAndPasswordSigningKeyLoaderArgs(args) {
|
|
8176
|
-
return args.password !== void 0;
|
|
8177
|
-
}
|
|
8178
|
-
function isMasterSeedSigningKeyLoaderArgs(args) {
|
|
8179
|
-
return args.masterSeed !== void 0;
|
|
8180
8338
|
}
|
|
8181
|
-
var NodeIdAndPasswordSigningKeyLoader = class {
|
|
8182
|
-
nodeId;
|
|
8183
|
-
password;
|
|
8184
|
-
requester;
|
|
8185
|
-
cryptoImpl;
|
|
8186
|
-
constructor(args, requester, cryptoImpl) {
|
|
8187
|
-
this.nodeId = args.nodeId;
|
|
8188
|
-
this.password = args.password;
|
|
8189
|
-
this.requester = requester;
|
|
8190
|
-
this.cryptoImpl = cryptoImpl;
|
|
8191
|
-
}
|
|
8192
|
-
async loadSigningKey() {
|
|
8193
|
-
const encryptedKey = await this.recoverNodeSigningKey();
|
|
8194
|
-
if (!encryptedKey) {
|
|
8195
|
-
console.warn("No encrypted key found for node " + this.nodeId);
|
|
8196
|
-
return;
|
|
8197
|
-
}
|
|
8198
|
-
const signingPrivateKey = await this.cryptoImpl.decryptSecretWithNodePassword(
|
|
8199
|
-
encryptedKey.cipher,
|
|
8200
|
-
encryptedKey.encrypted_value,
|
|
8201
|
-
this.password
|
|
8202
|
-
);
|
|
8203
|
-
if (!signingPrivateKey) {
|
|
8204
|
-
throw new import_core6.LightsparkSigningException(
|
|
8205
|
-
"Unable to decrypt signing key with provided password. Please try again."
|
|
8206
|
-
);
|
|
8207
|
-
}
|
|
8208
|
-
let signingPrivateKeyPEM = "";
|
|
8209
|
-
if (new Uint8Array(signingPrivateKey)[0] === 48) {
|
|
8210
|
-
signingPrivateKeyPEM = (0, import_core6.b64encode)(signingPrivateKey);
|
|
8211
|
-
} else {
|
|
8212
|
-
const dec = new TextDecoder();
|
|
8213
|
-
signingPrivateKeyPEM = dec.decode(signingPrivateKey);
|
|
8214
|
-
}
|
|
8215
|
-
return { key: signingPrivateKeyPEM, type: import_core6.SigningKeyType.RSASigningKey };
|
|
8216
|
-
}
|
|
8217
|
-
async recoverNodeSigningKey() {
|
|
8218
|
-
const response = await this.requester.makeRawRequest(
|
|
8219
|
-
RecoverNodeSigningKey,
|
|
8220
|
-
{ nodeId: this.nodeId }
|
|
8221
|
-
);
|
|
8222
|
-
const nodeEntity = response.entity;
|
|
8223
|
-
if (nodeEntity?.__typename === "LightsparkNodeWithOSK") {
|
|
8224
|
-
return nodeEntity.encrypted_signing_private_key;
|
|
8225
|
-
}
|
|
8226
|
-
return null;
|
|
8227
|
-
}
|
|
8228
|
-
};
|
|
8229
|
-
var MasterSeedSigningKeyLoader = class {
|
|
8230
|
-
masterSeed;
|
|
8231
|
-
network;
|
|
8232
|
-
constructor(args) {
|
|
8233
|
-
this.masterSeed = args.masterSeed;
|
|
8234
|
-
this.network = args.network;
|
|
8235
|
-
}
|
|
8236
|
-
async loadSigningKey() {
|
|
8237
|
-
if (import_core6.isBrowser) {
|
|
8238
|
-
throw new import_core6.LightsparkSigningException(
|
|
8239
|
-
"Browser environments not supported for master seed signing key loader."
|
|
8240
|
-
);
|
|
8241
|
-
}
|
|
8242
|
-
const { LightsparkSigner, Network } = await import("@lightsparkdev/crypto-wasm");
|
|
8243
|
-
let cryptoLibNetwork;
|
|
8244
|
-
switch (this.network) {
|
|
8245
|
-
case BitcoinNetwork_default.MAINNET:
|
|
8246
|
-
cryptoLibNetwork = Network.Bitcoin;
|
|
8247
|
-
break;
|
|
8248
|
-
case BitcoinNetwork_default.TESTNET:
|
|
8249
|
-
cryptoLibNetwork = Network.Testnet;
|
|
8250
|
-
break;
|
|
8251
|
-
case BitcoinNetwork_default.REGTEST:
|
|
8252
|
-
cryptoLibNetwork = Network.Regtest;
|
|
8253
|
-
break;
|
|
8254
|
-
default:
|
|
8255
|
-
throw new Error(
|
|
8256
|
-
`Unsupported lightspark_crypto network ${this.network}.`
|
|
8257
|
-
);
|
|
8258
|
-
}
|
|
8259
|
-
const lightsparkSigner = LightsparkSigner.from_bytes(
|
|
8260
|
-
this.masterSeed,
|
|
8261
|
-
cryptoLibNetwork
|
|
8262
|
-
);
|
|
8263
|
-
const privateKey = lightsparkSigner.derive_private_key(SIGNING_KEY_PATH);
|
|
8264
|
-
return { key: privateKey, type: import_core6.SigningKeyType.Secp256k1SigningKey };
|
|
8265
|
-
}
|
|
8266
|
-
};
|
|
8267
8339
|
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
this.nodeKeyCache = nodeKeyCache;
|
|
8272
|
-
this.cryptoImpl = cryptoImpl;
|
|
8273
|
-
this.idToLoader = /* @__PURE__ */ new Map();
|
|
8274
|
-
}
|
|
8275
|
-
idToLoader;
|
|
8276
|
-
/**
|
|
8277
|
-
* Sets the signing key loader for a node.
|
|
8278
|
-
* Instantiates a signing key loader based on the type of args passed in by the user.
|
|
8279
|
-
*
|
|
8280
|
-
* @param nodeId The ID of the node to get the key for
|
|
8281
|
-
* @param loaderArgs Loader arguments for loading the key
|
|
8282
|
-
* @param requester Requester used for loading the key
|
|
8283
|
-
*/
|
|
8284
|
-
setLoader(nodeId, loaderArgs, requester) {
|
|
8285
|
-
let loader;
|
|
8286
|
-
if (isNodeIdAndPasswordSigningKeyLoaderArgs(loaderArgs)) {
|
|
8287
|
-
loader = new NodeIdAndPasswordSigningKeyLoader(
|
|
8288
|
-
{ nodeId, ...loaderArgs },
|
|
8289
|
-
requester,
|
|
8290
|
-
this.cryptoImpl
|
|
8291
|
-
);
|
|
8292
|
-
} else if (isMasterSeedSigningKeyLoaderArgs(loaderArgs)) {
|
|
8293
|
-
loader = new MasterSeedSigningKeyLoader({ ...loaderArgs });
|
|
8294
|
-
} else {
|
|
8295
|
-
throw new import_core7.LightsparkSigningException("Invalid signing key loader args");
|
|
8296
|
-
}
|
|
8297
|
-
this.idToLoader.set(nodeId, loader);
|
|
8298
|
-
}
|
|
8299
|
-
/**
|
|
8300
|
-
* Gets the key for a node using the loader set by [setLoader]
|
|
8301
|
-
*
|
|
8302
|
-
* @param id The ID of the node to get the key for
|
|
8303
|
-
* @returns The loaded key
|
|
8304
|
-
*/
|
|
8305
|
-
async getKeyWithLoader(id) {
|
|
8306
|
-
if (this.nodeKeyCache.hasKey(id)) {
|
|
8307
|
-
return this.nodeKeyCache.getKey(id);
|
|
8308
|
-
}
|
|
8309
|
-
const loader = this.idToLoader.get(id);
|
|
8310
|
-
if (!loader) {
|
|
8311
|
-
throw new import_core7.LightsparkSigningException(
|
|
8312
|
-
"No signing key loader found for node " + id
|
|
8313
|
-
);
|
|
8314
|
-
}
|
|
8315
|
-
const loaderResult = await loader.loadSigningKey();
|
|
8316
|
-
if (!loaderResult) {
|
|
8317
|
-
return;
|
|
8318
|
-
}
|
|
8319
|
-
const key = await this.nodeKeyCache.loadKey(
|
|
8320
|
-
id,
|
|
8321
|
-
{ key: loaderResult.key },
|
|
8322
|
-
loaderResult.type
|
|
8323
|
-
);
|
|
8324
|
-
return key || void 0;
|
|
8325
|
-
}
|
|
8326
|
-
};
|
|
8340
|
+
${FRAGMENT22}
|
|
8341
|
+
${FRAGMENT}
|
|
8342
|
+
`;
|
|
8327
8343
|
|
|
8328
8344
|
// src/objects/Account.ts
|
|
8329
8345
|
var import_auto_bind12 = __toESM(require("auto-bind"), 1);
|
|
@@ -11623,7 +11639,8 @@ var LightsparkClient = class {
|
|
|
11623
11639
|
* use, you should use the `AccountTokenAuthProvider`.
|
|
11624
11640
|
* @param serverUrl The base URL of the server to connect to. Defaults to lightspark production.
|
|
11625
11641
|
* @param cryptoImpl The crypto implementation to use. Defaults to web and node compatible crypto.
|
|
11626
|
-
* For React Native, you should use the `ReactNativeCrypto`
|
|
11642
|
+
* For React Native, you should use the `ReactNativeCrypto`
|
|
11643
|
+
* implementation from `@lightsparkdev/react-native`.
|
|
11627
11644
|
*/
|
|
11628
11645
|
constructor(authProvider = new import_core9.StubAuthProvider(), serverUrl = "api.lightspark.com", cryptoImpl = import_core9.DefaultCrypto) {
|
|
11629
11646
|
this.authProvider = authProvider;
|
|
@@ -11649,9 +11666,11 @@ var LightsparkClient = class {
|
|
|
11649
11666
|
nodeKeyLoaderCache;
|
|
11650
11667
|
LIGHTSPARK_SDK_ENDPOINT = process.env.LIGHTSPARK_SDK_ENDPOINT || "graphql/server/2023-09-13";
|
|
11651
11668
|
/**
|
|
11652
|
-
* Sets the key loader for a node. This unlocks client operations that
|
|
11653
|
-
* Passing in [NodeIdAndPasswordSigningKeyLoaderArgs]
|
|
11654
|
-
*
|
|
11669
|
+
* Sets the key loader for a node. This unlocks client operations that
|
|
11670
|
+
* require a private key. Passing in [NodeIdAndPasswordSigningKeyLoaderArgs]
|
|
11671
|
+
* loads the RSA key for an OSK node.
|
|
11672
|
+
* Passing in [MasterSeedSigningKeyLoaderArgs] loads the Secp256k1 key for a
|
|
11673
|
+
* remote signing node.
|
|
11655
11674
|
*
|
|
11656
11675
|
* @param nodeId The ID of the node the key is for
|
|
11657
11676
|
* @param loader The loader for the key
|
|
@@ -11662,7 +11681,8 @@ var LightsparkClient = class {
|
|
|
11662
11681
|
return !!key;
|
|
11663
11682
|
}
|
|
11664
11683
|
/**
|
|
11665
|
-
* Gets the signing key for a node. Must have previously called
|
|
11684
|
+
* Gets the signing key for a node. Must have previously called
|
|
11685
|
+
* [loadNodeSigningKey].
|
|
11666
11686
|
*
|
|
11667
11687
|
* @param nodeId The ID of the node the key is for
|
|
11668
11688
|
* @returns The signing key for the node
|
|
@@ -11671,7 +11691,8 @@ var LightsparkClient = class {
|
|
|
11671
11691
|
return await this.nodeKeyLoaderCache.getKeyWithLoader(nodeId);
|
|
11672
11692
|
}
|
|
11673
11693
|
/**
|
|
11674
|
-
* Sets the auth provider for the client.
|
|
11694
|
+
* Sets the auth provider for the client.
|
|
11695
|
+
* This is useful for switching between auth providers if you are using
|
|
11675
11696
|
* multiple accounts or waiting for the user to log in.
|
|
11676
11697
|
*
|
|
11677
11698
|
* @param authProvider
|
|
@@ -11750,7 +11771,8 @@ var LightsparkClient = class {
|
|
|
11750
11771
|
) ?? [];
|
|
11751
11772
|
}
|
|
11752
11773
|
/**
|
|
11753
|
-
* Starts listening for new transactions or updates to existing transactions
|
|
11774
|
+
* Starts listening for new transactions or updates to existing transactions
|
|
11775
|
+
* for a list of nodes.
|
|
11754
11776
|
*
|
|
11755
11777
|
* @param nodeIds The node IDs for which to listen to transactions.
|
|
11756
11778
|
* @returns A zen-observable that emits transaction updates for the given node IDs.
|
|
@@ -11767,8 +11789,8 @@ var LightsparkClient = class {
|
|
|
11767
11789
|
);
|
|
11768
11790
|
}
|
|
11769
11791
|
/**
|
|
11770
|
-
* Retrieves a dashboard of basic info for the authenticated account.
|
|
11771
|
-
* included.
|
|
11792
|
+
* Retrieves a dashboard of basic info for the authenticated account.
|
|
11793
|
+
* See `AccountDashboard` for which info is included.
|
|
11772
11794
|
*
|
|
11773
11795
|
* @param nodeIds The node IDs to include in the dashboard. Defaults to undefined (all nodes).
|
|
11774
11796
|
* @param bitcoinNetwork The bitcoin network to include in the dashboard. Defaults to MAINNET.
|
|
@@ -11835,8 +11857,8 @@ var LightsparkClient = class {
|
|
|
11835
11857
|
};
|
|
11836
11858
|
}
|
|
11837
11859
|
/**
|
|
11838
|
-
* Gets a basic dashboard for a single node, including recent transactions.
|
|
11839
|
-
* included.
|
|
11860
|
+
* Gets a basic dashboard for a single node, including recent transactions.
|
|
11861
|
+
* See `SingleNodeDashboard` for which info is included.
|
|
11840
11862
|
*
|
|
11841
11863
|
* @param nodeId The node ID for which to get a dashboard.
|
|
11842
11864
|
* @param bitcoinNetwork The bitcoin network for which to get a dashboard. Defaults to MAINNET.
|
|
@@ -11907,7 +11929,8 @@ var LightsparkClient = class {
|
|
|
11907
11929
|
/**
|
|
11908
11930
|
* Creates an invoice for the given node.
|
|
11909
11931
|
*
|
|
11910
|
-
* Test mode note: You can simulate a payment of this invoice in test move
|
|
11932
|
+
* Test mode note: You can simulate a payment of this invoice in test move
|
|
11933
|
+
* using [createTestModePayment].
|
|
11911
11934
|
*
|
|
11912
11935
|
* @param nodeId The node ID for which to create an invoice.
|
|
11913
11936
|
* @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
|
|
@@ -11935,11 +11958,13 @@ var LightsparkClient = class {
|
|
|
11935
11958
|
return response.create_invoice?.invoice.data?.encoded_payment_request;
|
|
11936
11959
|
}
|
|
11937
11960
|
/**
|
|
11938
|
-
* Generates a Lightning Invoice (follows the Bolt 11 specification) to
|
|
11939
|
-
* from another Lightning Node.
|
|
11961
|
+
* Generates a Lightning Invoice (follows the Bolt 11 specification) to
|
|
11962
|
+
* request a payment from another Lightning Node.
|
|
11963
|
+
* This should only be used for generating invoices for LNURLs,
|
|
11940
11964
|
* with [createInvoice] preferred in the general case.
|
|
11941
11965
|
*
|
|
11942
|
-
* Test mode note: You can simulate a payment of this invoice in test move
|
|
11966
|
+
* Test mode note: You can simulate a payment of this invoice in test move
|
|
11967
|
+
* using [createTestModePayment].
|
|
11943
11968
|
*
|
|
11944
11969
|
* @param nodeId The node ID for which to create an invoice.
|
|
11945
11970
|
* @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
|
|
@@ -11970,10 +11995,12 @@ var LightsparkClient = class {
|
|
|
11970
11995
|
return InvoiceFromJson(invoiceJson);
|
|
11971
11996
|
}
|
|
11972
11997
|
/**
|
|
11973
|
-
* Creates a new invoice for the UMA protocol.
|
|
11974
|
-
*
|
|
11975
|
-
*
|
|
11976
|
-
*
|
|
11998
|
+
* Creates a new invoice for the UMA protocol.
|
|
11999
|
+
* The metadata is hashed and included in the invoice.
|
|
12000
|
+
* This API generates a Lightning Invoice (follows the Bolt 11 specification)
|
|
12001
|
+
* to request a payment from another Lightning Node.
|
|
12002
|
+
* This should only be used for generating invoices for UMA,
|
|
12003
|
+
* with `createInvoice` preferred in the general case.
|
|
11977
12004
|
*
|
|
11978
12005
|
* @param nodeId The node ID for which to create an invoice.
|
|
11979
12006
|
* @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
|
|
@@ -12001,6 +12028,22 @@ var LightsparkClient = class {
|
|
|
12001
12028
|
}
|
|
12002
12029
|
return InvoiceFromJson(invoiceJson);
|
|
12003
12030
|
}
|
|
12031
|
+
/**
|
|
12032
|
+
* Cancels an existing unpaid invoice and returns that invoice. Cancelled invoices cannot be paid.
|
|
12033
|
+
*
|
|
12034
|
+
* @param invoiceId The ID of the invoice to cancel.
|
|
12035
|
+
* @returns The cancelled invoice, or undefined if the invoice could not be cancelled.
|
|
12036
|
+
*/
|
|
12037
|
+
async cancelInvoice(invoiceId) {
|
|
12038
|
+
const response = await this.requester.makeRawRequest(CancelInvoice, {
|
|
12039
|
+
invoice_id: invoiceId
|
|
12040
|
+
});
|
|
12041
|
+
const invoiceJson = response.cancel_invoice?.invoice;
|
|
12042
|
+
if (!invoiceJson) {
|
|
12043
|
+
return void 0;
|
|
12044
|
+
}
|
|
12045
|
+
return InvoiceFromJson(invoiceJson);
|
|
12046
|
+
}
|
|
12004
12047
|
/**
|
|
12005
12048
|
* Decodes an encoded lightning invoice string.
|
|
12006
12049
|
*
|
|
@@ -12014,7 +12057,8 @@ var LightsparkClient = class {
|
|
|
12014
12057
|
return InvoiceDataFromJson(response.decoded_payment_request);
|
|
12015
12058
|
}
|
|
12016
12059
|
/**
|
|
12017
|
-
* Gets an estimate of the fee for sending a payment over the given bitcoin
|
|
12060
|
+
* Gets an estimate of the fee for sending a payment over the given bitcoin
|
|
12061
|
+
* network.
|
|
12018
12062
|
*
|
|
12019
12063
|
* @param bitcoinNetwork The bitcoin network for which to get a fee estimate. Defaults to MAINNET.
|
|
12020
12064
|
* @returns A fee estimate for the given bitcoin network including a minimum fee rate, and a max-speed fee rate.
|
|
@@ -12051,7 +12095,8 @@ var LightsparkClient = class {
|
|
|
12051
12095
|
);
|
|
12052
12096
|
}
|
|
12053
12097
|
/**
|
|
12054
|
-
* Returns an estimate of the fees that will be paid to send a payment to
|
|
12098
|
+
* Returns an estimate of the fees that will be paid to send a payment to
|
|
12099
|
+
* another Lightning node.
|
|
12055
12100
|
*
|
|
12056
12101
|
* @param nodeId The node from where you want to send the payment.
|
|
12057
12102
|
* @param destinationNodePublicKey The public key of the node that you want to pay.
|
|
@@ -12087,17 +12132,20 @@ var LightsparkClient = class {
|
|
|
12087
12132
|
/**
|
|
12088
12133
|
* Sends a lightning payment for a given invoice.
|
|
12089
12134
|
*
|
|
12090
|
-
* Test mode note: For test mode, you can use the [createTestModeInvoice]
|
|
12091
|
-
* pay in test mode.
|
|
12135
|
+
* Test mode note: For test mode, you can use the [createTestModeInvoice]
|
|
12136
|
+
* function to create an invoice you can pay in test mode.
|
|
12092
12137
|
*
|
|
12093
12138
|
* @param payerNodeId The ID of the node that will pay the invoice.
|
|
12094
12139
|
* @param encodedInvoice The encoded invoice to pay.
|
|
12095
12140
|
* @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
|
|
12096
|
-
* As guidance, a maximum fee of 16 basis points should make almost all
|
|
12097
|
-
*
|
|
12141
|
+
* As guidance, a maximum fee of 16 basis points should make almost all
|
|
12142
|
+
* transactions succeed. For example,
|
|
12143
|
+
* for a transaction between 10k sats and 100k sats,
|
|
12144
|
+
* this would mean a fee limit of 16 to 160 sats.
|
|
12098
12145
|
* @param timeoutSecs A timeout for the payment in seconds. Defaults to 60 seconds.
|
|
12099
12146
|
* @param amountMsats The amount to pay in msats for a zero-amount invoice. Defaults to the full amount of the
|
|
12100
|
-
* invoice. NOTE: This parameter can only be passed for a zero-amount
|
|
12147
|
+
* invoice. NOTE: This parameter can only be passed for a zero-amount
|
|
12148
|
+
* invoice. Otherwise, the call will fail.
|
|
12101
12149
|
* @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
|
|
12102
12150
|
*/
|
|
12103
12151
|
async payInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0) {
|
|
@@ -12127,18 +12175,23 @@ var LightsparkClient = class {
|
|
|
12127
12175
|
return response.pay_invoice && OutgoingPaymentFromJson(response.pay_invoice.payment);
|
|
12128
12176
|
}
|
|
12129
12177
|
/**
|
|
12130
|
-
* sends an UMA payment to a node on the Lightning Network,
|
|
12131
|
-
* (as defined by the BOLT11 specification) that you
|
|
12132
|
-
*
|
|
12178
|
+
* sends an UMA payment to a node on the Lightning Network,
|
|
12179
|
+
* based on the invoice (as defined by the BOLT11 specification) that you
|
|
12180
|
+
* provide.
|
|
12181
|
+
* This should only be used for paying UMA invoices,
|
|
12182
|
+
* with `payInvoice` preferred in the general case.
|
|
12133
12183
|
*
|
|
12134
12184
|
* @param payerNodeId The ID of the node that will pay the invoice.
|
|
12135
12185
|
* @param encodedInvoice The encoded invoice to pay.
|
|
12136
12186
|
* @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
|
|
12137
|
-
* As guidance, a maximum fee of 16 basis points should make almost all
|
|
12138
|
-
*
|
|
12187
|
+
* As guidance, a maximum fee of 16 basis points should make almost all
|
|
12188
|
+
* transactions succeed. For example,
|
|
12189
|
+
* for a transaction between 10k sats and 100k sats,
|
|
12190
|
+
* this would mean a fee limit of 16 to 160 sats.
|
|
12139
12191
|
* @param timeoutSecs A timeout for the payment in seconds. Defaults to 60 seconds.
|
|
12140
12192
|
* @param amountMsats The amount to pay in msats for a zero-amount invoice. Defaults to the full amount of the
|
|
12141
|
-
* invoice. NOTE: This parameter can only be passed for a zero-amount
|
|
12193
|
+
* invoice. NOTE: This parameter can only be passed for a zero-amount
|
|
12194
|
+
* invoice. Otherwise, the call will fail.
|
|
12142
12195
|
* @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
|
|
12143
12196
|
*/
|
|
12144
12197
|
async payUmaInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0) {
|
|
@@ -12168,7 +12221,8 @@ var LightsparkClient = class {
|
|
|
12168
12221
|
return response.pay_uma_invoice && OutgoingPaymentFromJson(response.pay_invoice.payment);
|
|
12169
12222
|
}
|
|
12170
12223
|
/**
|
|
12171
|
-
* Waits for a transaction to have a completed status, and returns the
|
|
12224
|
+
* Waits for a transaction to have a completed status, and returns the
|
|
12225
|
+
* transaction.
|
|
12172
12226
|
*
|
|
12173
12227
|
* @param transactionId The ID of the transaction to wait for
|
|
12174
12228
|
* @param pollTimeoutSecs The timeout in seconds that we will wait before throwing an exception
|
|
@@ -12205,15 +12259,18 @@ var LightsparkClient = class {
|
|
|
12205
12259
|
return transaction;
|
|
12206
12260
|
}
|
|
12207
12261
|
/**
|
|
12208
|
-
* Sends a payment directly to a node on the Lightning Network through the
|
|
12262
|
+
* Sends a payment directly to a node on the Lightning Network through the
|
|
12263
|
+
* public key of the node without an invoice.
|
|
12209
12264
|
*
|
|
12210
12265
|
* @param payerNodeId The ID of the node that will send the payment.
|
|
12211
12266
|
* @param destinationPublicKey The public key of the destination node.
|
|
12212
12267
|
* @param timeoutSecs The timeout in seconds that we will try to make the payment.
|
|
12213
12268
|
* @param amountMsats The amount to pay in msats.
|
|
12214
12269
|
* @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
|
|
12215
|
-
* As guidance, a maximum fee of 15 basis points should make almost all
|
|
12216
|
-
*
|
|
12270
|
+
* As guidance, a maximum fee of 15 basis points should make almost all
|
|
12271
|
+
* transactions succeed. For example,
|
|
12272
|
+
* for a transaction between 10k sats and 100k sats,
|
|
12273
|
+
* this would mean a fee limit of 15 to 150 sats.
|
|
12217
12274
|
* @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
|
|
12218
12275
|
*/
|
|
12219
12276
|
async sendPayment(payerNodeId, destinationPublicKey, timeoutSecs = 60, amountMsats, maximumFeesMsats) {
|
|
@@ -12240,7 +12297,8 @@ var LightsparkClient = class {
|
|
|
12240
12297
|
return response.send_payment && OutgoingPaymentFromJson(response.send_payment.payment);
|
|
12241
12298
|
}
|
|
12242
12299
|
/**
|
|
12243
|
-
* Creates an L1 Bitcoin wallet address for a given node which can be used to
|
|
12300
|
+
* Creates an L1 Bitcoin wallet address for a given node which can be used to
|
|
12301
|
+
* deposit or withdraw funds.
|
|
12244
12302
|
*
|
|
12245
12303
|
* @param nodeId The ID of the node to create a wallet address for.
|
|
12246
12304
|
* @returns A string containing the wallet address for the given node.
|
|
@@ -12253,12 +12311,15 @@ var LightsparkClient = class {
|
|
|
12253
12311
|
return response.create_node_wallet_address.wallet_address;
|
|
12254
12312
|
}
|
|
12255
12313
|
/**
|
|
12256
|
-
* Withdraws funds from the account and sends it to the requested bitcoin
|
|
12314
|
+
* Withdraws funds from the account and sends it to the requested bitcoin
|
|
12315
|
+
* address.
|
|
12257
12316
|
*
|
|
12258
|
-
* Depending on the chosen mode, it will first take the funds from the
|
|
12259
|
-
*
|
|
12260
|
-
*
|
|
12261
|
-
*
|
|
12317
|
+
* Depending on the chosen mode, it will first take the funds from the
|
|
12318
|
+
* wallet, and if applicable, close channels appropriately to recover enough
|
|
12319
|
+
* funds and reopen channels with the remaining funds.
|
|
12320
|
+
* The process is asynchronous and may take up to a few minutes.
|
|
12321
|
+
* You can check the progress by polling the `WithdrawalRequest` that is
|
|
12322
|
+
* created, or by subscribing to a webhook.
|
|
12262
12323
|
*
|
|
12263
12324
|
* @param nodeId The ID of the node from which to withdraw funds.
|
|
12264
12325
|
* @param amountSats The amount of funds to withdraw in satoshis.
|
|
@@ -12279,9 +12340,10 @@ var LightsparkClient = class {
|
|
|
12279
12340
|
return WithdrawalRequestFromJson(response.request_withdrawal.request);
|
|
12280
12341
|
}
|
|
12281
12342
|
/**
|
|
12282
|
-
* Adds funds to a Lightspark node on the REGTEST network.
|
|
12283
|
-
*
|
|
12284
|
-
*
|
|
12343
|
+
* Adds funds to a Lightspark node on the REGTEST network.
|
|
12344
|
+
* If the amount is not specified, 10,000,000 SATOSHI will be added.
|
|
12345
|
+
* This API only functions for nodes created on the REGTEST network and will
|
|
12346
|
+
* return an error when called for any non-REGTEST node.
|
|
12285
12347
|
*
|
|
12286
12348
|
* @param nodeId The ID of the node to fund. Must be a REGTEST node.
|
|
12287
12349
|
* @param amountSats The amount of funds to add to the node in satoshis. Defaults to 10,000,000 SATOSHI.
|
|
@@ -12295,8 +12357,8 @@ var LightsparkClient = class {
|
|
|
12295
12357
|
return CurrencyAmountFromJson(response.fund_node.amount);
|
|
12296
12358
|
}
|
|
12297
12359
|
/**
|
|
12298
|
-
* Creates a new API token that can be used to authenticate requests for this
|
|
12299
|
-
* and SDKs.
|
|
12360
|
+
* Creates a new API token that can be used to authenticate requests for this
|
|
12361
|
+
* account when using the Lightspark APIs and SDKs.
|
|
12300
12362
|
*
|
|
12301
12363
|
* @param name Creates a new API token that can be used to authenticate requests for this account when using the
|
|
12302
12364
|
* Lightspark APIs and SDKs.
|
|
@@ -12333,8 +12395,9 @@ var LightsparkClient = class {
|
|
|
12333
12395
|
await this.requester.makeRawRequest(DeleteApiToken, { api_token_id: id });
|
|
12334
12396
|
}
|
|
12335
12397
|
/**
|
|
12336
|
-
* In test mode, generates a Lightning Invoice which can be paid by a local
|
|
12337
|
-
* This call is only valid in test mode.
|
|
12398
|
+
* In test mode, generates a Lightning Invoice which can be paid by a local
|
|
12399
|
+
* node. This call is only valid in test mode.
|
|
12400
|
+
* You can then pay the invoice using [payInvoice].
|
|
12338
12401
|
*
|
|
12339
12402
|
* @param localNodeId The ID of the node that will pay the invoice.
|
|
12340
12403
|
* @param amountMsats The amount to pay in milli-satoshis.
|
|
@@ -12363,8 +12426,9 @@ var LightsparkClient = class {
|
|
|
12363
12426
|
});
|
|
12364
12427
|
}
|
|
12365
12428
|
/**
|
|
12366
|
-
* In test mode, simulates a payment of a Lightning Invoice from another
|
|
12367
|
-
* This can only be used in test mode and should be used with invoices
|
|
12429
|
+
* In test mode, simulates a payment of a Lightning Invoice from another
|
|
12430
|
+
* node. This can only be used in test mode and should be used with invoices
|
|
12431
|
+
* generated by [createInvoice].
|
|
12368
12432
|
*
|
|
12369
12433
|
* @param localNodeId The ID of the node that will receive the payment.
|
|
12370
12434
|
* @param encodedInvoice The encoded invoice to pay.
|
|
@@ -12387,8 +12451,8 @@ var LightsparkClient = class {
|
|
|
12387
12451
|
});
|
|
12388
12452
|
}
|
|
12389
12453
|
/**
|
|
12390
|
-
* Creates an UMA invitation. If you are part of the incentive program,
|
|
12391
|
-
* [createUmaInvitationWithIncentives].
|
|
12454
|
+
* Creates an UMA invitation. If you are part of the incentive program,
|
|
12455
|
+
* you should use [createUmaInvitationWithIncentives].
|
|
12392
12456
|
*
|
|
12393
12457
|
* @param inviterUma The UMA of the inviter.
|
|
12394
12458
|
* @returns The invitation that was created.
|
|
@@ -12442,8 +12506,8 @@ var LightsparkClient = class {
|
|
|
12442
12506
|
});
|
|
12443
12507
|
}
|
|
12444
12508
|
/**
|
|
12445
|
-
* Claims an UMA invitation. If you are part of the incentive program,
|
|
12446
|
-
* [claimUmaInvitationWithIncentives].
|
|
12509
|
+
* Claims an UMA invitation. If you are part of the incentive program,
|
|
12510
|
+
* you should use [claimUmaInvitationWithIncentives].
|
|
12447
12511
|
*
|
|
12448
12512
|
* @param invitationCode The invitation code to claim.
|
|
12449
12513
|
* @param inviteeUma The UMA of the invitee.
|
|
@@ -12534,7 +12598,8 @@ var LightsparkClient = class {
|
|
|
12534
12598
|
/**
|
|
12535
12599
|
* Executes a raw `Query` against the Lightspark API.
|
|
12536
12600
|
*
|
|
12537
|
-
* This generally should not be used directly,
|
|
12601
|
+
* This generally should not be used directly,
|
|
12602
|
+
* but is exposed for advanced use cases and for internal use to retrieve
|
|
12538
12603
|
* complex fields from objects.
|
|
12539
12604
|
*
|
|
12540
12605
|
* @param query The `Query` to execute.
|