@0xsequence/relayer 2.3.39 → 3.0.0-beta.10
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/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +3926 -0
- package/LICENSE +0 -17
- package/README.md +1 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/preconditions/codec.d.ts +12 -0
- package/dist/preconditions/codec.d.ts.map +1 -0
- package/dist/preconditions/codec.js +125 -0
- package/dist/preconditions/index.d.ts +4 -0
- package/dist/preconditions/index.d.ts.map +1 -0
- package/dist/preconditions/index.js +3 -0
- package/dist/preconditions/selectors.d.ts +7 -0
- package/dist/preconditions/selectors.d.ts.map +1 -0
- package/dist/preconditions/selectors.js +27 -0
- package/dist/preconditions/types.d.ts +70 -0
- package/dist/preconditions/types.d.ts.map +1 -0
- package/dist/preconditions/types.js +203 -0
- package/dist/relayer/index.d.ts +45 -0
- package/dist/relayer/index.d.ts.map +1 -0
- package/dist/relayer/index.js +3 -0
- package/dist/relayer/relayer.d.ts +26 -0
- package/dist/relayer/relayer.d.ts.map +1 -0
- package/dist/relayer/relayer.js +7 -0
- package/dist/relayer/rpc-relayer/index.d.ts +38 -0
- package/dist/relayer/rpc-relayer/index.d.ts.map +1 -0
- package/dist/relayer/rpc-relayer/index.js +375 -0
- package/dist/{declarations/src → relayer}/rpc-relayer/relayer.gen.d.ts +3 -2
- package/dist/relayer/rpc-relayer/relayer.gen.d.ts.map +1 -0
- package/dist/relayer/rpc-relayer/relayer.gen.js +1246 -0
- package/dist/relayer/standard/abi.d.ts +73 -0
- package/dist/relayer/standard/abi.d.ts.map +1 -0
- package/dist/relayer/standard/abi.js +10 -0
- package/dist/relayer/standard/eip6963.d.ts +31 -0
- package/dist/relayer/standard/eip6963.d.ts.map +1 -0
- package/dist/relayer/standard/eip6963.js +51 -0
- package/dist/relayer/standard/index.d.ts +5 -0
- package/dist/relayer/standard/index.d.ts.map +1 -0
- package/dist/relayer/standard/index.js +4 -0
- package/dist/relayer/standard/local.d.ts +60 -0
- package/dist/relayer/standard/local.d.ts.map +1 -0
- package/dist/relayer/standard/local.js +285 -0
- package/dist/relayer/standard/pk-relayer.d.ts +28 -0
- package/dist/relayer/standard/pk-relayer.d.ts.map +1 -0
- package/dist/relayer/standard/pk-relayer.js +112 -0
- package/dist/relayer/standard/sequence.d.ts +27 -0
- package/dist/relayer/standard/sequence.d.ts.map +1 -0
- package/dist/relayer/standard/sequence.js +84 -0
- package/package.json +28 -25
- package/src/index.ts +3 -111
- package/src/preconditions/codec.ts +190 -0
- package/src/preconditions/index.ts +3 -0
- package/src/preconditions/selectors.ts +38 -0
- package/src/preconditions/types.ts +201 -0
- package/src/relayer/index.ts +60 -0
- package/src/relayer/relayer.ts +37 -0
- package/src/relayer/rpc-relayer/index.ts +449 -0
- package/src/{rpc-relayer → relayer/rpc-relayer}/relayer.gen.ts +483 -258
- package/src/relayer/standard/abi.ts +13 -0
- package/src/relayer/standard/eip6963.ts +74 -0
- package/src/relayer/standard/index.ts +4 -0
- package/src/relayer/standard/local.ts +353 -0
- package/src/relayer/standard/pk-relayer.ts +138 -0
- package/src/relayer/standard/sequence.ts +110 -0
- package/test/preconditions/codec.test.ts +531 -0
- package/test/preconditions/preconditions.test.ts +283 -0
- package/test/preconditions/selectors.test.ts +415 -0
- package/test/preconditions/types.test.ts +443 -0
- package/test/relayer/relayer.test.ts +355 -0
- package/tsconfig.json +10 -0
- package/dist/0xsequence-relayer.cjs.d.ts +0 -2
- package/dist/0xsequence-relayer.cjs.dev.js +0 -1865
- package/dist/0xsequence-relayer.cjs.js +0 -7
- package/dist/0xsequence-relayer.cjs.prod.js +0 -1865
- package/dist/0xsequence-relayer.esm.js +0 -1852
- package/dist/declarations/src/index.d.ts +0 -42
- package/dist/declarations/src/local-relayer.d.ts +0 -35
- package/dist/declarations/src/provider-relayer.d.ts +0 -47
- package/dist/declarations/src/rpc-relayer/index.d.ts +0 -72
- package/src/local-relayer.ts +0 -125
- package/src/provider-relayer.ts +0 -284
- package/src/rpc-relayer/index.ts +0 -380
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
// sequence-relayer v0.4.1 7f8a4b83b00e0b6849c76c2ff0e23931e26b3d9f
|
|
3
3
|
// --
|
|
4
|
-
// Code generated by Webrpc-gen@v0.
|
|
4
|
+
// Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT.
|
|
5
5
|
//
|
|
6
6
|
// webrpc-gen -schema=relayer.ridl -target=typescript -client -out=./clients/relayer.gen.ts -compat
|
|
7
7
|
|
|
@@ -49,7 +49,11 @@ export interface RelayerClient {
|
|
|
49
49
|
* new, GetTransactionReceipt and WaitTransactionReceipt methods
|
|
50
50
|
* we can also accept metaTxnId and txnHash .. so can take either or.. I wonder if ERC-4337 has any convention on this?
|
|
51
51
|
*/
|
|
52
|
-
getMetaTxnReceipt(
|
|
52
|
+
getMetaTxnReceipt(
|
|
53
|
+
req: GetMetaTxnReceiptArgs,
|
|
54
|
+
headers?: object,
|
|
55
|
+
signal?: AbortSignal,
|
|
56
|
+
): Promise<GetMetaTxnReceiptReturn>
|
|
53
57
|
|
|
54
58
|
simulate(req: SimulateArgs, headers?: object, signal?: AbortSignal): Promise<SimulateReturn>
|
|
55
59
|
|
|
@@ -61,7 +65,7 @@ export interface RelayerClient {
|
|
|
61
65
|
updateMetaTxnGasLimits(
|
|
62
66
|
req: UpdateMetaTxnGasLimitsArgs,
|
|
63
67
|
headers?: object,
|
|
64
|
-
signal?: AbortSignal
|
|
68
|
+
signal?: AbortSignal,
|
|
65
69
|
): Promise<UpdateMetaTxnGasLimitsReturn>
|
|
66
70
|
|
|
67
71
|
feeTokens(headers?: object, signal?: AbortSignal): Promise<FeeTokensReturn>
|
|
@@ -74,12 +78,20 @@ export interface RelayerClient {
|
|
|
74
78
|
getMetaTxnNetworkFeeOptions(
|
|
75
79
|
req: GetMetaTxnNetworkFeeOptionsArgs,
|
|
76
80
|
headers?: object,
|
|
77
|
-
signal?: AbortSignal
|
|
81
|
+
signal?: AbortSignal,
|
|
78
82
|
): Promise<GetMetaTxnNetworkFeeOptionsReturn>
|
|
79
83
|
|
|
80
|
-
getMetaTransactions(
|
|
84
|
+
getMetaTransactions(
|
|
85
|
+
req: GetMetaTransactionsArgs,
|
|
86
|
+
headers?: object,
|
|
87
|
+
signal?: AbortSignal,
|
|
88
|
+
): Promise<GetMetaTransactionsReturn>
|
|
81
89
|
|
|
82
|
-
getTransactionCost(
|
|
90
|
+
getTransactionCost(
|
|
91
|
+
req: GetTransactionCostArgs,
|
|
92
|
+
headers?: object,
|
|
93
|
+
signal?: AbortSignal,
|
|
94
|
+
): Promise<GetTransactionCostReturn>
|
|
83
95
|
|
|
84
96
|
/**
|
|
85
97
|
* Sent transactions from an account. If filter is omitted then it will return all transactions.
|
|
@@ -90,7 +102,11 @@ export interface RelayerClient {
|
|
|
90
102
|
* Pending transactions waiting to be mined for an account. This endpoint is just a sugar of `SentTransactions`
|
|
91
103
|
* with the filter set to pending: true.
|
|
92
104
|
*/
|
|
93
|
-
pendingTransactions(
|
|
105
|
+
pendingTransactions(
|
|
106
|
+
req: PendingTransactionsArgs,
|
|
107
|
+
headers?: object,
|
|
108
|
+
signal?: AbortSignal,
|
|
109
|
+
): Promise<PendingTransactionsReturn>
|
|
94
110
|
|
|
95
111
|
/**
|
|
96
112
|
* Legacy Gas Tank
|
|
@@ -107,21 +123,25 @@ export interface RelayerClient {
|
|
|
107
123
|
nextGasTankBalanceAdjustmentNonce(
|
|
108
124
|
req: NextGasTankBalanceAdjustmentNonceArgs,
|
|
109
125
|
headers?: object,
|
|
110
|
-
signal?: AbortSignal
|
|
126
|
+
signal?: AbortSignal,
|
|
111
127
|
): Promise<NextGasTankBalanceAdjustmentNonceReturn>
|
|
112
128
|
|
|
113
|
-
adjustGasTankBalance(
|
|
129
|
+
adjustGasTankBalance(
|
|
130
|
+
req: AdjustGasTankBalanceArgs,
|
|
131
|
+
headers?: object,
|
|
132
|
+
signal?: AbortSignal,
|
|
133
|
+
): Promise<AdjustGasTankBalanceReturn>
|
|
114
134
|
|
|
115
135
|
getGasTankBalanceAdjustment(
|
|
116
136
|
req: GetGasTankBalanceAdjustmentArgs,
|
|
117
137
|
headers?: object,
|
|
118
|
-
signal?: AbortSignal
|
|
138
|
+
signal?: AbortSignal,
|
|
119
139
|
): Promise<GetGasTankBalanceAdjustmentReturn>
|
|
120
140
|
|
|
121
141
|
listGasTankBalanceAdjustments(
|
|
122
142
|
req: ListGasTankBalanceAdjustmentsArgs,
|
|
123
143
|
headers?: object,
|
|
124
|
-
signal?: AbortSignal
|
|
144
|
+
signal?: AbortSignal,
|
|
125
145
|
): Promise<ListGasTankBalanceAdjustmentsReturn>
|
|
126
146
|
|
|
127
147
|
/**
|
|
@@ -140,14 +160,26 @@ export interface RelayerClient {
|
|
|
140
160
|
/**
|
|
141
161
|
* Gas Sponsor Lookup
|
|
142
162
|
*/
|
|
143
|
-
addressGasSponsors(
|
|
163
|
+
addressGasSponsors(
|
|
164
|
+
req: AddressGasSponsorsArgs,
|
|
165
|
+
headers?: object,
|
|
166
|
+
signal?: AbortSignal,
|
|
167
|
+
): Promise<AddressGasSponsorsReturn>
|
|
144
168
|
|
|
145
169
|
/**
|
|
146
170
|
* Project Balance
|
|
147
171
|
*/
|
|
148
|
-
getProjectBalance(
|
|
172
|
+
getProjectBalance(
|
|
173
|
+
req: GetProjectBalanceArgs,
|
|
174
|
+
headers?: object,
|
|
175
|
+
signal?: AbortSignal,
|
|
176
|
+
): Promise<GetProjectBalanceReturn>
|
|
149
177
|
|
|
150
|
-
adjustProjectBalance(
|
|
178
|
+
adjustProjectBalance(
|
|
179
|
+
req: AdjustProjectBalanceArgs,
|
|
180
|
+
headers?: object,
|
|
181
|
+
signal?: AbortSignal,
|
|
182
|
+
): Promise<AdjustProjectBalanceReturn>
|
|
151
183
|
}
|
|
152
184
|
|
|
153
185
|
//
|
|
@@ -162,7 +194,7 @@ export enum ETHTxnStatus {
|
|
|
162
194
|
SUCCEEDED = 'SUCCEEDED',
|
|
163
195
|
PARTIALLY_FAILED = 'PARTIALLY_FAILED',
|
|
164
196
|
FAILED = 'FAILED',
|
|
165
|
-
PENDING_PRECONDITION = 'PENDING_PRECONDITION'
|
|
197
|
+
PENDING_PRECONDITION = 'PENDING_PRECONDITION',
|
|
166
198
|
}
|
|
167
199
|
|
|
168
200
|
export enum TransferType {
|
|
@@ -171,7 +203,7 @@ export enum TransferType {
|
|
|
171
203
|
BRIDGE_DEPOSIT = 'BRIDGE_DEPOSIT',
|
|
172
204
|
BRIDGE_WITHDRAW = 'BRIDGE_WITHDRAW',
|
|
173
205
|
BURN = 'BURN',
|
|
174
|
-
UNKNOWN = 'UNKNOWN'
|
|
206
|
+
UNKNOWN = 'UNKNOWN',
|
|
175
207
|
}
|
|
176
208
|
|
|
177
209
|
export enum SimulateStatus {
|
|
@@ -180,18 +212,18 @@ export enum SimulateStatus {
|
|
|
180
212
|
FAILED = 'FAILED',
|
|
181
213
|
ABORTED = 'ABORTED',
|
|
182
214
|
REVERTED = 'REVERTED',
|
|
183
|
-
NOT_ENOUGH_GAS = 'NOT_ENOUGH_GAS'
|
|
215
|
+
NOT_ENOUGH_GAS = 'NOT_ENOUGH_GAS',
|
|
184
216
|
}
|
|
185
217
|
|
|
186
218
|
export enum FeeTokenType {
|
|
187
219
|
UNKNOWN = 'UNKNOWN',
|
|
188
220
|
ERC20_TOKEN = 'ERC20_TOKEN',
|
|
189
|
-
ERC1155_TOKEN = 'ERC1155_TOKEN'
|
|
221
|
+
ERC1155_TOKEN = 'ERC1155_TOKEN',
|
|
190
222
|
}
|
|
191
223
|
|
|
192
224
|
export enum SortOrder {
|
|
193
225
|
DESC = 'DESC',
|
|
194
|
-
ASC = 'ASC'
|
|
226
|
+
ASC = 'ASC',
|
|
195
227
|
}
|
|
196
228
|
|
|
197
229
|
export interface Version {
|
|
@@ -786,501 +818,669 @@ export class Relayer implements RelayerClient {
|
|
|
786
818
|
removeGasSponsor: (req: RemoveGasSponsorArgs) => ['Relayer', 'removeGasSponsor', req] as const,
|
|
787
819
|
addressGasSponsors: (req: AddressGasSponsorsArgs) => ['Relayer', 'addressGasSponsors', req] as const,
|
|
788
820
|
getProjectBalance: (req: GetProjectBalanceArgs) => ['Relayer', 'getProjectBalance', req] as const,
|
|
789
|
-
adjustProjectBalance: (req: AdjustProjectBalanceArgs) => ['Relayer', 'adjustProjectBalance', req] as const
|
|
821
|
+
adjustProjectBalance: (req: AdjustProjectBalanceArgs) => ['Relayer', 'adjustProjectBalance', req] as const,
|
|
790
822
|
}
|
|
791
823
|
|
|
792
824
|
ping = (headers?: object, signal?: AbortSignal): Promise<PingReturn> => {
|
|
793
825
|
return this.fetch(this.url('Ping'), createHttpRequest('{}', headers, signal)).then(
|
|
794
|
-
res => {
|
|
795
|
-
return buildResponse(res).then(_data => {
|
|
826
|
+
(res) => {
|
|
827
|
+
return buildResponse(res).then((_data) => {
|
|
796
828
|
return JsonDecode<PingReturn>(_data, 'PingReturn')
|
|
797
829
|
})
|
|
798
830
|
},
|
|
799
|
-
error => {
|
|
800
|
-
throw WebrpcRequestFailedError.new({
|
|
801
|
-
|
|
831
|
+
(error) => {
|
|
832
|
+
throw WebrpcRequestFailedError.new({
|
|
833
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
834
|
+
})
|
|
835
|
+
},
|
|
802
836
|
)
|
|
803
837
|
}
|
|
804
838
|
|
|
805
839
|
version = (headers?: object, signal?: AbortSignal): Promise<VersionReturn> => {
|
|
806
840
|
return this.fetch(this.url('Version'), createHttpRequest('{}', headers, signal)).then(
|
|
807
|
-
res => {
|
|
808
|
-
return buildResponse(res).then(_data => {
|
|
841
|
+
(res) => {
|
|
842
|
+
return buildResponse(res).then((_data) => {
|
|
809
843
|
return JsonDecode<VersionReturn>(_data, 'VersionReturn')
|
|
810
844
|
})
|
|
811
845
|
},
|
|
812
|
-
error => {
|
|
813
|
-
throw WebrpcRequestFailedError.new({
|
|
814
|
-
|
|
846
|
+
(error) => {
|
|
847
|
+
throw WebrpcRequestFailedError.new({
|
|
848
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
849
|
+
})
|
|
850
|
+
},
|
|
815
851
|
)
|
|
816
852
|
}
|
|
817
853
|
|
|
818
854
|
runtimeStatus = (headers?: object, signal?: AbortSignal): Promise<RuntimeStatusReturn> => {
|
|
819
855
|
return this.fetch(this.url('RuntimeStatus'), createHttpRequest('{}', headers, signal)).then(
|
|
820
|
-
res => {
|
|
821
|
-
return buildResponse(res).then(_data => {
|
|
856
|
+
(res) => {
|
|
857
|
+
return buildResponse(res).then((_data) => {
|
|
822
858
|
return JsonDecode<RuntimeStatusReturn>(_data, 'RuntimeStatusReturn')
|
|
823
859
|
})
|
|
824
860
|
},
|
|
825
|
-
error => {
|
|
826
|
-
throw WebrpcRequestFailedError.new({
|
|
827
|
-
|
|
861
|
+
(error) => {
|
|
862
|
+
throw WebrpcRequestFailedError.new({
|
|
863
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
864
|
+
})
|
|
865
|
+
},
|
|
828
866
|
)
|
|
829
867
|
}
|
|
830
868
|
|
|
831
869
|
getSequenceContext = (headers?: object, signal?: AbortSignal): Promise<GetSequenceContextReturn> => {
|
|
832
870
|
return this.fetch(this.url('GetSequenceContext'), createHttpRequest('{}', headers, signal)).then(
|
|
833
|
-
res => {
|
|
834
|
-
return buildResponse(res).then(_data => {
|
|
871
|
+
(res) => {
|
|
872
|
+
return buildResponse(res).then((_data) => {
|
|
835
873
|
return JsonDecode<GetSequenceContextReturn>(_data, 'GetSequenceContextReturn')
|
|
836
874
|
})
|
|
837
875
|
},
|
|
838
|
-
error => {
|
|
839
|
-
throw WebrpcRequestFailedError.new({
|
|
840
|
-
|
|
876
|
+
(error) => {
|
|
877
|
+
throw WebrpcRequestFailedError.new({
|
|
878
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
879
|
+
})
|
|
880
|
+
},
|
|
841
881
|
)
|
|
842
882
|
}
|
|
843
883
|
|
|
844
884
|
getChainID = (headers?: object, signal?: AbortSignal): Promise<GetChainIDReturn> => {
|
|
845
885
|
return this.fetch(this.url('GetChainID'), createHttpRequest('{}', headers, signal)).then(
|
|
846
|
-
res => {
|
|
847
|
-
return buildResponse(res).then(_data => {
|
|
886
|
+
(res) => {
|
|
887
|
+
return buildResponse(res).then((_data) => {
|
|
848
888
|
return JsonDecode<GetChainIDReturn>(_data, 'GetChainIDReturn')
|
|
849
889
|
})
|
|
850
890
|
},
|
|
851
|
-
error => {
|
|
852
|
-
throw WebrpcRequestFailedError.new({
|
|
853
|
-
|
|
891
|
+
(error) => {
|
|
892
|
+
throw WebrpcRequestFailedError.new({
|
|
893
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
894
|
+
})
|
|
895
|
+
},
|
|
854
896
|
)
|
|
855
897
|
}
|
|
856
898
|
|
|
857
899
|
sendMetaTxn = (req: SendMetaTxnArgs, headers?: object, signal?: AbortSignal): Promise<SendMetaTxnReturn> => {
|
|
858
|
-
return this.fetch(
|
|
859
|
-
|
|
860
|
-
|
|
900
|
+
return this.fetch(
|
|
901
|
+
this.url('SendMetaTxn'),
|
|
902
|
+
createHttpRequest(JsonEncode(req, 'SendMetaTxnArgs'), headers, signal),
|
|
903
|
+
).then(
|
|
904
|
+
(res) => {
|
|
905
|
+
return buildResponse(res).then((_data) => {
|
|
861
906
|
return JsonDecode<SendMetaTxnReturn>(_data, 'SendMetaTxnReturn')
|
|
862
907
|
})
|
|
863
908
|
},
|
|
864
|
-
error => {
|
|
865
|
-
throw WebrpcRequestFailedError.new({
|
|
866
|
-
|
|
909
|
+
(error) => {
|
|
910
|
+
throw WebrpcRequestFailedError.new({
|
|
911
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
912
|
+
})
|
|
913
|
+
},
|
|
867
914
|
)
|
|
868
915
|
}
|
|
869
916
|
|
|
870
|
-
getMetaTxnNonce = (
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
917
|
+
getMetaTxnNonce = (
|
|
918
|
+
req: GetMetaTxnNonceArgs,
|
|
919
|
+
headers?: object,
|
|
920
|
+
signal?: AbortSignal,
|
|
921
|
+
): Promise<GetMetaTxnNonceReturn> => {
|
|
922
|
+
return this.fetch(
|
|
923
|
+
this.url('GetMetaTxnNonce'),
|
|
924
|
+
createHttpRequest(JsonEncode(req, 'GetMetaTxnNonceArgs'), headers, signal),
|
|
925
|
+
).then(
|
|
926
|
+
(res) => {
|
|
927
|
+
return buildResponse(res).then((_data) => {
|
|
874
928
|
return JsonDecode<GetMetaTxnNonceReturn>(_data, 'GetMetaTxnNonceReturn')
|
|
875
929
|
})
|
|
876
930
|
},
|
|
877
|
-
error => {
|
|
878
|
-
throw WebrpcRequestFailedError.new({
|
|
879
|
-
|
|
931
|
+
(error) => {
|
|
932
|
+
throw WebrpcRequestFailedError.new({
|
|
933
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
934
|
+
})
|
|
935
|
+
},
|
|
880
936
|
)
|
|
881
937
|
}
|
|
882
938
|
|
|
883
|
-
getMetaTxnReceipt = (
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
939
|
+
getMetaTxnReceipt = (
|
|
940
|
+
req: GetMetaTxnReceiptArgs,
|
|
941
|
+
headers?: object,
|
|
942
|
+
signal?: AbortSignal,
|
|
943
|
+
): Promise<GetMetaTxnReceiptReturn> => {
|
|
944
|
+
return this.fetch(
|
|
945
|
+
this.url('GetMetaTxnReceipt'),
|
|
946
|
+
createHttpRequest(JsonEncode(req, 'GetMetaTxnReceiptArgs'), headers, signal),
|
|
947
|
+
).then(
|
|
948
|
+
(res) => {
|
|
949
|
+
return buildResponse(res).then((_data) => {
|
|
887
950
|
return JsonDecode<GetMetaTxnReceiptReturn>(_data, 'GetMetaTxnReceiptReturn')
|
|
888
951
|
})
|
|
889
952
|
},
|
|
890
|
-
error => {
|
|
891
|
-
throw WebrpcRequestFailedError.new({
|
|
892
|
-
|
|
953
|
+
(error) => {
|
|
954
|
+
throw WebrpcRequestFailedError.new({
|
|
955
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
956
|
+
})
|
|
957
|
+
},
|
|
893
958
|
)
|
|
894
959
|
}
|
|
895
960
|
|
|
896
961
|
simulate = (req: SimulateArgs, headers?: object, signal?: AbortSignal): Promise<SimulateReturn> => {
|
|
897
|
-
return this.fetch(this.url('Simulate'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
898
|
-
res => {
|
|
899
|
-
return buildResponse(res).then(_data => {
|
|
962
|
+
return this.fetch(this.url('Simulate'), createHttpRequest(JsonEncode(req, 'SimulateArgs'), headers, signal)).then(
|
|
963
|
+
(res) => {
|
|
964
|
+
return buildResponse(res).then((_data) => {
|
|
900
965
|
return JsonDecode<SimulateReturn>(_data, 'SimulateReturn')
|
|
901
966
|
})
|
|
902
967
|
},
|
|
903
|
-
error => {
|
|
904
|
-
throw WebrpcRequestFailedError.new({
|
|
905
|
-
|
|
968
|
+
(error) => {
|
|
969
|
+
throw WebrpcRequestFailedError.new({
|
|
970
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
971
|
+
})
|
|
972
|
+
},
|
|
906
973
|
)
|
|
907
974
|
}
|
|
908
975
|
|
|
909
976
|
simulateV3 = (req: SimulateV3Args, headers?: object, signal?: AbortSignal): Promise<SimulateV3Return> => {
|
|
910
|
-
return this.fetch(
|
|
911
|
-
|
|
912
|
-
|
|
977
|
+
return this.fetch(
|
|
978
|
+
this.url('SimulateV3'),
|
|
979
|
+
createHttpRequest(JsonEncode(req, 'SimulateV3Args'), headers, signal),
|
|
980
|
+
).then(
|
|
981
|
+
(res) => {
|
|
982
|
+
return buildResponse(res).then((_data) => {
|
|
913
983
|
return JsonDecode<SimulateV3Return>(_data, 'SimulateV3Return')
|
|
914
984
|
})
|
|
915
985
|
},
|
|
916
|
-
error => {
|
|
917
|
-
throw WebrpcRequestFailedError.new({
|
|
918
|
-
|
|
986
|
+
(error) => {
|
|
987
|
+
throw WebrpcRequestFailedError.new({
|
|
988
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
989
|
+
})
|
|
990
|
+
},
|
|
919
991
|
)
|
|
920
992
|
}
|
|
921
993
|
|
|
922
994
|
updateMetaTxnGasLimits = (
|
|
923
995
|
req: UpdateMetaTxnGasLimitsArgs,
|
|
924
996
|
headers?: object,
|
|
925
|
-
signal?: AbortSignal
|
|
997
|
+
signal?: AbortSignal,
|
|
926
998
|
): Promise<UpdateMetaTxnGasLimitsReturn> => {
|
|
927
|
-
return this.fetch(
|
|
928
|
-
|
|
929
|
-
|
|
999
|
+
return this.fetch(
|
|
1000
|
+
this.url('UpdateMetaTxnGasLimits'),
|
|
1001
|
+
createHttpRequest(JsonEncode(req, 'UpdateMetaTxnGasLimitsArgs'), headers, signal),
|
|
1002
|
+
).then(
|
|
1003
|
+
(res) => {
|
|
1004
|
+
return buildResponse(res).then((_data) => {
|
|
930
1005
|
return JsonDecode<UpdateMetaTxnGasLimitsReturn>(_data, 'UpdateMetaTxnGasLimitsReturn')
|
|
931
1006
|
})
|
|
932
1007
|
},
|
|
933
|
-
error => {
|
|
934
|
-
throw WebrpcRequestFailedError.new({
|
|
935
|
-
|
|
1008
|
+
(error) => {
|
|
1009
|
+
throw WebrpcRequestFailedError.new({
|
|
1010
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1011
|
+
})
|
|
1012
|
+
},
|
|
936
1013
|
)
|
|
937
1014
|
}
|
|
938
1015
|
|
|
939
1016
|
feeTokens = (headers?: object, signal?: AbortSignal): Promise<FeeTokensReturn> => {
|
|
940
1017
|
return this.fetch(this.url('FeeTokens'), createHttpRequest('{}', headers, signal)).then(
|
|
941
|
-
res => {
|
|
942
|
-
return buildResponse(res).then(_data => {
|
|
1018
|
+
(res) => {
|
|
1019
|
+
return buildResponse(res).then((_data) => {
|
|
943
1020
|
return JsonDecode<FeeTokensReturn>(_data, 'FeeTokensReturn')
|
|
944
1021
|
})
|
|
945
1022
|
},
|
|
946
|
-
error => {
|
|
947
|
-
throw WebrpcRequestFailedError.new({
|
|
948
|
-
|
|
1023
|
+
(error) => {
|
|
1024
|
+
throw WebrpcRequestFailedError.new({
|
|
1025
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1026
|
+
})
|
|
1027
|
+
},
|
|
949
1028
|
)
|
|
950
1029
|
}
|
|
951
1030
|
|
|
952
1031
|
feeOptions = (req: FeeOptionsArgs, headers?: object, signal?: AbortSignal): Promise<FeeOptionsReturn> => {
|
|
953
|
-
return this.fetch(
|
|
954
|
-
|
|
955
|
-
|
|
1032
|
+
return this.fetch(
|
|
1033
|
+
this.url('FeeOptions'),
|
|
1034
|
+
createHttpRequest(JsonEncode(req, 'FeeOptionsArgs'), headers, signal),
|
|
1035
|
+
).then(
|
|
1036
|
+
(res) => {
|
|
1037
|
+
return buildResponse(res).then((_data) => {
|
|
956
1038
|
return JsonDecode<FeeOptionsReturn>(_data, 'FeeOptionsReturn')
|
|
957
1039
|
})
|
|
958
1040
|
},
|
|
959
|
-
error => {
|
|
960
|
-
throw WebrpcRequestFailedError.new({
|
|
961
|
-
|
|
1041
|
+
(error) => {
|
|
1042
|
+
throw WebrpcRequestFailedError.new({
|
|
1043
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1044
|
+
})
|
|
1045
|
+
},
|
|
962
1046
|
)
|
|
963
1047
|
}
|
|
964
1048
|
|
|
965
1049
|
getMetaTxnNetworkFeeOptions = (
|
|
966
1050
|
req: GetMetaTxnNetworkFeeOptionsArgs,
|
|
967
1051
|
headers?: object,
|
|
968
|
-
signal?: AbortSignal
|
|
1052
|
+
signal?: AbortSignal,
|
|
969
1053
|
): Promise<GetMetaTxnNetworkFeeOptionsReturn> => {
|
|
970
|
-
return this.fetch(
|
|
971
|
-
|
|
972
|
-
|
|
1054
|
+
return this.fetch(
|
|
1055
|
+
this.url('GetMetaTxnNetworkFeeOptions'),
|
|
1056
|
+
createHttpRequest(JsonEncode(req, 'GetMetaTxnNetworkFeeOptionsArgs'), headers, signal),
|
|
1057
|
+
).then(
|
|
1058
|
+
(res) => {
|
|
1059
|
+
return buildResponse(res).then((_data) => {
|
|
973
1060
|
return JsonDecode<GetMetaTxnNetworkFeeOptionsReturn>(_data, 'GetMetaTxnNetworkFeeOptionsReturn')
|
|
974
1061
|
})
|
|
975
1062
|
},
|
|
976
|
-
error => {
|
|
977
|
-
throw WebrpcRequestFailedError.new({
|
|
978
|
-
|
|
1063
|
+
(error) => {
|
|
1064
|
+
throw WebrpcRequestFailedError.new({
|
|
1065
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1066
|
+
})
|
|
1067
|
+
},
|
|
979
1068
|
)
|
|
980
1069
|
}
|
|
981
1070
|
|
|
982
1071
|
getMetaTransactions = (
|
|
983
1072
|
req: GetMetaTransactionsArgs,
|
|
984
1073
|
headers?: object,
|
|
985
|
-
signal?: AbortSignal
|
|
1074
|
+
signal?: AbortSignal,
|
|
986
1075
|
): Promise<GetMetaTransactionsReturn> => {
|
|
987
|
-
return this.fetch(
|
|
988
|
-
|
|
989
|
-
|
|
1076
|
+
return this.fetch(
|
|
1077
|
+
this.url('GetMetaTransactions'),
|
|
1078
|
+
createHttpRequest(JsonEncode(req, 'GetMetaTransactionsArgs'), headers, signal),
|
|
1079
|
+
).then(
|
|
1080
|
+
(res) => {
|
|
1081
|
+
return buildResponse(res).then((_data) => {
|
|
990
1082
|
return JsonDecode<GetMetaTransactionsReturn>(_data, 'GetMetaTransactionsReturn')
|
|
991
1083
|
})
|
|
992
1084
|
},
|
|
993
|
-
error => {
|
|
994
|
-
throw WebrpcRequestFailedError.new({
|
|
995
|
-
|
|
1085
|
+
(error) => {
|
|
1086
|
+
throw WebrpcRequestFailedError.new({
|
|
1087
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1088
|
+
})
|
|
1089
|
+
},
|
|
996
1090
|
)
|
|
997
1091
|
}
|
|
998
1092
|
|
|
999
1093
|
getTransactionCost = (
|
|
1000
1094
|
req: GetTransactionCostArgs,
|
|
1001
1095
|
headers?: object,
|
|
1002
|
-
signal?: AbortSignal
|
|
1096
|
+
signal?: AbortSignal,
|
|
1003
1097
|
): Promise<GetTransactionCostReturn> => {
|
|
1004
|
-
return this.fetch(
|
|
1005
|
-
|
|
1006
|
-
|
|
1098
|
+
return this.fetch(
|
|
1099
|
+
this.url('GetTransactionCost'),
|
|
1100
|
+
createHttpRequest(JsonEncode(req, 'GetTransactionCostArgs'), headers, signal),
|
|
1101
|
+
).then(
|
|
1102
|
+
(res) => {
|
|
1103
|
+
return buildResponse(res).then((_data) => {
|
|
1007
1104
|
return JsonDecode<GetTransactionCostReturn>(_data, 'GetTransactionCostReturn')
|
|
1008
1105
|
})
|
|
1009
1106
|
},
|
|
1010
|
-
error => {
|
|
1011
|
-
throw WebrpcRequestFailedError.new({
|
|
1012
|
-
|
|
1107
|
+
(error) => {
|
|
1108
|
+
throw WebrpcRequestFailedError.new({
|
|
1109
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1110
|
+
})
|
|
1111
|
+
},
|
|
1013
1112
|
)
|
|
1014
1113
|
}
|
|
1015
1114
|
|
|
1016
|
-
sentTransactions = (
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1115
|
+
sentTransactions = (
|
|
1116
|
+
req: SentTransactionsArgs,
|
|
1117
|
+
headers?: object,
|
|
1118
|
+
signal?: AbortSignal,
|
|
1119
|
+
): Promise<SentTransactionsReturn> => {
|
|
1120
|
+
return this.fetch(
|
|
1121
|
+
this.url('SentTransactions'),
|
|
1122
|
+
createHttpRequest(JsonEncode(req, 'SentTransactionsArgs'), headers, signal),
|
|
1123
|
+
).then(
|
|
1124
|
+
(res) => {
|
|
1125
|
+
return buildResponse(res).then((_data) => {
|
|
1020
1126
|
return JsonDecode<SentTransactionsReturn>(_data, 'SentTransactionsReturn')
|
|
1021
1127
|
})
|
|
1022
1128
|
},
|
|
1023
|
-
error => {
|
|
1024
|
-
throw WebrpcRequestFailedError.new({
|
|
1025
|
-
|
|
1129
|
+
(error) => {
|
|
1130
|
+
throw WebrpcRequestFailedError.new({
|
|
1131
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1132
|
+
})
|
|
1133
|
+
},
|
|
1026
1134
|
)
|
|
1027
1135
|
}
|
|
1028
1136
|
|
|
1029
1137
|
pendingTransactions = (
|
|
1030
1138
|
req: PendingTransactionsArgs,
|
|
1031
1139
|
headers?: object,
|
|
1032
|
-
signal?: AbortSignal
|
|
1140
|
+
signal?: AbortSignal,
|
|
1033
1141
|
): Promise<PendingTransactionsReturn> => {
|
|
1034
|
-
return this.fetch(
|
|
1035
|
-
|
|
1036
|
-
|
|
1142
|
+
return this.fetch(
|
|
1143
|
+
this.url('PendingTransactions'),
|
|
1144
|
+
createHttpRequest(JsonEncode(req, 'PendingTransactionsArgs'), headers, signal),
|
|
1145
|
+
).then(
|
|
1146
|
+
(res) => {
|
|
1147
|
+
return buildResponse(res).then((_data) => {
|
|
1037
1148
|
return JsonDecode<PendingTransactionsReturn>(_data, 'PendingTransactionsReturn')
|
|
1038
1149
|
})
|
|
1039
1150
|
},
|
|
1040
|
-
error => {
|
|
1041
|
-
throw WebrpcRequestFailedError.new({
|
|
1042
|
-
|
|
1151
|
+
(error) => {
|
|
1152
|
+
throw WebrpcRequestFailedError.new({
|
|
1153
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1154
|
+
})
|
|
1155
|
+
},
|
|
1043
1156
|
)
|
|
1044
1157
|
}
|
|
1045
1158
|
|
|
1046
1159
|
getGasTank = (req: GetGasTankArgs, headers?: object, signal?: AbortSignal): Promise<GetGasTankReturn> => {
|
|
1047
|
-
return this.fetch(
|
|
1048
|
-
|
|
1049
|
-
|
|
1160
|
+
return this.fetch(
|
|
1161
|
+
this.url('GetGasTank'),
|
|
1162
|
+
createHttpRequest(JsonEncode(req, 'GetGasTankArgs'), headers, signal),
|
|
1163
|
+
).then(
|
|
1164
|
+
(res) => {
|
|
1165
|
+
return buildResponse(res).then((_data) => {
|
|
1050
1166
|
return JsonDecode<GetGasTankReturn>(_data, 'GetGasTankReturn')
|
|
1051
1167
|
})
|
|
1052
1168
|
},
|
|
1053
|
-
error => {
|
|
1054
|
-
throw WebrpcRequestFailedError.new({
|
|
1055
|
-
|
|
1169
|
+
(error) => {
|
|
1170
|
+
throw WebrpcRequestFailedError.new({
|
|
1171
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1172
|
+
})
|
|
1173
|
+
},
|
|
1056
1174
|
)
|
|
1057
1175
|
}
|
|
1058
1176
|
|
|
1059
1177
|
addGasTank = (req: AddGasTankArgs, headers?: object, signal?: AbortSignal): Promise<AddGasTankReturn> => {
|
|
1060
|
-
return this.fetch(
|
|
1061
|
-
|
|
1062
|
-
|
|
1178
|
+
return this.fetch(
|
|
1179
|
+
this.url('AddGasTank'),
|
|
1180
|
+
createHttpRequest(JsonEncode(req, 'AddGasTankArgs'), headers, signal),
|
|
1181
|
+
).then(
|
|
1182
|
+
(res) => {
|
|
1183
|
+
return buildResponse(res).then((_data) => {
|
|
1063
1184
|
return JsonDecode<AddGasTankReturn>(_data, 'AddGasTankReturn')
|
|
1064
1185
|
})
|
|
1065
1186
|
},
|
|
1066
|
-
error => {
|
|
1067
|
-
throw WebrpcRequestFailedError.new({
|
|
1068
|
-
|
|
1187
|
+
(error) => {
|
|
1188
|
+
throw WebrpcRequestFailedError.new({
|
|
1189
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1190
|
+
})
|
|
1191
|
+
},
|
|
1069
1192
|
)
|
|
1070
1193
|
}
|
|
1071
1194
|
|
|
1072
1195
|
updateGasTank = (req: UpdateGasTankArgs, headers?: object, signal?: AbortSignal): Promise<UpdateGasTankReturn> => {
|
|
1073
|
-
return this.fetch(
|
|
1074
|
-
|
|
1075
|
-
|
|
1196
|
+
return this.fetch(
|
|
1197
|
+
this.url('UpdateGasTank'),
|
|
1198
|
+
createHttpRequest(JsonEncode(req, 'UpdateGasTankArgs'), headers, signal),
|
|
1199
|
+
).then(
|
|
1200
|
+
(res) => {
|
|
1201
|
+
return buildResponse(res).then((_data) => {
|
|
1076
1202
|
return JsonDecode<UpdateGasTankReturn>(_data, 'UpdateGasTankReturn')
|
|
1077
1203
|
})
|
|
1078
1204
|
},
|
|
1079
|
-
error => {
|
|
1080
|
-
throw WebrpcRequestFailedError.new({
|
|
1081
|
-
|
|
1205
|
+
(error) => {
|
|
1206
|
+
throw WebrpcRequestFailedError.new({
|
|
1207
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1208
|
+
})
|
|
1209
|
+
},
|
|
1082
1210
|
)
|
|
1083
1211
|
}
|
|
1084
1212
|
|
|
1085
1213
|
nextGasTankBalanceAdjustmentNonce = (
|
|
1086
1214
|
req: NextGasTankBalanceAdjustmentNonceArgs,
|
|
1087
1215
|
headers?: object,
|
|
1088
|
-
signal?: AbortSignal
|
|
1216
|
+
signal?: AbortSignal,
|
|
1089
1217
|
): Promise<NextGasTankBalanceAdjustmentNonceReturn> => {
|
|
1090
|
-
return this.fetch(
|
|
1091
|
-
|
|
1092
|
-
|
|
1218
|
+
return this.fetch(
|
|
1219
|
+
this.url('NextGasTankBalanceAdjustmentNonce'),
|
|
1220
|
+
createHttpRequest(JsonEncode(req, 'NextGasTankBalanceAdjustmentNonceArgs'), headers, signal),
|
|
1221
|
+
).then(
|
|
1222
|
+
(res) => {
|
|
1223
|
+
return buildResponse(res).then((_data) => {
|
|
1093
1224
|
return JsonDecode<NextGasTankBalanceAdjustmentNonceReturn>(_data, 'NextGasTankBalanceAdjustmentNonceReturn')
|
|
1094
1225
|
})
|
|
1095
1226
|
},
|
|
1096
|
-
error => {
|
|
1097
|
-
throw WebrpcRequestFailedError.new({
|
|
1098
|
-
|
|
1227
|
+
(error) => {
|
|
1228
|
+
throw WebrpcRequestFailedError.new({
|
|
1229
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1230
|
+
})
|
|
1231
|
+
},
|
|
1099
1232
|
)
|
|
1100
1233
|
}
|
|
1101
1234
|
|
|
1102
1235
|
adjustGasTankBalance = (
|
|
1103
1236
|
req: AdjustGasTankBalanceArgs,
|
|
1104
1237
|
headers?: object,
|
|
1105
|
-
signal?: AbortSignal
|
|
1238
|
+
signal?: AbortSignal,
|
|
1106
1239
|
): Promise<AdjustGasTankBalanceReturn> => {
|
|
1107
|
-
return this.fetch(
|
|
1108
|
-
|
|
1109
|
-
|
|
1240
|
+
return this.fetch(
|
|
1241
|
+
this.url('AdjustGasTankBalance'),
|
|
1242
|
+
createHttpRequest(JsonEncode(req, 'AdjustGasTankBalanceArgs'), headers, signal),
|
|
1243
|
+
).then(
|
|
1244
|
+
(res) => {
|
|
1245
|
+
return buildResponse(res).then((_data) => {
|
|
1110
1246
|
return JsonDecode<AdjustGasTankBalanceReturn>(_data, 'AdjustGasTankBalanceReturn')
|
|
1111
1247
|
})
|
|
1112
1248
|
},
|
|
1113
|
-
error => {
|
|
1114
|
-
throw WebrpcRequestFailedError.new({
|
|
1115
|
-
|
|
1249
|
+
(error) => {
|
|
1250
|
+
throw WebrpcRequestFailedError.new({
|
|
1251
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1252
|
+
})
|
|
1253
|
+
},
|
|
1116
1254
|
)
|
|
1117
1255
|
}
|
|
1118
1256
|
|
|
1119
1257
|
getGasTankBalanceAdjustment = (
|
|
1120
1258
|
req: GetGasTankBalanceAdjustmentArgs,
|
|
1121
1259
|
headers?: object,
|
|
1122
|
-
signal?: AbortSignal
|
|
1260
|
+
signal?: AbortSignal,
|
|
1123
1261
|
): Promise<GetGasTankBalanceAdjustmentReturn> => {
|
|
1124
|
-
return this.fetch(
|
|
1125
|
-
|
|
1126
|
-
|
|
1262
|
+
return this.fetch(
|
|
1263
|
+
this.url('GetGasTankBalanceAdjustment'),
|
|
1264
|
+
createHttpRequest(JsonEncode(req, 'GetGasTankBalanceAdjustmentArgs'), headers, signal),
|
|
1265
|
+
).then(
|
|
1266
|
+
(res) => {
|
|
1267
|
+
return buildResponse(res).then((_data) => {
|
|
1127
1268
|
return JsonDecode<GetGasTankBalanceAdjustmentReturn>(_data, 'GetGasTankBalanceAdjustmentReturn')
|
|
1128
1269
|
})
|
|
1129
1270
|
},
|
|
1130
|
-
error => {
|
|
1131
|
-
throw WebrpcRequestFailedError.new({
|
|
1132
|
-
|
|
1271
|
+
(error) => {
|
|
1272
|
+
throw WebrpcRequestFailedError.new({
|
|
1273
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1274
|
+
})
|
|
1275
|
+
},
|
|
1133
1276
|
)
|
|
1134
1277
|
}
|
|
1135
1278
|
|
|
1136
1279
|
listGasTankBalanceAdjustments = (
|
|
1137
1280
|
req: ListGasTankBalanceAdjustmentsArgs,
|
|
1138
1281
|
headers?: object,
|
|
1139
|
-
signal?: AbortSignal
|
|
1282
|
+
signal?: AbortSignal,
|
|
1140
1283
|
): Promise<ListGasTankBalanceAdjustmentsReturn> => {
|
|
1141
|
-
return this.fetch(
|
|
1142
|
-
|
|
1143
|
-
|
|
1284
|
+
return this.fetch(
|
|
1285
|
+
this.url('ListGasTankBalanceAdjustments'),
|
|
1286
|
+
createHttpRequest(JsonEncode(req, 'ListGasTankBalanceAdjustmentsArgs'), headers, signal),
|
|
1287
|
+
).then(
|
|
1288
|
+
(res) => {
|
|
1289
|
+
return buildResponse(res).then((_data) => {
|
|
1144
1290
|
return JsonDecode<ListGasTankBalanceAdjustmentsReturn>(_data, 'ListGasTankBalanceAdjustmentsReturn')
|
|
1145
1291
|
})
|
|
1146
1292
|
},
|
|
1147
|
-
error => {
|
|
1148
|
-
throw WebrpcRequestFailedError.new({
|
|
1149
|
-
|
|
1293
|
+
(error) => {
|
|
1294
|
+
throw WebrpcRequestFailedError.new({
|
|
1295
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1296
|
+
})
|
|
1297
|
+
},
|
|
1150
1298
|
)
|
|
1151
1299
|
}
|
|
1152
1300
|
|
|
1153
|
-
listGasSponsors = (
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1301
|
+
listGasSponsors = (
|
|
1302
|
+
req: ListGasSponsorsArgs,
|
|
1303
|
+
headers?: object,
|
|
1304
|
+
signal?: AbortSignal,
|
|
1305
|
+
): Promise<ListGasSponsorsReturn> => {
|
|
1306
|
+
return this.fetch(
|
|
1307
|
+
this.url('ListGasSponsors'),
|
|
1308
|
+
createHttpRequest(JsonEncode(req, 'ListGasSponsorsArgs'), headers, signal),
|
|
1309
|
+
).then(
|
|
1310
|
+
(res) => {
|
|
1311
|
+
return buildResponse(res).then((_data) => {
|
|
1157
1312
|
return JsonDecode<ListGasSponsorsReturn>(_data, 'ListGasSponsorsReturn')
|
|
1158
1313
|
})
|
|
1159
1314
|
},
|
|
1160
|
-
error => {
|
|
1161
|
-
throw WebrpcRequestFailedError.new({
|
|
1162
|
-
|
|
1315
|
+
(error) => {
|
|
1316
|
+
throw WebrpcRequestFailedError.new({
|
|
1317
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1318
|
+
})
|
|
1319
|
+
},
|
|
1163
1320
|
)
|
|
1164
1321
|
}
|
|
1165
1322
|
|
|
1166
1323
|
getGasSponsor = (req: GetGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<GetGasSponsorReturn> => {
|
|
1167
|
-
return this.fetch(
|
|
1168
|
-
|
|
1169
|
-
|
|
1324
|
+
return this.fetch(
|
|
1325
|
+
this.url('GetGasSponsor'),
|
|
1326
|
+
createHttpRequest(JsonEncode(req, 'GetGasSponsorArgs'), headers, signal),
|
|
1327
|
+
).then(
|
|
1328
|
+
(res) => {
|
|
1329
|
+
return buildResponse(res).then((_data) => {
|
|
1170
1330
|
return JsonDecode<GetGasSponsorReturn>(_data, 'GetGasSponsorReturn')
|
|
1171
1331
|
})
|
|
1172
1332
|
},
|
|
1173
|
-
error => {
|
|
1174
|
-
throw WebrpcRequestFailedError.new({
|
|
1175
|
-
|
|
1333
|
+
(error) => {
|
|
1334
|
+
throw WebrpcRequestFailedError.new({
|
|
1335
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1336
|
+
})
|
|
1337
|
+
},
|
|
1176
1338
|
)
|
|
1177
1339
|
}
|
|
1178
1340
|
|
|
1179
1341
|
addGasSponsor = (req: AddGasSponsorArgs, headers?: object, signal?: AbortSignal): Promise<AddGasSponsorReturn> => {
|
|
1180
|
-
return this.fetch(
|
|
1181
|
-
|
|
1182
|
-
|
|
1342
|
+
return this.fetch(
|
|
1343
|
+
this.url('AddGasSponsor'),
|
|
1344
|
+
createHttpRequest(JsonEncode(req, 'AddGasSponsorArgs'), headers, signal),
|
|
1345
|
+
).then(
|
|
1346
|
+
(res) => {
|
|
1347
|
+
return buildResponse(res).then((_data) => {
|
|
1183
1348
|
return JsonDecode<AddGasSponsorReturn>(_data, 'AddGasSponsorReturn')
|
|
1184
1349
|
})
|
|
1185
1350
|
},
|
|
1186
|
-
error => {
|
|
1187
|
-
throw WebrpcRequestFailedError.new({
|
|
1188
|
-
|
|
1351
|
+
(error) => {
|
|
1352
|
+
throw WebrpcRequestFailedError.new({
|
|
1353
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1354
|
+
})
|
|
1355
|
+
},
|
|
1189
1356
|
)
|
|
1190
1357
|
}
|
|
1191
1358
|
|
|
1192
|
-
updateGasSponsor = (
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1359
|
+
updateGasSponsor = (
|
|
1360
|
+
req: UpdateGasSponsorArgs,
|
|
1361
|
+
headers?: object,
|
|
1362
|
+
signal?: AbortSignal,
|
|
1363
|
+
): Promise<UpdateGasSponsorReturn> => {
|
|
1364
|
+
return this.fetch(
|
|
1365
|
+
this.url('UpdateGasSponsor'),
|
|
1366
|
+
createHttpRequest(JsonEncode(req, 'UpdateGasSponsorArgs'), headers, signal),
|
|
1367
|
+
).then(
|
|
1368
|
+
(res) => {
|
|
1369
|
+
return buildResponse(res).then((_data) => {
|
|
1196
1370
|
return JsonDecode<UpdateGasSponsorReturn>(_data, 'UpdateGasSponsorReturn')
|
|
1197
1371
|
})
|
|
1198
1372
|
},
|
|
1199
|
-
error => {
|
|
1200
|
-
throw WebrpcRequestFailedError.new({
|
|
1201
|
-
|
|
1373
|
+
(error) => {
|
|
1374
|
+
throw WebrpcRequestFailedError.new({
|
|
1375
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1376
|
+
})
|
|
1377
|
+
},
|
|
1202
1378
|
)
|
|
1203
1379
|
}
|
|
1204
1380
|
|
|
1205
|
-
removeGasSponsor = (
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1381
|
+
removeGasSponsor = (
|
|
1382
|
+
req: RemoveGasSponsorArgs,
|
|
1383
|
+
headers?: object,
|
|
1384
|
+
signal?: AbortSignal,
|
|
1385
|
+
): Promise<RemoveGasSponsorReturn> => {
|
|
1386
|
+
return this.fetch(
|
|
1387
|
+
this.url('RemoveGasSponsor'),
|
|
1388
|
+
createHttpRequest(JsonEncode(req, 'RemoveGasSponsorArgs'), headers, signal),
|
|
1389
|
+
).then(
|
|
1390
|
+
(res) => {
|
|
1391
|
+
return buildResponse(res).then((_data) => {
|
|
1209
1392
|
return JsonDecode<RemoveGasSponsorReturn>(_data, 'RemoveGasSponsorReturn')
|
|
1210
1393
|
})
|
|
1211
1394
|
},
|
|
1212
|
-
error => {
|
|
1213
|
-
throw WebrpcRequestFailedError.new({
|
|
1214
|
-
|
|
1395
|
+
(error) => {
|
|
1396
|
+
throw WebrpcRequestFailedError.new({
|
|
1397
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1398
|
+
})
|
|
1399
|
+
},
|
|
1215
1400
|
)
|
|
1216
1401
|
}
|
|
1217
1402
|
|
|
1218
1403
|
addressGasSponsors = (
|
|
1219
1404
|
req: AddressGasSponsorsArgs,
|
|
1220
1405
|
headers?: object,
|
|
1221
|
-
signal?: AbortSignal
|
|
1406
|
+
signal?: AbortSignal,
|
|
1222
1407
|
): Promise<AddressGasSponsorsReturn> => {
|
|
1223
|
-
return this.fetch(
|
|
1224
|
-
|
|
1225
|
-
|
|
1408
|
+
return this.fetch(
|
|
1409
|
+
this.url('AddressGasSponsors'),
|
|
1410
|
+
createHttpRequest(JsonEncode(req, 'AddressGasSponsorsArgs'), headers, signal),
|
|
1411
|
+
).then(
|
|
1412
|
+
(res) => {
|
|
1413
|
+
return buildResponse(res).then((_data) => {
|
|
1226
1414
|
return JsonDecode<AddressGasSponsorsReturn>(_data, 'AddressGasSponsorsReturn')
|
|
1227
1415
|
})
|
|
1228
1416
|
},
|
|
1229
|
-
error => {
|
|
1230
|
-
throw WebrpcRequestFailedError.new({
|
|
1231
|
-
|
|
1417
|
+
(error) => {
|
|
1418
|
+
throw WebrpcRequestFailedError.new({
|
|
1419
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1420
|
+
})
|
|
1421
|
+
},
|
|
1232
1422
|
)
|
|
1233
1423
|
}
|
|
1234
1424
|
|
|
1235
|
-
getProjectBalance = (
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1425
|
+
getProjectBalance = (
|
|
1426
|
+
req: GetProjectBalanceArgs,
|
|
1427
|
+
headers?: object,
|
|
1428
|
+
signal?: AbortSignal,
|
|
1429
|
+
): Promise<GetProjectBalanceReturn> => {
|
|
1430
|
+
return this.fetch(
|
|
1431
|
+
this.url('GetProjectBalance'),
|
|
1432
|
+
createHttpRequest(JsonEncode(req, 'GetProjectBalanceArgs'), headers, signal),
|
|
1433
|
+
).then(
|
|
1434
|
+
(res) => {
|
|
1435
|
+
return buildResponse(res).then((_data) => {
|
|
1239
1436
|
return JsonDecode<GetProjectBalanceReturn>(_data, 'GetProjectBalanceReturn')
|
|
1240
1437
|
})
|
|
1241
1438
|
},
|
|
1242
|
-
error => {
|
|
1243
|
-
throw WebrpcRequestFailedError.new({
|
|
1244
|
-
|
|
1439
|
+
(error) => {
|
|
1440
|
+
throw WebrpcRequestFailedError.new({
|
|
1441
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1442
|
+
})
|
|
1443
|
+
},
|
|
1245
1444
|
)
|
|
1246
1445
|
}
|
|
1247
1446
|
|
|
1248
1447
|
adjustProjectBalance = (
|
|
1249
1448
|
req: AdjustProjectBalanceArgs,
|
|
1250
1449
|
headers?: object,
|
|
1251
|
-
signal?: AbortSignal
|
|
1450
|
+
signal?: AbortSignal,
|
|
1252
1451
|
): Promise<AdjustProjectBalanceReturn> => {
|
|
1253
|
-
return this.fetch(
|
|
1254
|
-
|
|
1255
|
-
|
|
1452
|
+
return this.fetch(
|
|
1453
|
+
this.url('AdjustProjectBalance'),
|
|
1454
|
+
createHttpRequest(JsonEncode(req, 'AdjustProjectBalanceArgs'), headers, signal),
|
|
1455
|
+
).then(
|
|
1456
|
+
(res) => {
|
|
1457
|
+
return buildResponse(res).then((_data) => {
|
|
1256
1458
|
return JsonDecode<AdjustProjectBalanceReturn>(_data, 'AdjustProjectBalanceReturn')
|
|
1257
1459
|
})
|
|
1258
1460
|
},
|
|
1259
|
-
error => {
|
|
1260
|
-
throw WebrpcRequestFailedError.new({
|
|
1261
|
-
|
|
1461
|
+
(error) => {
|
|
1462
|
+
throw WebrpcRequestFailedError.new({
|
|
1463
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
1464
|
+
})
|
|
1465
|
+
},
|
|
1262
1466
|
)
|
|
1263
1467
|
}
|
|
1264
1468
|
}
|
|
1265
1469
|
|
|
1266
1470
|
const createHttpRequest = (body: string = '{}', headers: object = {}, signal: AbortSignal | null = null): object => {
|
|
1267
|
-
const reqHeaders: { [key: string]: string } = {
|
|
1268
|
-
...headers,
|
|
1269
|
-
'Content-Type': 'application/json',
|
|
1270
|
-
[WebrpcHeader]: WebrpcHeaderValue
|
|
1271
|
-
}
|
|
1471
|
+
const reqHeaders: { [key: string]: string } = { ...headers, 'Content-Type': 'application/json' }
|
|
1272
1472
|
return { method: 'POST', headers: reqHeaders, body, signal }
|
|
1273
1473
|
}
|
|
1274
1474
|
|
|
1275
1475
|
const buildResponse = (res: Response): Promise<any> => {
|
|
1276
|
-
return res.text().then(text => {
|
|
1476
|
+
return res.text().then((text) => {
|
|
1277
1477
|
let data
|
|
1278
1478
|
try {
|
|
1279
1479
|
data = JSON.parse(text)
|
|
1280
1480
|
} catch (error) {
|
|
1281
1481
|
throw WebrpcBadResponseError.new({
|
|
1282
1482
|
status: res.status,
|
|
1283
|
-
cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}: response text: ${text}
|
|
1483
|
+
cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}: response text: ${text}`,
|
|
1284
1484
|
})
|
|
1285
1485
|
}
|
|
1286
1486
|
if (!res.ok) {
|
|
@@ -1300,7 +1500,41 @@ export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response
|
|
|
1300
1500
|
const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = {
|
|
1301
1501
|
SendMetaTxnArgs: [['preconditions', 'TransactionPrecondition[]']],
|
|
1302
1502
|
TransactionPrecondition: ['minAmount'],
|
|
1303
|
-
Transactions: [['preconditions', 'TransactionPrecondition[]']]
|
|
1503
|
+
Transactions: [['preconditions', 'TransactionPrecondition[]']],
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
// Encode in-place: mutate provided object graph to serialize bigints to strings.
|
|
1507
|
+
function encodeType(typ: string, obj: any): any {
|
|
1508
|
+
if (obj == null || typeof obj !== 'object') return obj
|
|
1509
|
+
const descs = BIG_INT_FIELDS[typ] || []
|
|
1510
|
+
if (!descs.length) return obj
|
|
1511
|
+
for (const d of descs) {
|
|
1512
|
+
if (Array.isArray(d)) {
|
|
1513
|
+
const [fieldName, nestedType] = d
|
|
1514
|
+
if (fieldName.endsWith('[]')) {
|
|
1515
|
+
const base = fieldName.slice(0, -2)
|
|
1516
|
+
const arr = obj[base]
|
|
1517
|
+
if (Array.isArray(arr)) {
|
|
1518
|
+
for (let i = 0; i < arr.length; i++) arr[i] = encodeType(nestedType, arr[i])
|
|
1519
|
+
}
|
|
1520
|
+
} else if (obj[fieldName]) {
|
|
1521
|
+
obj[fieldName] = encodeType(nestedType, obj[fieldName])
|
|
1522
|
+
}
|
|
1523
|
+
continue
|
|
1524
|
+
}
|
|
1525
|
+
if (d.endsWith('[]')) {
|
|
1526
|
+
const base = d.slice(0, -2)
|
|
1527
|
+
const arr = obj[base]
|
|
1528
|
+
if (Array.isArray(arr)) {
|
|
1529
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1530
|
+
if (typeof arr[i] === 'bigint') arr[i] = arr[i].toString()
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
continue
|
|
1534
|
+
}
|
|
1535
|
+
if (typeof obj[d] === 'bigint') obj[d] = obj[d].toString()
|
|
1536
|
+
}
|
|
1537
|
+
return obj
|
|
1304
1538
|
}
|
|
1305
1539
|
|
|
1306
1540
|
// Decode in-place: mutate object graph; throw if expected numeric string is invalid.
|
|
@@ -1318,16 +1552,7 @@ function decodeType(typ: string, obj: any): any {
|
|
|
1318
1552
|
for (let i = 0; i < arr.length; i++) arr[i] = decodeType(nestedType, arr[i])
|
|
1319
1553
|
}
|
|
1320
1554
|
} else if (obj[fieldName]) {
|
|
1321
|
-
|
|
1322
|
-
if (nestedType.endsWith('[]')) {
|
|
1323
|
-
const baseType = nestedType.slice(0, -2)
|
|
1324
|
-
const arr = obj[fieldName]
|
|
1325
|
-
if (Array.isArray(arr)) {
|
|
1326
|
-
for (let i = 0; i < arr.length; i++) arr[i] = decodeType(baseType, arr[i])
|
|
1327
|
-
}
|
|
1328
|
-
} else {
|
|
1329
|
-
obj[fieldName] = decodeType(nestedType, obj[fieldName])
|
|
1330
|
-
}
|
|
1555
|
+
obj[fieldName] = decodeType(nestedType, obj[fieldName])
|
|
1331
1556
|
}
|
|
1332
1557
|
continue
|
|
1333
1558
|
}
|
|
@@ -1360,9 +1585,9 @@ function decodeType(typ: string, obj: any): any {
|
|
|
1360
1585
|
return obj
|
|
1361
1586
|
}
|
|
1362
1587
|
|
|
1363
|
-
// Encode object to JSON with BigInts converted to decimal strings.
|
|
1364
|
-
export const JsonEncode = <T = any>(obj: T): string => {
|
|
1365
|
-
return JSON.stringify(
|
|
1588
|
+
// Encode object of given root type to JSON with BigInts converted to decimal strings.
|
|
1589
|
+
export const JsonEncode = <T = any>(obj: T, typ: string = ''): string => {
|
|
1590
|
+
return JSON.stringify(encodeType(typ, obj))
|
|
1366
1591
|
}
|
|
1367
1592
|
|
|
1368
1593
|
// Decode data (JSON string or already-parsed object) and convert declared BigInt string fields back to BigInt.
|
|
@@ -1901,7 +2126,7 @@ export enum errors {
|
|
|
1901
2126
|
NotFound = 'NotFound',
|
|
1902
2127
|
InsufficientFee = 'InsufficientFee',
|
|
1903
2128
|
NotEnoughBalance = 'NotEnoughBalance',
|
|
1904
|
-
SimulationFailed = 'SimulationFailed'
|
|
2129
|
+
SimulationFailed = 'SimulationFailed',
|
|
1905
2130
|
}
|
|
1906
2131
|
|
|
1907
2132
|
export enum WebrpcErrorCodes {
|
|
@@ -1942,7 +2167,7 @@ export enum WebrpcErrorCodes {
|
|
|
1942
2167
|
NotFound = 3000,
|
|
1943
2168
|
InsufficientFee = 3004,
|
|
1944
2169
|
NotEnoughBalance = 3005,
|
|
1945
|
-
SimulationFailed = 3006
|
|
2170
|
+
SimulationFailed = 3006,
|
|
1946
2171
|
}
|
|
1947
2172
|
|
|
1948
2173
|
export const webrpcErrorByCode: { [code: number]: any } = {
|
|
@@ -1983,7 +2208,7 @@ export const webrpcErrorByCode: { [code: number]: any } = {
|
|
|
1983
2208
|
[3000]: NotFoundError,
|
|
1984
2209
|
[3004]: InsufficientFeeError,
|
|
1985
2210
|
[3005]: NotEnoughBalanceError,
|
|
1986
|
-
[3006]: SimulationFailedError
|
|
2211
|
+
[3006]: SimulationFailedError,
|
|
1987
2212
|
}
|
|
1988
2213
|
|
|
1989
2214
|
//
|
|
@@ -1992,7 +2217,7 @@ export const webrpcErrorByCode: { [code: number]: any } = {
|
|
|
1992
2217
|
|
|
1993
2218
|
export const WebrpcHeader = 'Webrpc'
|
|
1994
2219
|
|
|
1995
|
-
export const WebrpcHeaderValue = 'webrpc@v0.
|
|
2220
|
+
export const WebrpcHeaderValue = 'webrpc@v0.30.2;gen-typescript@v0.22.2;sequence-relayer@v0.4.1'
|
|
1996
2221
|
|
|
1997
2222
|
type WebrpcGenVersions = {
|
|
1998
2223
|
WebrpcGenVersion: string
|
|
@@ -2010,7 +2235,7 @@ export function VersionFromHeader(headers: Headers): WebrpcGenVersions {
|
|
|
2010
2235
|
codeGenName: '',
|
|
2011
2236
|
codeGenVersion: '',
|
|
2012
2237
|
schemaName: '',
|
|
2013
|
-
schemaVersion: ''
|
|
2238
|
+
schemaVersion: '',
|
|
2014
2239
|
}
|
|
2015
2240
|
}
|
|
2016
2241
|
|
|
@@ -2025,7 +2250,7 @@ function parseWebrpcGenVersions(header: string): WebrpcGenVersions {
|
|
|
2025
2250
|
codeGenName: '',
|
|
2026
2251
|
codeGenVersion: '',
|
|
2027
2252
|
schemaName: '',
|
|
2028
|
-
schemaVersion: ''
|
|
2253
|
+
schemaVersion: '',
|
|
2029
2254
|
}
|
|
2030
2255
|
}
|
|
2031
2256
|
|
|
@@ -2038,6 +2263,6 @@ function parseWebrpcGenVersions(header: string): WebrpcGenVersions {
|
|
|
2038
2263
|
codeGenName: codeGenName ?? '',
|
|
2039
2264
|
codeGenVersion: codeGenVersion ?? '',
|
|
2040
2265
|
schemaName: schemaName ?? '',
|
|
2041
|
-
schemaVersion: schemaVersion ?? ''
|
|
2266
|
+
schemaVersion: schemaVersion ?? '',
|
|
2042
2267
|
}
|
|
2043
2268
|
}
|