@lightsparkdev/lightspark-sdk 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/chunk-5Z7FB6OT.js +5530 -0
- package/dist/index.cjs +108 -3
- package/dist/index.js +107 -4
- package/dist/objects/index.js +1 -1
- package/package.json +2 -2
- package/src/client.ts +7 -3
- package/src/objects/Account.ts +70 -0
- package/src/objects/AccountToWalletsConnection.ts +48 -0
- package/src/objects/Balances.ts +71 -0
- package/src/objects/Entity.ts +35 -0
- package/src/objects/Wallet.ts +159 -0
- package/src/objects/index.ts +3 -0
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
8
11
|
var __export = (target, all) => {
|
|
9
12
|
for (var name in all)
|
|
10
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -27,6 +30,104 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
30
|
));
|
|
28
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
32
|
|
|
33
|
+
// package.json
|
|
34
|
+
var require_package = __commonJS({
|
|
35
|
+
"package.json"(exports, module2) {
|
|
36
|
+
module2.exports = {
|
|
37
|
+
name: "@lightsparkdev/lightspark-sdk",
|
|
38
|
+
version: "0.2.1",
|
|
39
|
+
description: "Lightspark JS SDK",
|
|
40
|
+
author: "Lightspark Inc.",
|
|
41
|
+
keywords: [
|
|
42
|
+
"lightspark",
|
|
43
|
+
"bitcoin",
|
|
44
|
+
"lightning",
|
|
45
|
+
"payments",
|
|
46
|
+
"typescript"
|
|
47
|
+
],
|
|
48
|
+
homepage: "https://github.com/lightsparkdev/js-sdk",
|
|
49
|
+
repository: {
|
|
50
|
+
type: "git",
|
|
51
|
+
url: "https://github.com/lightsparkdev/js-sdk.git"
|
|
52
|
+
},
|
|
53
|
+
bugs: {
|
|
54
|
+
url: "https://github.com/lightsparkdev/js-sdk/issues"
|
|
55
|
+
},
|
|
56
|
+
engines: {
|
|
57
|
+
node: ">=14.16"
|
|
58
|
+
},
|
|
59
|
+
exports: {
|
|
60
|
+
".": {
|
|
61
|
+
types: "./dist/index.d.ts",
|
|
62
|
+
import: {
|
|
63
|
+
types: "./dist/index.d.ts",
|
|
64
|
+
default: "./dist/index.js"
|
|
65
|
+
},
|
|
66
|
+
module: "./dist/index.js",
|
|
67
|
+
require: "./dist/index.cjs",
|
|
68
|
+
default: "./dist/index.cjs"
|
|
69
|
+
},
|
|
70
|
+
"./objects": {
|
|
71
|
+
types: "./dist/objects/index.d.ts",
|
|
72
|
+
import: {
|
|
73
|
+
types: "./dist/objects/index.d.ts",
|
|
74
|
+
default: "./dist/objects/index.js"
|
|
75
|
+
},
|
|
76
|
+
module: "./dist/objects/index.js",
|
|
77
|
+
require: "./dist/objects/index.cjs",
|
|
78
|
+
default: "./dist/objects/index.cjs"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
type: "module",
|
|
82
|
+
types: "./dist/index.d.ts",
|
|
83
|
+
main: "./dist/index.js",
|
|
84
|
+
module: "./dist/index.js",
|
|
85
|
+
browser: {
|
|
86
|
+
crypto: false
|
|
87
|
+
},
|
|
88
|
+
files: [
|
|
89
|
+
"src/*",
|
|
90
|
+
"dist/*",
|
|
91
|
+
"CHANGELOG.md"
|
|
92
|
+
],
|
|
93
|
+
scripts: {
|
|
94
|
+
build: "tsup --entry src/index.ts --entry src/objects/index.ts --format cjs,esm --dts",
|
|
95
|
+
"copy-static": "cp ./package.json ./README.md ./LICENSE ./dist/",
|
|
96
|
+
dev: "yarn build -- --watch",
|
|
97
|
+
clean: "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
98
|
+
lint: "npx prettier --check ./src",
|
|
99
|
+
format: "npx prettier --write ./src",
|
|
100
|
+
test: "tsc --noEmit --project tsconfig-test.json && jest --no-cache --runInBand --bail",
|
|
101
|
+
"type-check": "tsc --noEmit",
|
|
102
|
+
postversion: "yarn build"
|
|
103
|
+
},
|
|
104
|
+
license: "Apache-2.0",
|
|
105
|
+
dependencies: {
|
|
106
|
+
"@lightsparkdev/core": "^0.2.1",
|
|
107
|
+
"auto-bind": "^5.0.1",
|
|
108
|
+
crypto: "^1.0.1",
|
|
109
|
+
"crypto-browserify": "^3.12.0",
|
|
110
|
+
dayjs: "^1.11.7",
|
|
111
|
+
graphql: "^16.6.0",
|
|
112
|
+
"graphql-ws": "^5.11.3",
|
|
113
|
+
ws: "^8.12.1",
|
|
114
|
+
"zen-observable-ts": "^1.1.0"
|
|
115
|
+
},
|
|
116
|
+
devDependencies: {
|
|
117
|
+
"@types/crypto-js": "^4.1.1",
|
|
118
|
+
"@types/ws": "^8.5.4",
|
|
119
|
+
jest: "^29.4.1",
|
|
120
|
+
prettier: "^2.8.4",
|
|
121
|
+
"prettier-plugin-organize-imports": "^3.2.2",
|
|
122
|
+
"ts-jest": "^29.0.5",
|
|
123
|
+
"ts-node": "^10.9.1",
|
|
124
|
+
typescript: "^4.9.5",
|
|
125
|
+
tsconfig: "*"
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
30
131
|
// src/index.ts
|
|
31
132
|
var src_exports = {};
|
|
32
133
|
__export(src_exports, {
|
|
@@ -5080,9 +5181,11 @@ var LightsparkClient = class {
|
|
|
5080
5181
|
this.authProvider = authProvider;
|
|
5081
5182
|
this.serverUrl = serverUrl;
|
|
5082
5183
|
this.nodeKeyCache = nodeKeyCache;
|
|
5184
|
+
const sdkVersion = require_package().version;
|
|
5083
5185
|
this.requester = new import_core6.Requester(
|
|
5084
5186
|
this.nodeKeyCache,
|
|
5085
|
-
|
|
5187
|
+
LIGHTSPARK_SDK_ENDPOINT,
|
|
5188
|
+
`js-lightspark-sdk/${sdkVersion}`,
|
|
5086
5189
|
authProvider,
|
|
5087
5190
|
serverUrl
|
|
5088
5191
|
);
|
|
@@ -5096,9 +5199,11 @@ var LightsparkClient = class {
|
|
|
5096
5199
|
* @param authProvider
|
|
5097
5200
|
*/
|
|
5098
5201
|
async setAuthProvider(authProvider) {
|
|
5202
|
+
const sdkVersion = require_package().version;
|
|
5099
5203
|
this.requester = new import_core6.Requester(
|
|
5100
5204
|
this.nodeKeyCache,
|
|
5101
|
-
|
|
5205
|
+
LIGHTSPARK_SDK_ENDPOINT,
|
|
5206
|
+
`js-lightspark-sdk/${sdkVersion}`,
|
|
5102
5207
|
authProvider,
|
|
5103
5208
|
this.serverUrl
|
|
5104
5209
|
);
|
|
@@ -5612,7 +5717,7 @@ var LightsparkClient = class {
|
|
|
5612
5717
|
return this.requester.executeQuery(query);
|
|
5613
5718
|
}
|
|
5614
5719
|
};
|
|
5615
|
-
var
|
|
5720
|
+
var LIGHTSPARK_SDK_ENDPOINT = "graphql/server/2023-04-04";
|
|
5616
5721
|
var client_default = LightsparkClient;
|
|
5617
5722
|
|
|
5618
5723
|
// src/objects/InvoiceType.ts
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
WithdrawalRequestFromJson,
|
|
46
46
|
WithdrawalRequestStatus_default,
|
|
47
47
|
WithdrawalRequest_default,
|
|
48
|
+
__commonJS,
|
|
48
49
|
getApiTokenQuery,
|
|
49
50
|
getChannelClosingTransactionQuery,
|
|
50
51
|
getChannelOpeningTransactionQuery,
|
|
@@ -58,7 +59,105 @@ import {
|
|
|
58
59
|
getRoutingTransactionQuery,
|
|
59
60
|
getTransactionQuery,
|
|
60
61
|
getWithdrawalQuery
|
|
61
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-5Z7FB6OT.js";
|
|
63
|
+
|
|
64
|
+
// package.json
|
|
65
|
+
var require_package = __commonJS({
|
|
66
|
+
"package.json"(exports, module) {
|
|
67
|
+
module.exports = {
|
|
68
|
+
name: "@lightsparkdev/lightspark-sdk",
|
|
69
|
+
version: "0.2.1",
|
|
70
|
+
description: "Lightspark JS SDK",
|
|
71
|
+
author: "Lightspark Inc.",
|
|
72
|
+
keywords: [
|
|
73
|
+
"lightspark",
|
|
74
|
+
"bitcoin",
|
|
75
|
+
"lightning",
|
|
76
|
+
"payments",
|
|
77
|
+
"typescript"
|
|
78
|
+
],
|
|
79
|
+
homepage: "https://github.com/lightsparkdev/js-sdk",
|
|
80
|
+
repository: {
|
|
81
|
+
type: "git",
|
|
82
|
+
url: "https://github.com/lightsparkdev/js-sdk.git"
|
|
83
|
+
},
|
|
84
|
+
bugs: {
|
|
85
|
+
url: "https://github.com/lightsparkdev/js-sdk/issues"
|
|
86
|
+
},
|
|
87
|
+
engines: {
|
|
88
|
+
node: ">=14.16"
|
|
89
|
+
},
|
|
90
|
+
exports: {
|
|
91
|
+
".": {
|
|
92
|
+
types: "./dist/index.d.ts",
|
|
93
|
+
import: {
|
|
94
|
+
types: "./dist/index.d.ts",
|
|
95
|
+
default: "./dist/index.js"
|
|
96
|
+
},
|
|
97
|
+
module: "./dist/index.js",
|
|
98
|
+
require: "./dist/index.cjs",
|
|
99
|
+
default: "./dist/index.cjs"
|
|
100
|
+
},
|
|
101
|
+
"./objects": {
|
|
102
|
+
types: "./dist/objects/index.d.ts",
|
|
103
|
+
import: {
|
|
104
|
+
types: "./dist/objects/index.d.ts",
|
|
105
|
+
default: "./dist/objects/index.js"
|
|
106
|
+
},
|
|
107
|
+
module: "./dist/objects/index.js",
|
|
108
|
+
require: "./dist/objects/index.cjs",
|
|
109
|
+
default: "./dist/objects/index.cjs"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
type: "module",
|
|
113
|
+
types: "./dist/index.d.ts",
|
|
114
|
+
main: "./dist/index.js",
|
|
115
|
+
module: "./dist/index.js",
|
|
116
|
+
browser: {
|
|
117
|
+
crypto: false
|
|
118
|
+
},
|
|
119
|
+
files: [
|
|
120
|
+
"src/*",
|
|
121
|
+
"dist/*",
|
|
122
|
+
"CHANGELOG.md"
|
|
123
|
+
],
|
|
124
|
+
scripts: {
|
|
125
|
+
build: "tsup --entry src/index.ts --entry src/objects/index.ts --format cjs,esm --dts",
|
|
126
|
+
"copy-static": "cp ./package.json ./README.md ./LICENSE ./dist/",
|
|
127
|
+
dev: "yarn build -- --watch",
|
|
128
|
+
clean: "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
129
|
+
lint: "npx prettier --check ./src",
|
|
130
|
+
format: "npx prettier --write ./src",
|
|
131
|
+
test: "tsc --noEmit --project tsconfig-test.json && jest --no-cache --runInBand --bail",
|
|
132
|
+
"type-check": "tsc --noEmit",
|
|
133
|
+
postversion: "yarn build"
|
|
134
|
+
},
|
|
135
|
+
license: "Apache-2.0",
|
|
136
|
+
dependencies: {
|
|
137
|
+
"@lightsparkdev/core": "^0.2.1",
|
|
138
|
+
"auto-bind": "^5.0.1",
|
|
139
|
+
crypto: "^1.0.1",
|
|
140
|
+
"crypto-browserify": "^3.12.0",
|
|
141
|
+
dayjs: "^1.11.7",
|
|
142
|
+
graphql: "^16.6.0",
|
|
143
|
+
"graphql-ws": "^5.11.3",
|
|
144
|
+
ws: "^8.12.1",
|
|
145
|
+
"zen-observable-ts": "^1.1.0"
|
|
146
|
+
},
|
|
147
|
+
devDependencies: {
|
|
148
|
+
"@types/crypto-js": "^4.1.1",
|
|
149
|
+
"@types/ws": "^8.5.4",
|
|
150
|
+
jest: "^29.4.1",
|
|
151
|
+
prettier: "^2.8.4",
|
|
152
|
+
"prettier-plugin-organize-imports": "^3.2.2",
|
|
153
|
+
"ts-jest": "^29.0.5",
|
|
154
|
+
"ts-node": "^10.9.1",
|
|
155
|
+
typescript: "^4.9.5",
|
|
156
|
+
tsconfig: "*"
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
});
|
|
62
161
|
|
|
63
162
|
// src/auth/AccountTokenAuthProvider.ts
|
|
64
163
|
import { b64encode } from "@lightsparkdev/core";
|
|
@@ -595,9 +694,11 @@ var LightsparkClient = class {
|
|
|
595
694
|
this.authProvider = authProvider;
|
|
596
695
|
this.serverUrl = serverUrl;
|
|
597
696
|
this.nodeKeyCache = nodeKeyCache;
|
|
697
|
+
const sdkVersion = require_package().version;
|
|
598
698
|
this.requester = new Requester(
|
|
599
699
|
this.nodeKeyCache,
|
|
600
|
-
|
|
700
|
+
LIGHTSPARK_SDK_ENDPOINT,
|
|
701
|
+
`js-lightspark-sdk/${sdkVersion}`,
|
|
601
702
|
authProvider,
|
|
602
703
|
serverUrl
|
|
603
704
|
);
|
|
@@ -611,9 +712,11 @@ var LightsparkClient = class {
|
|
|
611
712
|
* @param authProvider
|
|
612
713
|
*/
|
|
613
714
|
async setAuthProvider(authProvider) {
|
|
715
|
+
const sdkVersion = require_package().version;
|
|
614
716
|
this.requester = new Requester(
|
|
615
717
|
this.nodeKeyCache,
|
|
616
|
-
|
|
718
|
+
LIGHTSPARK_SDK_ENDPOINT,
|
|
719
|
+
`js-lightspark-sdk/${sdkVersion}`,
|
|
617
720
|
authProvider,
|
|
618
721
|
this.serverUrl
|
|
619
722
|
);
|
|
@@ -1127,7 +1230,7 @@ var LightsparkClient = class {
|
|
|
1127
1230
|
return this.requester.executeQuery(query);
|
|
1128
1231
|
}
|
|
1129
1232
|
};
|
|
1130
|
-
var
|
|
1233
|
+
var LIGHTSPARK_SDK_ENDPOINT = "graphql/server/2023-04-04";
|
|
1131
1234
|
var client_default = LightsparkClient;
|
|
1132
1235
|
export {
|
|
1133
1236
|
Account_default as Account,
|
package/dist/objects/index.js
CHANGED
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
getRoutingTransactionQuery,
|
|
42
42
|
getTransactionQuery,
|
|
43
43
|
getWithdrawalQuery
|
|
44
|
-
} from "../chunk-
|
|
44
|
+
} from "../chunk-5Z7FB6OT.js";
|
|
45
45
|
export {
|
|
46
46
|
Account_default as Account,
|
|
47
47
|
AccountToChannelsConnection_default as AccountToChannelsConnection,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightsparkdev/lightspark-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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.1",
|
|
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
|
@@ -100,9 +100,11 @@ class LightsparkClient {
|
|
|
100
100
|
private readonly serverUrl: string = "api.lightspark.com",
|
|
101
101
|
private readonly nodeKeyCache: NodeKeyCache = new NodeKeyCache()
|
|
102
102
|
) {
|
|
103
|
+
const sdkVersion = require("../package.json").version;
|
|
103
104
|
this.requester = new Requester(
|
|
104
105
|
this.nodeKeyCache,
|
|
105
|
-
|
|
106
|
+
LIGHTSPARK_SDK_ENDPOINT,
|
|
107
|
+
`js-lightspark-sdk/${sdkVersion}`,
|
|
106
108
|
authProvider,
|
|
107
109
|
serverUrl
|
|
108
110
|
);
|
|
@@ -117,9 +119,11 @@ class LightsparkClient {
|
|
|
117
119
|
* @param authProvider
|
|
118
120
|
*/
|
|
119
121
|
public async setAuthProvider(authProvider: AuthProvider) {
|
|
122
|
+
const sdkVersion = require("../package.json").version;
|
|
120
123
|
this.requester = new Requester(
|
|
121
124
|
this.nodeKeyCache,
|
|
122
|
-
|
|
125
|
+
LIGHTSPARK_SDK_ENDPOINT,
|
|
126
|
+
`js-lightspark-sdk/${sdkVersion}`,
|
|
123
127
|
authProvider,
|
|
124
128
|
this.serverUrl
|
|
125
129
|
);
|
|
@@ -753,6 +757,6 @@ class LightsparkClient {
|
|
|
753
757
|
}
|
|
754
758
|
}
|
|
755
759
|
|
|
756
|
-
const
|
|
760
|
+
const LIGHTSPARK_SDK_ENDPOINT = "graphql/server/2023-04-04";
|
|
757
761
|
|
|
758
762
|
export default LightsparkClient;
|
package/src/objects/Account.ts
CHANGED
|
@@ -18,6 +18,9 @@ import AccountToPaymentRequestsConnection, {
|
|
|
18
18
|
import AccountToTransactionsConnection, {
|
|
19
19
|
AccountToTransactionsConnectionFromJson,
|
|
20
20
|
} from "./AccountToTransactionsConnection.js";
|
|
21
|
+
import AccountToWalletsConnection, {
|
|
22
|
+
AccountToWalletsConnectionFromJson,
|
|
23
|
+
} from "./AccountToWalletsConnection.js";
|
|
21
24
|
import BitcoinNetwork from "./BitcoinNetwork.js";
|
|
22
25
|
import BlockchainBalance, {
|
|
23
26
|
BlockchainBalanceFromJson,
|
|
@@ -1181,6 +1184,73 @@ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $afte
|
|
|
1181
1184
|
}))!;
|
|
1182
1185
|
}
|
|
1183
1186
|
|
|
1187
|
+
public async getWallets(
|
|
1188
|
+
client: LightsparkClient,
|
|
1189
|
+
first: number | undefined = undefined
|
|
1190
|
+
): Promise<AccountToWalletsConnection> {
|
|
1191
|
+
return (await client.executeRawQuery({
|
|
1192
|
+
queryPayload: `
|
|
1193
|
+
query FetchAccountToWalletsConnection($first: Int) {
|
|
1194
|
+
current_account {
|
|
1195
|
+
... on Account {
|
|
1196
|
+
wallets(, first: $first) {
|
|
1197
|
+
__typename
|
|
1198
|
+
account_to_wallets_connection_page_info: page_info {
|
|
1199
|
+
__typename
|
|
1200
|
+
page_info_has_next_page: has_next_page
|
|
1201
|
+
page_info_has_previous_page: has_previous_page
|
|
1202
|
+
page_info_start_cursor: start_cursor
|
|
1203
|
+
page_info_end_cursor: end_cursor
|
|
1204
|
+
}
|
|
1205
|
+
account_to_wallets_connection_count: count
|
|
1206
|
+
account_to_wallets_connection_entities: entities {
|
|
1207
|
+
__typename
|
|
1208
|
+
wallet_id: id
|
|
1209
|
+
wallet_created_at: created_at
|
|
1210
|
+
wallet_updated_at: updated_at
|
|
1211
|
+
wallet_last_login_at: last_login_at
|
|
1212
|
+
wallet_balances: balances {
|
|
1213
|
+
__typename
|
|
1214
|
+
balances_owned_balance: owned_balance {
|
|
1215
|
+
__typename
|
|
1216
|
+
currency_amount_original_value: original_value
|
|
1217
|
+
currency_amount_original_unit: original_unit
|
|
1218
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
1219
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
1220
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
1221
|
+
}
|
|
1222
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
1223
|
+
__typename
|
|
1224
|
+
currency_amount_original_value: original_value
|
|
1225
|
+
currency_amount_original_unit: original_unit
|
|
1226
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
1227
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
1228
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
1229
|
+
}
|
|
1230
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
1231
|
+
__typename
|
|
1232
|
+
currency_amount_original_value: original_value
|
|
1233
|
+
currency_amount_original_unit: original_unit
|
|
1234
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
1235
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
1236
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
wallet_third_party_identifier: third_party_identifier
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
`,
|
|
1246
|
+
variables: { first: first },
|
|
1247
|
+
constructObject: (json) => {
|
|
1248
|
+
const connection = json["current_account"]["wallets"];
|
|
1249
|
+
return AccountToWalletsConnectionFromJson(connection);
|
|
1250
|
+
},
|
|
1251
|
+
}))!;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1184
1254
|
static getAccountQuery(): Query<Account> {
|
|
1185
1255
|
return {
|
|
1186
1256
|
queryPayload: `
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import PageInfo, { PageInfoFromJson } from "./PageInfo.js";
|
|
4
|
+
import Wallet, { WalletFromJson } from "./Wallet.js";
|
|
5
|
+
|
|
6
|
+
type AccountToWalletsConnection = {
|
|
7
|
+
/** An object that holds pagination information about the objects in this connection. **/
|
|
8
|
+
pageInfo: PageInfo;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The total count of objects in this connection, using the current filters. It is different from the
|
|
12
|
+
* number of objects returned in the current page (in the `entities` field).
|
|
13
|
+
**/
|
|
14
|
+
count: number;
|
|
15
|
+
|
|
16
|
+
/** The wallets for the current page of this connection. **/
|
|
17
|
+
entities: Wallet[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const AccountToWalletsConnectionFromJson = (
|
|
21
|
+
obj: any
|
|
22
|
+
): AccountToWalletsConnection => {
|
|
23
|
+
return {
|
|
24
|
+
pageInfo: PageInfoFromJson(obj["account_to_wallets_connection_page_info"]),
|
|
25
|
+
count: obj["account_to_wallets_connection_count"],
|
|
26
|
+
entities: obj["account_to_wallets_connection_entities"].map((e) =>
|
|
27
|
+
WalletFromJson(e)
|
|
28
|
+
),
|
|
29
|
+
} as AccountToWalletsConnection;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const FRAGMENT = `
|
|
33
|
+
fragment AccountToWalletsConnectionFragment on AccountToWalletsConnection {
|
|
34
|
+
__typename
|
|
35
|
+
account_to_wallets_connection_page_info: page_info {
|
|
36
|
+
__typename
|
|
37
|
+
page_info_has_next_page: has_next_page
|
|
38
|
+
page_info_has_previous_page: has_previous_page
|
|
39
|
+
page_info_start_cursor: start_cursor
|
|
40
|
+
page_info_end_cursor: end_cursor
|
|
41
|
+
}
|
|
42
|
+
account_to_wallets_connection_count: count
|
|
43
|
+
account_to_wallets_connection_entities: entities {
|
|
44
|
+
id
|
|
45
|
+
}
|
|
46
|
+
}`;
|
|
47
|
+
|
|
48
|
+
export default AccountToWalletsConnection;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
2
|
+
|
|
3
|
+
import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
|
|
4
|
+
|
|
5
|
+
type Balances = {
|
|
6
|
+
/**
|
|
7
|
+
* This represents the balance that should be displayed when asked "how much do I own right now?". It
|
|
8
|
+
* represents the amount currently owned, including things that may not be owned soon (e.g. in-flight
|
|
9
|
+
* outgoing payments, in-flight withdrawals, commit fees, etc.). It really is a snapshot of what is
|
|
10
|
+
* officially owned at this instant.
|
|
11
|
+
**/
|
|
12
|
+
ownedBalance: CurrencyAmount;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This represents the balance that should be displayed when asked "how much can I send on Lightning
|
|
16
|
+
* right now?". It represents the amount currently available to be sent on the Lightning network. We
|
|
17
|
+
* remove from the balance all the funds that are temporarily locked (e.g. channel reserves).
|
|
18
|
+
**/
|
|
19
|
+
availableToSendBalance: CurrencyAmount;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* This represents the balance that should be displayed when asked "how much money can I withdraw on
|
|
23
|
+
* the Bitcoin network right now?". It represents the amount currently available to withdraw and is
|
|
24
|
+
* usually equal to the `owned_balance` but it does not include in-flight operations (which would
|
|
25
|
+
* likely succeed and therefore likely make your withdrawal fail).
|
|
26
|
+
**/
|
|
27
|
+
availableToWithdrawBalance: CurrencyAmount;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const BalancesFromJson = (obj: any): Balances => {
|
|
31
|
+
return {
|
|
32
|
+
ownedBalance: CurrencyAmountFromJson(obj["balances_owned_balance"]),
|
|
33
|
+
availableToSendBalance: CurrencyAmountFromJson(
|
|
34
|
+
obj["balances_available_to_send_balance"]
|
|
35
|
+
),
|
|
36
|
+
availableToWithdrawBalance: CurrencyAmountFromJson(
|
|
37
|
+
obj["balances_available_to_withdraw_balance"]
|
|
38
|
+
),
|
|
39
|
+
} as Balances;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const FRAGMENT = `
|
|
43
|
+
fragment BalancesFragment on Balances {
|
|
44
|
+
__typename
|
|
45
|
+
balances_owned_balance: owned_balance {
|
|
46
|
+
__typename
|
|
47
|
+
currency_amount_original_value: original_value
|
|
48
|
+
currency_amount_original_unit: original_unit
|
|
49
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
50
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
51
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
52
|
+
}
|
|
53
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
54
|
+
__typename
|
|
55
|
+
currency_amount_original_value: original_value
|
|
56
|
+
currency_amount_original_unit: original_unit
|
|
57
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
58
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
59
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
60
|
+
}
|
|
61
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
62
|
+
__typename
|
|
63
|
+
currency_amount_original_value: original_value
|
|
64
|
+
currency_amount_original_unit: original_unit
|
|
65
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
66
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
67
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
68
|
+
}
|
|
69
|
+
}`;
|
|
70
|
+
|
|
71
|
+
export default Balances;
|
package/src/objects/Entity.ts
CHANGED
|
@@ -810,6 +810,41 @@ fragment EntityFragment on Entity {
|
|
|
810
810
|
}
|
|
811
811
|
routing_transaction_failure_reason: failure_reason
|
|
812
812
|
}
|
|
813
|
+
... on Wallet {
|
|
814
|
+
__typename
|
|
815
|
+
wallet_id: id
|
|
816
|
+
wallet_created_at: created_at
|
|
817
|
+
wallet_updated_at: updated_at
|
|
818
|
+
wallet_last_login_at: last_login_at
|
|
819
|
+
wallet_balances: balances {
|
|
820
|
+
__typename
|
|
821
|
+
balances_owned_balance: owned_balance {
|
|
822
|
+
__typename
|
|
823
|
+
currency_amount_original_value: original_value
|
|
824
|
+
currency_amount_original_unit: original_unit
|
|
825
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
826
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
827
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
828
|
+
}
|
|
829
|
+
balances_available_to_send_balance: available_to_send_balance {
|
|
830
|
+
__typename
|
|
831
|
+
currency_amount_original_value: original_value
|
|
832
|
+
currency_amount_original_unit: original_unit
|
|
833
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
834
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
835
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
836
|
+
}
|
|
837
|
+
balances_available_to_withdraw_balance: available_to_withdraw_balance {
|
|
838
|
+
__typename
|
|
839
|
+
currency_amount_original_value: original_value
|
|
840
|
+
currency_amount_original_unit: original_unit
|
|
841
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
842
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
843
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
wallet_third_party_identifier: third_party_identifier
|
|
847
|
+
}
|
|
813
848
|
... on Withdrawal {
|
|
814
849
|
__typename
|
|
815
850
|
withdrawal_id: id
|