@spacesops/pear-wrk-wdk 1.0.0-beta.17 → 1.0.0-beta.18
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/package.json +1 -1
- package/spec/hrpc/hrpc.json +14 -1
- package/spec/hrpc/index.d.ts +2 -0
- package/spec/hrpc/index.js +15 -3
- package/spec/hrpc/messages.js +96 -2
- package/spec/schema/index.js +96 -2
- package/spec/schema/schema.json +78 -1
- package/src/schema/schema.js +35 -0
- package/src/wdk-core/wdk-manager.d.ts +11 -1
- package/src/wdk-core/wdk-manager.js +23 -0
- package/src/wdk-worklet.js +15 -0
- package/src/worklet.mjs +15 -0
- package/types/spec/hrpc/index.d.ts +2 -0
- package/types/src/wdk-core/wdk-manager.d.ts +11 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spacesops/pear-wrk-wdk",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.18",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:types": "find . -name '*.d.ts' -not -path './node_modules/*' -not -path './types/*' -not -path './bundle/*' -delete && tsc",
|
package/spec/hrpc/hrpc.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version":
|
|
2
|
+
"version": 4,
|
|
3
3
|
"schema": [
|
|
4
4
|
{
|
|
5
5
|
"id": 0,
|
|
@@ -213,6 +213,19 @@
|
|
|
213
213
|
"stream": false
|
|
214
214
|
},
|
|
215
215
|
"version": 3
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"id": 6,
|
|
219
|
+
"name": "@wdk-core/quoteSendTransactionWithMemoTX",
|
|
220
|
+
"request": {
|
|
221
|
+
"name": "@wdk-core/quoteSendTransactionWithMemoTX-request",
|
|
222
|
+
"stream": false
|
|
223
|
+
},
|
|
224
|
+
"response": {
|
|
225
|
+
"name": "@wdk-core/quoteSendTransactionWithMemoTX-response",
|
|
226
|
+
"stream": false
|
|
227
|
+
},
|
|
228
|
+
"version": 4
|
|
216
229
|
}
|
|
217
230
|
]
|
|
218
231
|
}
|
package/spec/hrpc/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ declare class HRPC {
|
|
|
32
32
|
getTransactionReceipt(args: any): Promise<any>;
|
|
33
33
|
dispose(args: any): any;
|
|
34
34
|
quoteSendTransactionWithMemo(args: any): Promise<any>;
|
|
35
|
+
quoteSendTransactionWithMemoTX(args: any): Promise<any>;
|
|
35
36
|
sendTransactionWithMemo(args: any): Promise<any>;
|
|
36
37
|
onLog(responseFn: any): void;
|
|
37
38
|
onWorkletStart(responseFn: any): void;
|
|
@@ -49,6 +50,7 @@ declare class HRPC {
|
|
|
49
50
|
onGetTransactionReceipt(responseFn: any): void;
|
|
50
51
|
onDispose(responseFn: any): void;
|
|
51
52
|
onQuoteSendTransactionWithMemo(responseFn: any): void;
|
|
53
|
+
onQuoteSendTransactionWithMemoTX(responseFn: any): void;
|
|
52
54
|
onSendTransactionWithMemo(responseFn: any): void;
|
|
53
55
|
_requestIsStream(command: any): boolean;
|
|
54
56
|
_responseIsStream(command: any): boolean;
|
package/spec/hrpc/index.js
CHANGED
|
@@ -38,7 +38,9 @@ const methods = new Map([
|
|
|
38
38
|
['@wdk-core/quoteSendTransactionWithMemo', 15],
|
|
39
39
|
[15, '@wdk-core/quoteSendTransactionWithMemo'],
|
|
40
40
|
['@wdk-core/sendTransactionWithMemo', 16],
|
|
41
|
-
[16, '@wdk-core/sendTransactionWithMemo']
|
|
41
|
+
[16, '@wdk-core/sendTransactionWithMemo'],
|
|
42
|
+
['@wdk-core/quoteSendTransactionWithMemoTX', 17],
|
|
43
|
+
[17, '@wdk-core/quoteSendTransactionWithMemoTX']
|
|
42
44
|
])
|
|
43
45
|
|
|
44
46
|
class HRPC {
|
|
@@ -62,7 +64,8 @@ class HRPC {
|
|
|
62
64
|
['@wdk-core/getTransactionReceipt', getEncoding('@wdk-core/getTransactionReceipt-request')],
|
|
63
65
|
['@wdk-core/dispose', getEncoding('@wdk-core/dispose-request')],
|
|
64
66
|
['@wdk-core/quoteSendTransactionWithMemo', getEncoding('@wdk-core/quoteSendTransactionWithMemo-request')],
|
|
65
|
-
['@wdk-core/sendTransactionWithMemo', getEncoding('@wdk-core/sendTransactionWithMemo-request')]
|
|
67
|
+
['@wdk-core/sendTransactionWithMemo', getEncoding('@wdk-core/sendTransactionWithMemo-request')],
|
|
68
|
+
['@wdk-core/quoteSendTransactionWithMemoTX', getEncoding('@wdk-core/quoteSendTransactionWithMemoTX-request')]
|
|
66
69
|
])
|
|
67
70
|
this._responseEncodings = new Map([
|
|
68
71
|
['@wdk-core/workletStart', getEncoding('@wdk-core/workletStart-response')],
|
|
@@ -79,7 +82,8 @@ class HRPC {
|
|
|
79
82
|
['@wdk-core/abstractedAccountQuoteTransfer', getEncoding('@wdk-core/abstractedAccountQuoteTransfer-response')],
|
|
80
83
|
['@wdk-core/getTransactionReceipt', getEncoding('@wdk-core/getTransactionReceipt-response')],
|
|
81
84
|
['@wdk-core/quoteSendTransactionWithMemo', getEncoding('@wdk-core/quoteSendTransactionWithMemo-response')],
|
|
82
|
-
['@wdk-core/sendTransactionWithMemo', getEncoding('@wdk-core/sendTransactionWithMemo-response')]
|
|
85
|
+
['@wdk-core/sendTransactionWithMemo', getEncoding('@wdk-core/sendTransactionWithMemo-response')],
|
|
86
|
+
['@wdk-core/quoteSendTransactionWithMemoTX', getEncoding('@wdk-core/quoteSendTransactionWithMemoTX-response')]
|
|
83
87
|
])
|
|
84
88
|
this._rpc = new RPC(stream, async (req) => {
|
|
85
89
|
const command = methods.get(req.command)
|
|
@@ -211,6 +215,10 @@ class HRPC {
|
|
|
211
215
|
return this._call('@wdk-core/sendTransactionWithMemo', args)
|
|
212
216
|
}
|
|
213
217
|
|
|
218
|
+
async quoteSendTransactionWithMemoTX (args) {
|
|
219
|
+
return this._call('@wdk-core/quoteSendTransactionWithMemoTX', args)
|
|
220
|
+
}
|
|
221
|
+
|
|
214
222
|
onLog (responseFn) {
|
|
215
223
|
this._handlers['@wdk-core/log'] = responseFn
|
|
216
224
|
}
|
|
@@ -279,6 +287,10 @@ class HRPC {
|
|
|
279
287
|
this._handlers['@wdk-core/sendTransactionWithMemo'] = responseFn
|
|
280
288
|
}
|
|
281
289
|
|
|
290
|
+
onQuoteSendTransactionWithMemoTX (responseFn) {
|
|
291
|
+
this._handlers['@wdk-core/quoteSendTransactionWithMemoTX'] = responseFn
|
|
292
|
+
}
|
|
293
|
+
|
|
282
294
|
_requestIsStream (command) {
|
|
283
295
|
return [
|
|
284
296
|
].includes(command)
|
package/spec/hrpc/messages.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// This file is autogenerated by the hyperschema compiler
|
|
2
|
-
// Schema Version:
|
|
2
|
+
// Schema Version: 4
|
|
3
3
|
/* eslint-disable camelcase */
|
|
4
4
|
/* eslint-disable quotes */
|
|
5
5
|
|
|
6
6
|
const { c } = require('hyperschema/runtime')
|
|
7
7
|
|
|
8
|
-
const VERSION =
|
|
8
|
+
const VERSION = 4
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line no-unused-vars
|
|
11
11
|
let version = VERSION
|
|
@@ -863,6 +863,97 @@ const encoding44 = {
|
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
|
|
866
|
+
// @wdk-core/quoteSendTransactionWithMemoTX-request-options
|
|
867
|
+
const encoding45 = {
|
|
868
|
+
preencode (state, m) {
|
|
869
|
+
c.string.preencode(state, m.to)
|
|
870
|
+
c.string.preencode(state, m.value)
|
|
871
|
+
c.string.preencode(state, m.memo)
|
|
872
|
+
state.end++ // max flag is 2 so always one byte
|
|
873
|
+
|
|
874
|
+
if (version >= 4 && m.feeRate) c.string.preencode(state, m.feeRate)
|
|
875
|
+
if (version >= 4 && m.confirmationTarget) c.uint.preencode(state, m.confirmationTarget)
|
|
876
|
+
},
|
|
877
|
+
encode (state, m) {
|
|
878
|
+
const flags =
|
|
879
|
+
((version >= 4 && m.feeRate) ? 1 : 0) |
|
|
880
|
+
((version >= 4 && m.confirmationTarget) ? 2 : 0)
|
|
881
|
+
|
|
882
|
+
c.string.encode(state, m.to)
|
|
883
|
+
c.string.encode(state, m.value)
|
|
884
|
+
c.string.encode(state, m.memo)
|
|
885
|
+
c.uint.encode(state, flags)
|
|
886
|
+
|
|
887
|
+
if (version >= 4 && m.feeRate) c.string.encode(state, m.feeRate)
|
|
888
|
+
if (version >= 4 && m.confirmationTarget) c.uint.encode(state, m.confirmationTarget)
|
|
889
|
+
},
|
|
890
|
+
decode (state) {
|
|
891
|
+
const r0 = c.string.decode(state)
|
|
892
|
+
const r1 = c.string.decode(state)
|
|
893
|
+
const r2 = c.string.decode(state)
|
|
894
|
+
const flags = c.uint.decode(state)
|
|
895
|
+
|
|
896
|
+
return {
|
|
897
|
+
to: r0,
|
|
898
|
+
value: r1,
|
|
899
|
+
memo: r2,
|
|
900
|
+
feeRate: (version >= 4 && (flags & 1) !== 0) ? c.string.decode(state) : null,
|
|
901
|
+
confirmationTarget: (version >= 4 && (flags & 2) !== 0) ? c.uint.decode(state) : 0
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
// @wdk-core/quoteSendTransactionWithMemoTX-request.options
|
|
907
|
+
const encoding46_2 = c.frame(encoding45)
|
|
908
|
+
|
|
909
|
+
// @wdk-core/quoteSendTransactionWithMemoTX-request
|
|
910
|
+
const encoding46 = {
|
|
911
|
+
preencode (state, m) {
|
|
912
|
+
c.string.preencode(state, m.network)
|
|
913
|
+
c.uint.preencode(state, m.accountIndex)
|
|
914
|
+
encoding46_2.preencode(state, m.options)
|
|
915
|
+
},
|
|
916
|
+
encode (state, m) {
|
|
917
|
+
c.string.encode(state, m.network)
|
|
918
|
+
c.uint.encode(state, m.accountIndex)
|
|
919
|
+
encoding46_2.encode(state, m.options)
|
|
920
|
+
},
|
|
921
|
+
decode (state) {
|
|
922
|
+
const r0 = c.string.decode(state)
|
|
923
|
+
const r1 = c.uint.decode(state)
|
|
924
|
+
const r2 = encoding46_2.decode(state)
|
|
925
|
+
|
|
926
|
+
return {
|
|
927
|
+
network: r0,
|
|
928
|
+
accountIndex: r1,
|
|
929
|
+
options: r2
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
// @wdk-core/quoteSendTransactionWithMemoTX-response
|
|
935
|
+
const encoding47 = {
|
|
936
|
+
preencode (state, m) {
|
|
937
|
+
state.end++ // max flag is 1 so always one byte
|
|
938
|
+
|
|
939
|
+
if (version >= 4 && m.txHex) c.string.preencode(state, m.txHex)
|
|
940
|
+
},
|
|
941
|
+
encode (state, m) {
|
|
942
|
+
const flags = (version >= 4 && m.txHex) ? 1 : 0
|
|
943
|
+
|
|
944
|
+
c.uint.encode(state, flags)
|
|
945
|
+
|
|
946
|
+
if (version >= 4 && m.txHex) c.string.encode(state, m.txHex)
|
|
947
|
+
},
|
|
948
|
+
decode (state) {
|
|
949
|
+
const flags = c.uint.decode(state)
|
|
950
|
+
|
|
951
|
+
return {
|
|
952
|
+
txHex: (version >= 4 && (flags & 1) !== 0) ? c.string.decode(state) : null
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
|
|
866
957
|
function setVersion (v) {
|
|
867
958
|
version = v
|
|
868
959
|
}
|
|
@@ -931,6 +1022,9 @@ function getEncoding (name) {
|
|
|
931
1022
|
case '@wdk-core/sendTransactionWithMemo-request-options': return encoding42
|
|
932
1023
|
case '@wdk-core/sendTransactionWithMemo-request': return encoding43
|
|
933
1024
|
case '@wdk-core/sendTransactionWithMemo-response': return encoding44
|
|
1025
|
+
case '@wdk-core/quoteSendTransactionWithMemoTX-request-options': return encoding45
|
|
1026
|
+
case '@wdk-core/quoteSendTransactionWithMemoTX-request': return encoding46
|
|
1027
|
+
case '@wdk-core/quoteSendTransactionWithMemoTX-response': return encoding47
|
|
934
1028
|
default: throw new Error('Encoder not found ' + name)
|
|
935
1029
|
}
|
|
936
1030
|
}
|
package/spec/schema/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// This file is autogenerated by the hyperschema compiler
|
|
2
|
-
// Schema Version:
|
|
2
|
+
// Schema Version: 4
|
|
3
3
|
/* eslint-disable camelcase */
|
|
4
4
|
/* eslint-disable quotes */
|
|
5
5
|
|
|
6
6
|
const { c } = require('hyperschema/runtime')
|
|
7
7
|
|
|
8
|
-
const VERSION =
|
|
8
|
+
const VERSION = 4
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line no-unused-vars
|
|
11
11
|
let version = VERSION
|
|
@@ -863,6 +863,97 @@ const encoding44 = {
|
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
|
|
866
|
+
// @wdk-core/quoteSendTransactionWithMemoTX-request-options
|
|
867
|
+
const encoding45 = {
|
|
868
|
+
preencode (state, m) {
|
|
869
|
+
c.string.preencode(state, m.to)
|
|
870
|
+
c.string.preencode(state, m.value)
|
|
871
|
+
c.string.preencode(state, m.memo)
|
|
872
|
+
state.end++ // max flag is 2 so always one byte
|
|
873
|
+
|
|
874
|
+
if (version >= 4 && m.feeRate) c.string.preencode(state, m.feeRate)
|
|
875
|
+
if (version >= 4 && m.confirmationTarget) c.uint.preencode(state, m.confirmationTarget)
|
|
876
|
+
},
|
|
877
|
+
encode (state, m) {
|
|
878
|
+
const flags =
|
|
879
|
+
((version >= 4 && m.feeRate) ? 1 : 0) |
|
|
880
|
+
((version >= 4 && m.confirmationTarget) ? 2 : 0)
|
|
881
|
+
|
|
882
|
+
c.string.encode(state, m.to)
|
|
883
|
+
c.string.encode(state, m.value)
|
|
884
|
+
c.string.encode(state, m.memo)
|
|
885
|
+
c.uint.encode(state, flags)
|
|
886
|
+
|
|
887
|
+
if (version >= 4 && m.feeRate) c.string.encode(state, m.feeRate)
|
|
888
|
+
if (version >= 4 && m.confirmationTarget) c.uint.encode(state, m.confirmationTarget)
|
|
889
|
+
},
|
|
890
|
+
decode (state) {
|
|
891
|
+
const r0 = c.string.decode(state)
|
|
892
|
+
const r1 = c.string.decode(state)
|
|
893
|
+
const r2 = c.string.decode(state)
|
|
894
|
+
const flags = c.uint.decode(state)
|
|
895
|
+
|
|
896
|
+
return {
|
|
897
|
+
to: r0,
|
|
898
|
+
value: r1,
|
|
899
|
+
memo: r2,
|
|
900
|
+
feeRate: (version >= 4 && (flags & 1) !== 0) ? c.string.decode(state) : null,
|
|
901
|
+
confirmationTarget: (version >= 4 && (flags & 2) !== 0) ? c.uint.decode(state) : 0
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
// @wdk-core/quoteSendTransactionWithMemoTX-request.options
|
|
907
|
+
const encoding46_2 = c.frame(encoding45)
|
|
908
|
+
|
|
909
|
+
// @wdk-core/quoteSendTransactionWithMemoTX-request
|
|
910
|
+
const encoding46 = {
|
|
911
|
+
preencode (state, m) {
|
|
912
|
+
c.string.preencode(state, m.network)
|
|
913
|
+
c.uint.preencode(state, m.accountIndex)
|
|
914
|
+
encoding46_2.preencode(state, m.options)
|
|
915
|
+
},
|
|
916
|
+
encode (state, m) {
|
|
917
|
+
c.string.encode(state, m.network)
|
|
918
|
+
c.uint.encode(state, m.accountIndex)
|
|
919
|
+
encoding46_2.encode(state, m.options)
|
|
920
|
+
},
|
|
921
|
+
decode (state) {
|
|
922
|
+
const r0 = c.string.decode(state)
|
|
923
|
+
const r1 = c.uint.decode(state)
|
|
924
|
+
const r2 = encoding46_2.decode(state)
|
|
925
|
+
|
|
926
|
+
return {
|
|
927
|
+
network: r0,
|
|
928
|
+
accountIndex: r1,
|
|
929
|
+
options: r2
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
// @wdk-core/quoteSendTransactionWithMemoTX-response
|
|
935
|
+
const encoding47 = {
|
|
936
|
+
preencode (state, m) {
|
|
937
|
+
state.end++ // max flag is 1 so always one byte
|
|
938
|
+
|
|
939
|
+
if (version >= 4 && m.txHex) c.string.preencode(state, m.txHex)
|
|
940
|
+
},
|
|
941
|
+
encode (state, m) {
|
|
942
|
+
const flags = (version >= 4 && m.txHex) ? 1 : 0
|
|
943
|
+
|
|
944
|
+
c.uint.encode(state, flags)
|
|
945
|
+
|
|
946
|
+
if (version >= 4 && m.txHex) c.string.encode(state, m.txHex)
|
|
947
|
+
},
|
|
948
|
+
decode (state) {
|
|
949
|
+
const flags = c.uint.decode(state)
|
|
950
|
+
|
|
951
|
+
return {
|
|
952
|
+
txHex: (version >= 4 && (flags & 1) !== 0) ? c.string.decode(state) : null
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
|
|
866
957
|
function setVersion (v) {
|
|
867
958
|
version = v
|
|
868
959
|
}
|
|
@@ -931,6 +1022,9 @@ function getEncoding (name) {
|
|
|
931
1022
|
case '@wdk-core/sendTransactionWithMemo-request-options': return encoding42
|
|
932
1023
|
case '@wdk-core/sendTransactionWithMemo-request': return encoding43
|
|
933
1024
|
case '@wdk-core/sendTransactionWithMemo-response': return encoding44
|
|
1025
|
+
case '@wdk-core/quoteSendTransactionWithMemoTX-request-options': return encoding45
|
|
1026
|
+
case '@wdk-core/quoteSendTransactionWithMemoTX-request': return encoding46
|
|
1027
|
+
case '@wdk-core/quoteSendTransactionWithMemoTX-response': return encoding47
|
|
934
1028
|
default: throw new Error('Encoder not found ' + name)
|
|
935
1029
|
}
|
|
936
1030
|
}
|
package/spec/schema/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version":
|
|
2
|
+
"version": 4,
|
|
3
3
|
"schema": [
|
|
4
4
|
{
|
|
5
5
|
"name": "log-type-enum",
|
|
@@ -890,6 +890,83 @@
|
|
|
890
890
|
"version": 3
|
|
891
891
|
}
|
|
892
892
|
]
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
"name": "quoteSendTransactionWithMemoTX-request-options",
|
|
896
|
+
"namespace": "wdk-core",
|
|
897
|
+
"compact": false,
|
|
898
|
+
"flagsPosition": 3,
|
|
899
|
+
"fields": [
|
|
900
|
+
{
|
|
901
|
+
"name": "to",
|
|
902
|
+
"required": true,
|
|
903
|
+
"type": "string",
|
|
904
|
+
"version": 4
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
"name": "value",
|
|
908
|
+
"required": true,
|
|
909
|
+
"type": "string",
|
|
910
|
+
"version": 4
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
"name": "memo",
|
|
914
|
+
"required": true,
|
|
915
|
+
"type": "string",
|
|
916
|
+
"version": 4
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
"name": "feeRate",
|
|
920
|
+
"required": false,
|
|
921
|
+
"type": "string",
|
|
922
|
+
"version": 4
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
"name": "confirmationTarget",
|
|
926
|
+
"required": false,
|
|
927
|
+
"type": "uint",
|
|
928
|
+
"version": 4
|
|
929
|
+
}
|
|
930
|
+
]
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
"name": "quoteSendTransactionWithMemoTX-request",
|
|
934
|
+
"namespace": "wdk-core",
|
|
935
|
+
"compact": false,
|
|
936
|
+
"flagsPosition": -1,
|
|
937
|
+
"fields": [
|
|
938
|
+
{
|
|
939
|
+
"name": "network",
|
|
940
|
+
"required": true,
|
|
941
|
+
"type": "string",
|
|
942
|
+
"version": 4
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
"name": "accountIndex",
|
|
946
|
+
"required": true,
|
|
947
|
+
"type": "uint",
|
|
948
|
+
"version": 4
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
"name": "options",
|
|
952
|
+
"required": true,
|
|
953
|
+
"type": "@wdk-core/quoteSendTransactionWithMemoTX-request-options",
|
|
954
|
+
"version": 4
|
|
955
|
+
}
|
|
956
|
+
]
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
"name": "quoteSendTransactionWithMemoTX-response",
|
|
960
|
+
"namespace": "wdk-core",
|
|
961
|
+
"compact": false,
|
|
962
|
+
"flagsPosition": 0,
|
|
963
|
+
"fields": [
|
|
964
|
+
{
|
|
965
|
+
"name": "txHex",
|
|
966
|
+
"type": "string",
|
|
967
|
+
"version": 4
|
|
968
|
+
}
|
|
969
|
+
]
|
|
893
970
|
}
|
|
894
971
|
]
|
|
895
972
|
}
|
package/src/schema/schema.js
CHANGED
|
@@ -130,6 +130,35 @@ schemaNs.register({
|
|
|
130
130
|
]
|
|
131
131
|
})
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* quoteSendTransactionWithMemoTX
|
|
135
|
+
*/
|
|
136
|
+
schemaNs.register({
|
|
137
|
+
name: 'quoteSendTransactionWithMemoTX-request-options',
|
|
138
|
+
fields: [
|
|
139
|
+
{ name: 'to', type: 'string', required: true },
|
|
140
|
+
{ name: 'value', type: 'string', required: true },
|
|
141
|
+
{ name: 'memo', type: 'string', required: true },
|
|
142
|
+
{ name: 'feeRate', type: 'string', required: false },
|
|
143
|
+
{ name: 'confirmationTarget', type: 'uint', required: false }
|
|
144
|
+
]
|
|
145
|
+
})
|
|
146
|
+
schemaNs.register({
|
|
147
|
+
name: 'quoteSendTransactionWithMemoTX-request',
|
|
148
|
+
fields: [
|
|
149
|
+
{ name: 'network', type: 'string', required: true },
|
|
150
|
+
{ name: 'accountIndex', type: 'uint', required: true },
|
|
151
|
+
{ name: 'options', type: '@wdk-core/quoteSendTransactionWithMemoTX-request-options', required: true }
|
|
152
|
+
]
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
schemaNs.register({
|
|
156
|
+
name: 'quoteSendTransactionWithMemoTX-response',
|
|
157
|
+
fields: [
|
|
158
|
+
{ name: 'txHex', type: 'string' }
|
|
159
|
+
]
|
|
160
|
+
})
|
|
161
|
+
|
|
133
162
|
/**
|
|
134
163
|
* sendTransaction
|
|
135
164
|
*/
|
|
@@ -443,6 +472,12 @@ ns.register({
|
|
|
443
472
|
response: { name: '@wdk-core/quoteSendTransactionWithMemo-response', stream: false }
|
|
444
473
|
})
|
|
445
474
|
|
|
475
|
+
ns.register({
|
|
476
|
+
name: 'quoteSendTransactionWithMemoTX',
|
|
477
|
+
request: { name: '@wdk-core/quoteSendTransactionWithMemoTX-request', stream: false },
|
|
478
|
+
response: { name: '@wdk-core/quoteSendTransactionWithMemoTX-response', stream: false }
|
|
479
|
+
})
|
|
480
|
+
|
|
446
481
|
ns.register({
|
|
447
482
|
name: 'sendTransaction',
|
|
448
483
|
request: { name: '@wdk-core/sendTransaction-request', stream: false },
|
|
@@ -219,7 +219,17 @@ export class WdkManager {
|
|
|
219
219
|
*/
|
|
220
220
|
quoteSendTransactionWithMemo(blockchain: Blockchain, accountIndex: number, options: Transaction): Promise<Omit<TransactionResult, "hash">>;
|
|
221
221
|
/**
|
|
222
|
-
|
|
222
|
+
* Quotes a transaction with memo and returns the raw transaction hex for Bitcoin blockchain.
|
|
223
|
+
*
|
|
224
|
+
* @param {Blockchain} blockchain - A blockchain identifier (must be "bitcoin").
|
|
225
|
+
* @param {number} accountIndex - The index of the account to use (see [BIP-44](https://en.bitcoin.it/wiki/BIP_0044)).
|
|
226
|
+
* @param {Transaction} options - The transaction options including memo.
|
|
227
|
+
* @returns {Promise<string>} The raw hexadecimal string of the transaction.
|
|
228
|
+
* @throws {Error} If blockchain is not Bitcoin.
|
|
229
|
+
*/
|
|
230
|
+
quoteSendTransactionWithMemoTX(blockchain: Blockchain, accountIndex: number, options: Transaction): Promise<string>;
|
|
231
|
+
/**
|
|
232
|
+
* Transfers a token to another address.
|
|
223
233
|
*
|
|
224
234
|
* @param {Blockchain} blockchain - A blockchain identifier (e.g., "ethereum").
|
|
225
235
|
* @param {number} accountIndex - The index of the account to use (see [BIP-44](https://en.bitcoin.it/wiki/BIP_0044)).
|
|
@@ -282,6 +282,29 @@ class WdkManager {
|
|
|
282
282
|
return await account.quoteSendTransactionWithMemo(options)
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
+
/**
|
|
286
|
+
* Quotes a transaction with memo and returns the raw transaction hex for Bitcoin blockchain.
|
|
287
|
+
*
|
|
288
|
+
* @param {Blockchain} blockchain - A blockchain identifier (must be "bitcoin").
|
|
289
|
+
* @param {number} accountIndex - The index of the account to use (see [BIP-44](https://en.bitcoin.it/wiki/BIP_0044)).
|
|
290
|
+
* @param {Transaction} options - The transaction options including memo.
|
|
291
|
+
* @returns {Promise<string>} The raw hexadecimal string of the transaction.
|
|
292
|
+
* @throws {Error} If blockchain is not Bitcoin.
|
|
293
|
+
*/
|
|
294
|
+
async quoteSendTransactionWithMemoTX (blockchain, accountIndex, options) {
|
|
295
|
+
if (blockchain !== Blockchain.Bitcoin) {
|
|
296
|
+
throw new Error(`quoteSendTransactionWithMemoTX is only supported for Bitcoin blockchain. Received: ${blockchain}`)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const account = await this.getAccount(blockchain, accountIndex)
|
|
300
|
+
|
|
301
|
+
if (typeof account.quoteSendTransactionWithMemoTX !== 'function') {
|
|
302
|
+
throw new Error('quoteSendTransactionWithMemoTX is not supported by this account')
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return await account.quoteSendTransactionWithMemoTX(options)
|
|
306
|
+
}
|
|
307
|
+
|
|
285
308
|
/**
|
|
286
309
|
* Transfers a token to another address.
|
|
287
310
|
*
|
package/src/wdk-worklet.js
CHANGED
|
@@ -61,6 +61,21 @@ rpc.onQuoteSendTransactionWithMemo(async payload => {
|
|
|
61
61
|
}
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
+
rpc.onQuoteSendTransactionWithMemoTX(async payload => {
|
|
65
|
+
try {
|
|
66
|
+
// Convert amount value to number
|
|
67
|
+
payload.options.value = Number(payload.options.value)
|
|
68
|
+
// Convert feeRate to number if provided
|
|
69
|
+
if (payload.options.feeRate !== undefined) {
|
|
70
|
+
payload.options.feeRate = Number(payload.options.feeRate)
|
|
71
|
+
}
|
|
72
|
+
const txHex = await wdk.quoteSendTransactionWithMemoTX(payload.network, payload.accountIndex, payload.options)
|
|
73
|
+
return { txHex }
|
|
74
|
+
} catch (error) {
|
|
75
|
+
throw new Error(rpcException.stringifyError(error))
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
|
|
64
79
|
rpc.onSendTransaction(async payload => {
|
|
65
80
|
try {
|
|
66
81
|
payload.options.value = Number(payload.options.value)
|
package/src/worklet.mjs
CHANGED
|
@@ -61,6 +61,21 @@ rpc.onQuoteSendTransactionWithMemo(async payload => {
|
|
|
61
61
|
}
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
+
rpc.onQuoteSendTransactionWithMemoTX(async payload => {
|
|
65
|
+
try {
|
|
66
|
+
// Convert amount value to number
|
|
67
|
+
payload.options.value = Number(payload.options.value)
|
|
68
|
+
// Convert feeRate to number if provided
|
|
69
|
+
if (payload.options.feeRate !== undefined) {
|
|
70
|
+
payload.options.feeRate = Number(payload.options.feeRate)
|
|
71
|
+
}
|
|
72
|
+
const txHex = await wdk.quoteSendTransactionWithMemoTX(payload.network, payload.accountIndex, payload.options)
|
|
73
|
+
return { txHex }
|
|
74
|
+
} catch (error) {
|
|
75
|
+
throw new Error(stringifyError(error))
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
|
|
64
79
|
rpc.onSendTransaction(async payload => {
|
|
65
80
|
try {
|
|
66
81
|
payload.options.value = Number(payload.options.value)
|
|
@@ -22,6 +22,7 @@ declare class HRPC {
|
|
|
22
22
|
getAddressBalance(args: any): Promise<any>;
|
|
23
23
|
quoteSendTransaction(args: any): Promise<any>;
|
|
24
24
|
quoteSendTransactionWithMemo(args: any): Promise<any>;
|
|
25
|
+
quoteSendTransactionWithMemoTX(args: any): Promise<any>;
|
|
25
26
|
sendTransaction(args: any): Promise<any>;
|
|
26
27
|
sendTransactionWithMemo(args: any): Promise<any>;
|
|
27
28
|
getAbstractedAddress(args: any): Promise<any>;
|
|
@@ -39,6 +40,7 @@ declare class HRPC {
|
|
|
39
40
|
onGetAddressBalance(responseFn: any): void;
|
|
40
41
|
onQuoteSendTransaction(responseFn: any): void;
|
|
41
42
|
onQuoteSendTransactionWithMemo(responseFn: any): void;
|
|
43
|
+
onQuoteSendTransactionWithMemoTX(responseFn: any): void;
|
|
42
44
|
onSendTransaction(responseFn: any): void;
|
|
43
45
|
onSendTransactionWithMemo(responseFn: any): void;
|
|
44
46
|
onGetAbstractedAddress(responseFn: any): void;
|
|
@@ -122,7 +122,17 @@ export default class WdkManager {
|
|
|
122
122
|
*/
|
|
123
123
|
quoteSendTransactionWithMemo(blockchain: Blockchain, accountIndex: number, options: Transaction): Promise<Omit<TransactionResult, "hash">>;
|
|
124
124
|
/**
|
|
125
|
-
|
|
125
|
+
* Quotes a transaction with memo and returns the raw transaction hex for Bitcoin blockchain.
|
|
126
|
+
*
|
|
127
|
+
* @param {Blockchain} blockchain - A blockchain identifier (must be "bitcoin").
|
|
128
|
+
* @param {number} accountIndex - The index of the account to use (see [BIP-44](https://en.bitcoin.it/wiki/BIP_0044)).
|
|
129
|
+
* @param {Transaction} options - The transaction options including memo.
|
|
130
|
+
* @returns {Promise<string>} The raw hexadecimal string of the transaction.
|
|
131
|
+
* @throws {Error} If blockchain is not Bitcoin.
|
|
132
|
+
*/
|
|
133
|
+
quoteSendTransactionWithMemoTX(blockchain: Blockchain, accountIndex: number, options: Transaction): Promise<string>;
|
|
134
|
+
/**
|
|
135
|
+
* Transfers a token to another address.
|
|
126
136
|
*
|
|
127
137
|
* @param {Blockchain} blockchain - A blockchain identifier (e.g., "ethereum").
|
|
128
138
|
* @param {number} accountIndex - The index of the account to use (see [BIP-44](https://en.bitcoin.it/wiki/BIP_0044)).
|