@0xsequence/api 1.10.10 → 1.10.12

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/src/api.gen.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable */
2
- // sequence-api v0.4.0 da72de09959c34a964bb84662ed6bd510f78f5cb
2
+ // sequence-api v0.4.0 d3f5f1338693d60d58f87bc408a076218201a097
3
3
  // --
4
- // Code generated by webrpc-gen@v0.18.6 with typescript generator. DO NOT EDIT.
4
+ // Code generated by webrpc-gen@v0.18.7 with typescript generator. DO NOT EDIT.
5
5
  //
6
6
  // webrpc-gen -schema=api.ridl -target=typescript -client -out=./clients/api.gen.ts
7
7
 
@@ -12,7 +12,7 @@ export const WebRPCVersion = 'v1'
12
12
  export const WebRPCSchemaVersion = 'v0.4.0'
13
13
 
14
14
  // Schema hash generated from your RIDL schema
15
- export const WebRPCSchemaHash = 'da72de09959c34a964bb84662ed6bd510f78f5cb'
15
+ export const WebRPCSchemaHash = 'd3f5f1338693d60d58f87bc408a076218201a097'
16
16
 
17
17
  //
18
18
  // Types
@@ -23,6 +23,12 @@ export enum SortOrder {
23
23
  ASC = 'ASC'
24
24
  }
25
25
 
26
+ export enum TokenType {
27
+ ERC20 = 'ERC20',
28
+ ERC721 = 'ERC721',
29
+ ERC1155 = 'ERC1155'
30
+ }
31
+
26
32
  export interface Version {
27
33
  webrpcVersion: string
28
34
  schemaVersion: string
@@ -199,6 +205,13 @@ export interface NftCheckoutParams {
199
205
  contractAddress: string
200
206
  quantity: number
201
207
  decimals?: number
208
+ tokenAmount: string
209
+ tokenAddress: string
210
+ tokenSymbol: string
211
+ tokenDecimals?: number
212
+ calldata: string
213
+ platform: string
214
+ approvedSpenderAddress?: string
202
215
  }
203
216
 
204
217
  export interface NftCheckout {
@@ -231,6 +244,74 @@ export interface SardineOrder {
231
244
  recipientAddress: string
232
245
  }
233
246
 
247
+ export interface SwapQuote {
248
+ currencyAddress: string
249
+ currencyBalance: string
250
+ price: string
251
+ maxPrice: string
252
+ to: string
253
+ transactionData: string
254
+ approveData: string
255
+ }
256
+
257
+ export interface CurrencyGroup {
258
+ id: number
259
+ name: string
260
+ tokens: Array<CurrencyGroupToken>
261
+ }
262
+
263
+ export interface CurrencyGroupToken {
264
+ id: number
265
+ currencyGroupId: number
266
+ chainId: number
267
+ tokenAddress: string
268
+ }
269
+
270
+ export interface InventoryPaymentConfig {
271
+ id: number
272
+ projectId: number
273
+ chainId: number
274
+ externalProductId: string
275
+ paymentTokenAddress: string
276
+ paymentTokenType: TokenType
277
+ paymentTokenId: number
278
+ paymentAmount: number
279
+ paymentRecipient: string
280
+ chainedCallAddress?: string
281
+ chainedCallData?: string
282
+ allowCrossChainPayments?: boolean
283
+ callbackURL?: string
284
+ createdAt: string
285
+ deletedAt?: string
286
+ }
287
+
288
+ export interface InventoryPayment {
289
+ id: number
290
+ inventoryPaymentConfigId: number
291
+ productRecipient: string
292
+ paymentChainId: number
293
+ paymentTokenAddress: string
294
+ expiration: string
295
+ createdAt: string
296
+ completedAt?: string
297
+ processedAt?: string
298
+ }
299
+
300
+ export interface InventoryPaymentResponse {
301
+ paymentId: number
302
+ inventoryPaymentConfigId: number
303
+ chainId: number
304
+ externalProductId: string
305
+ paymentTokenAddress: string
306
+ paymentTokenType: TokenType
307
+ paymentTokenId: number
308
+ paymentTotal: number
309
+ expiration: string
310
+ signature: string
311
+ txTo: string
312
+ txData: string
313
+ }
314
+
234
315
  export interface API {
235
316
  ping(headers?: object, signal?: AbortSignal): Promise<PingReturn>
236
317
  version(headers?: object, signal?: AbortSignal): Promise<VersionReturn>
@@ -311,6 +392,52 @@ export interface API {
311
392
  paperSessionSecret2(args: PaperSessionSecret2Args, headers?: object, signal?: AbortSignal): Promise<PaperSessionSecret2Return>
312
393
  linkWallet(args: LinkWalletArgs, headers?: object, signal?: AbortSignal): Promise<LinkWalletReturn>
313
394
  getLinkedWallets(args: GetLinkedWalletsArgs, headers?: object, signal?: AbortSignal): Promise<GetLinkedWalletsReturn>
395
+ removeLinkedWallet(args: RemoveLinkedWalletArgs, headers?: object, signal?: AbortSignal): Promise<RemoveLinkedWalletReturn>
396
+ generateWaaSVerificationURL(
397
+ args: GenerateWaaSVerificationURLArgs,
398
+ headers?: object,
399
+ signal?: AbortSignal
400
+ ): Promise<GenerateWaaSVerificationURLReturn>
401
+ validateWaaSVerificationNonce(
402
+ args: ValidateWaaSVerificationNonceArgs,
403
+ headers?: object,
404
+ signal?: AbortSignal
405
+ ): Promise<ValidateWaaSVerificationNonceReturn>
406
+ getSwapQuotes(args: GetSwapQuotesArgs, headers?: object, signal?: AbortSignal): Promise<GetSwapQuotesReturn>
407
+ addCurrencyGroup(args: AddCurrencyGroupArgs, headers?: object, signal?: AbortSignal): Promise<AddCurrencyGroupReturn>
408
+ updateCurrencyGroup(args: UpdateCurrencyGroupArgs, headers?: object, signal?: AbortSignal): Promise<UpdateCurrencyGroupReturn>
409
+ listCurrencyGroups(headers?: object, signal?: AbortSignal): Promise<ListCurrencyGroupsReturn>
410
+ deleteCurrencyGroup(args: DeleteCurrencyGroupArgs, headers?: object, signal?: AbortSignal): Promise<DeleteCurrencyGroupReturn>
411
+ addInventoryPaymentConfig(
412
+ args: AddInventoryPaymentConfigArgs,
413
+ headers?: object,
414
+ signal?: AbortSignal
415
+ ): Promise<AddInventoryPaymentConfigReturn>
416
+ getInventoryPaymentConfig(
417
+ args: GetInventoryPaymentConfigArgs,
418
+ headers?: object,
419
+ signal?: AbortSignal
420
+ ): Promise<GetInventoryPaymentConfigReturn>
421
+ listInventoryPaymentConfigs(
422
+ args: ListInventoryPaymentConfigsArgs,
423
+ headers?: object,
424
+ signal?: AbortSignal
425
+ ): Promise<ListInventoryPaymentConfigsReturn>
426
+ updateInventoryPaymentConfig(
427
+ args: UpdateInventoryPaymentConfigArgs,
428
+ headers?: object,
429
+ signal?: AbortSignal
430
+ ): Promise<UpdateInventoryPaymentConfigReturn>
431
+ deleteInventoryPaymentConfig(
432
+ args: DeleteInventoryPaymentConfigArgs,
433
+ headers?: object,
434
+ signal?: AbortSignal
435
+ ): Promise<DeleteInventoryPaymentConfigReturn>
436
+ requestInventoryPayment(
437
+ args: RequestInventoryPaymentArgs,
438
+ headers?: object,
439
+ signal?: AbortSignal
440
+ ): Promise<RequestInventoryPaymentReturn>
314
441
  }
315
442
 
316
443
  export interface PingArgs {}
@@ -649,6 +776,113 @@ export interface GetLinkedWalletsArgs {
649
776
  export interface GetLinkedWalletsReturn {
650
777
  linkedWallets: Array<string>
651
778
  }
779
+ export interface RemoveLinkedWalletArgs {
780
+ chainId: string
781
+ walletAddress: string
782
+ ethAuthProofString: string
783
+ linkedWalletMessage: string
784
+ linkedWalletSignature: string
785
+ }
786
+
787
+ export interface RemoveLinkedWalletReturn {
788
+ status: boolean
789
+ }
790
+ export interface GenerateWaaSVerificationURLArgs {
791
+ walletAddress: string
792
+ }
793
+
794
+ export interface GenerateWaaSVerificationURLReturn {
795
+ nonce: string
796
+ verificationURL: string
797
+ }
798
+ export interface ValidateWaaSVerificationNonceArgs {
799
+ nonce: string
800
+ signature: string
801
+ sessionId: string
802
+ chainId: string
803
+ }
804
+
805
+ export interface ValidateWaaSVerificationNonceReturn {
806
+ walletAddress: string
807
+ }
808
+ export interface GetSwapQuotesArgs {
809
+ userAddress: string
810
+ currencyAddress: string
811
+ currencyAmount: string
812
+ chainId: number
813
+ includeApprove: boolean
814
+ }
815
+
816
+ export interface GetSwapQuotesReturn {
817
+ swapQuotes: Array<SwapQuote>
818
+ }
819
+ export interface AddCurrencyGroupArgs {
820
+ currencyGroup: CurrencyGroup
821
+ }
822
+
823
+ export interface AddCurrencyGroupReturn {
824
+ groupId: number
825
+ }
826
+ export interface UpdateCurrencyGroupArgs {
827
+ currencyGroup: CurrencyGroup
828
+ }
829
+
830
+ export interface UpdateCurrencyGroupReturn {}
831
+ export interface ListCurrencyGroupsArgs {}
832
+
833
+ export interface ListCurrencyGroupsReturn {
834
+ currencyGroups: Array<CurrencyGroup>
835
+ }
836
+ export interface DeleteCurrencyGroupArgs {
837
+ groupId: number
838
+ }
839
+
840
+ export interface DeleteCurrencyGroupReturn {
841
+ ok: boolean
842
+ }
843
+ export interface AddInventoryPaymentConfigArgs {
844
+ config: InventoryPaymentConfig
845
+ }
846
+
847
+ export interface AddInventoryPaymentConfigReturn {
848
+ configId: number
849
+ }
850
+ export interface GetInventoryPaymentConfigArgs {
851
+ configId: number
852
+ }
853
+
854
+ export interface GetInventoryPaymentConfigReturn {
855
+ config: InventoryPaymentConfig
856
+ }
857
+ export interface ListInventoryPaymentConfigsArgs {
858
+ projectId: number
859
+ }
860
+
861
+ export interface ListInventoryPaymentConfigsReturn {
862
+ configs: Array<InventoryPaymentConfig>
863
+ }
864
+ export interface UpdateInventoryPaymentConfigArgs {
865
+ config: InventoryPaymentConfig
866
+ }
867
+
868
+ export interface UpdateInventoryPaymentConfigReturn {}
869
+ export interface DeleteInventoryPaymentConfigArgs {
870
+ configId: number
871
+ }
872
+
873
+ export interface DeleteInventoryPaymentConfigReturn {
874
+ ok: boolean
875
+ }
876
+ export interface RequestInventoryPaymentArgs {
877
+ configId: number
878
+ recipient: string
879
+ chainId?: number
880
+ tokenAddress?: string
881
+ }
882
+
883
+ export interface RequestInventoryPaymentReturn {
884
+ payment: InventoryPaymentResponse
885
+ }
652
886
 
653
887
  //
654
888
  // Client
@@ -1383,6 +1617,257 @@ export class API implements API {
1383
1617
  }
1384
1618
  )
1385
1619
  }
1620
+
1621
+ removeLinkedWallet = (
1622
+ args: RemoveLinkedWalletArgs,
1623
+ headers?: object,
1624
+ signal?: AbortSignal
1625
+ ): Promise<RemoveLinkedWalletReturn> => {
1626
+ return this.fetch(this.url('RemoveLinkedWallet'), createHTTPRequest(args, headers, signal)).then(
1627
+ res => {
1628
+ return buildResponse(res).then(_data => {
1629
+ return {
1630
+ status: <boolean>_data.status
1631
+ }
1632
+ })
1633
+ },
1634
+ error => {
1635
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1636
+ }
1637
+ )
1638
+ }
1639
+
1640
+ generateWaaSVerificationURL = (
1641
+ args: GenerateWaaSVerificationURLArgs,
1642
+ headers?: object,
1643
+ signal?: AbortSignal
1644
+ ): Promise<GenerateWaaSVerificationURLReturn> => {
1645
+ return this.fetch(this.url('GenerateWaaSVerificationURL'), createHTTPRequest(args, headers, signal)).then(
1646
+ res => {
1647
+ return buildResponse(res).then(_data => {
1648
+ return {
1649
+ nonce: <string>_data.nonce,
1650
+ verificationURL: <string>_data.verificationURL
1651
+ }
1652
+ })
1653
+ },
1654
+ error => {
1655
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1656
+ }
1657
+ )
1658
+ }
1659
+
1660
+ validateWaaSVerificationNonce = (
1661
+ args: ValidateWaaSVerificationNonceArgs,
1662
+ headers?: object,
1663
+ signal?: AbortSignal
1664
+ ): Promise<ValidateWaaSVerificationNonceReturn> => {
1665
+ return this.fetch(this.url('ValidateWaaSVerificationNonce'), createHTTPRequest(args, headers, signal)).then(
1666
+ res => {
1667
+ return buildResponse(res).then(_data => {
1668
+ return {
1669
+ walletAddress: <string>_data.walletAddress
1670
+ }
1671
+ })
1672
+ },
1673
+ error => {
1674
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1675
+ }
1676
+ )
1677
+ }
1678
+
1679
+ getSwapQuotes = (args: GetSwapQuotesArgs, headers?: object, signal?: AbortSignal): Promise<GetSwapQuotesReturn> => {
1680
+ return this.fetch(this.url('GetSwapQuotes'), createHTTPRequest(args, headers, signal)).then(
1681
+ res => {
1682
+ return buildResponse(res).then(_data => {
1683
+ return {
1684
+ swapQuotes: <Array<SwapQuote>>_data.swapQuotes
1685
+ }
1686
+ })
1687
+ },
1688
+ error => {
1689
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1690
+ }
1691
+ )
1692
+ }
1693
+
1694
+ addCurrencyGroup = (args: AddCurrencyGroupArgs, headers?: object, signal?: AbortSignal): Promise<AddCurrencyGroupReturn> => {
1695
+ return this.fetch(this.url('AddCurrencyGroup'), createHTTPRequest(args, headers, signal)).then(
1696
+ res => {
1697
+ return buildResponse(res).then(_data => {
1698
+ return {
1699
+ groupId: <number>_data.groupId
1700
+ }
1701
+ })
1702
+ },
1703
+ error => {
1704
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1705
+ }
1706
+ )
1707
+ }
1708
+
1709
+ updateCurrencyGroup = (
1710
+ args: UpdateCurrencyGroupArgs,
1711
+ headers?: object,
1712
+ signal?: AbortSignal
1713
+ ): Promise<UpdateCurrencyGroupReturn> => {
1714
+ return this.fetch(this.url('UpdateCurrencyGroup'), createHTTPRequest(args, headers, signal)).then(
1715
+ res => {
1716
+ return buildResponse(res).then(_data => {
1717
+ return {}
1718
+ })
1719
+ },
1720
+ error => {
1721
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1722
+ }
1723
+ )
1724
+ }
1725
+
1726
+ listCurrencyGroups = (headers?: object, signal?: AbortSignal): Promise<ListCurrencyGroupsReturn> => {
1727
+ return this.fetch(this.url('ListCurrencyGroups'), createHTTPRequest({}, headers, signal)).then(
1728
+ res => {
1729
+ return buildResponse(res).then(_data => {
1730
+ return {
1731
+ currencyGroups: <Array<CurrencyGroup>>_data.currencyGroups
1732
+ }
1733
+ })
1734
+ },
1735
+ error => {
1736
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1737
+ }
1738
+ )
1739
+ }
1740
+
1741
+ deleteCurrencyGroup = (
1742
+ args: DeleteCurrencyGroupArgs,
1743
+ headers?: object,
1744
+ signal?: AbortSignal
1745
+ ): Promise<DeleteCurrencyGroupReturn> => {
1746
+ return this.fetch(this.url('DeleteCurrencyGroup'), createHTTPRequest(args, headers, signal)).then(
1747
+ res => {
1748
+ return buildResponse(res).then(_data => {
1749
+ return {
1750
+ ok: <boolean>_data.ok
1751
+ }
1752
+ })
1753
+ },
1754
+ error => {
1755
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1756
+ }
1757
+ )
1758
+ }
1759
+
1760
+ addInventoryPaymentConfig = (
1761
+ args: AddInventoryPaymentConfigArgs,
1762
+ headers?: object,
1763
+ signal?: AbortSignal
1764
+ ): Promise<AddInventoryPaymentConfigReturn> => {
1765
+ return this.fetch(this.url('AddInventoryPaymentConfig'), createHTTPRequest(args, headers, signal)).then(
1766
+ res => {
1767
+ return buildResponse(res).then(_data => {
1768
+ return {
1769
+ configId: <number>_data.configId
1770
+ }
1771
+ })
1772
+ },
1773
+ error => {
1774
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1775
+ }
1776
+ )
1777
+ }
1778
+
1779
+ getInventoryPaymentConfig = (
1780
+ args: GetInventoryPaymentConfigArgs,
1781
+ headers?: object,
1782
+ signal?: AbortSignal
1783
+ ): Promise<GetInventoryPaymentConfigReturn> => {
1784
+ return this.fetch(this.url('GetInventoryPaymentConfig'), createHTTPRequest(args, headers, signal)).then(
1785
+ res => {
1786
+ return buildResponse(res).then(_data => {
1787
+ return {
1788
+ config: <InventoryPaymentConfig>_data.config
1789
+ }
1790
+ })
1791
+ },
1792
+ error => {
1793
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1794
+ }
1795
+ )
1796
+ }
1797
+
1798
+ listInventoryPaymentConfigs = (
1799
+ args: ListInventoryPaymentConfigsArgs,
1800
+ headers?: object,
1801
+ signal?: AbortSignal
1802
+ ): Promise<ListInventoryPaymentConfigsReturn> => {
1803
+ return this.fetch(this.url('ListInventoryPaymentConfigs'), createHTTPRequest(args, headers, signal)).then(
1804
+ res => {
1805
+ return buildResponse(res).then(_data => {
1806
+ return {
1807
+ configs: <Array<InventoryPaymentConfig>>_data.configs
1808
+ }
1809
+ })
1810
+ },
1811
+ error => {
1812
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1813
+ }
1814
+ )
1815
+ }
1816
+
1817
+ updateInventoryPaymentConfig = (
1818
+ args: UpdateInventoryPaymentConfigArgs,
1819
+ headers?: object,
1820
+ signal?: AbortSignal
1821
+ ): Promise<UpdateInventoryPaymentConfigReturn> => {
1822
+ return this.fetch(this.url('UpdateInventoryPaymentConfig'), createHTTPRequest(args, headers, signal)).then(
1823
+ res => {
1824
+ return buildResponse(res).then(_data => {
1825
+ return {}
1826
+ })
1827
+ },
1828
+ error => {
1829
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1830
+ }
1831
+ )
1832
+ }
1833
+
1834
+ deleteInventoryPaymentConfig = (
1835
+ args: DeleteInventoryPaymentConfigArgs,
1836
+ headers?: object,
1837
+ signal?: AbortSignal
1838
+ ): Promise<DeleteInventoryPaymentConfigReturn> => {
1839
+ return this.fetch(this.url('DeleteInventoryPaymentConfig'), createHTTPRequest(args, headers, signal)).then(
1840
+ res => {
1841
+ return buildResponse(res).then(_data => {
1842
+ return {
1843
+ ok: <boolean>_data.ok
1844
+ }
1845
+ })
1846
+ },
1847
+ error => {
1848
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1849
+ }
1850
+ )
1851
+ }
1852
+
1853
+ requestInventoryPayment = (
1854
+ args: RequestInventoryPaymentArgs,
1855
+ headers?: object,
1856
+ signal?: AbortSignal
1857
+ ): Promise<RequestInventoryPaymentReturn> => {
1858
+ return this.fetch(this.url('RequestInventoryPayment'), createHTTPRequest(args, headers, signal)).then(
1859
+ res => {
1860
+ return buildResponse(res).then(_data => {
1861
+ return {
1862
+ payment: <InventoryPaymentResponse>_data.payment
1863
+ }
1864
+ })
1865
+ },
1866
+ error => {
1867
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
1868
+ }
1869
+ )
1870
+ }
1386
1871
  }
1387
1872
 
1388
1873
  const createHTTPRequest = (body: object = {}, headers: object = {}, signal: AbortSignal | null = null): object => {
@@ -1646,6 +2131,19 @@ export class AbortedError extends WebrpcError {
1646
2131
  }
1647
2132
  }
1648
2133
 
2134
+ export class GeoblockedError extends WebrpcError {
2135
+ constructor(
2136
+ name: string = 'Geoblocked',
2137
+ code: number = 1006,
2138
+ message: string = 'Geoblocked region',
2139
+ status: number = 0,
2140
+ cause?: string
2141
+ ) {
2142
+ super(name, code, message, status, cause)
2143
+ Object.setPrototypeOf(this, GeoblockedError.prototype)
2144
+ }
2145
+ }
2146
+
1649
2147
  export class InvalidArgumentError extends WebrpcError {
1650
2148
  constructor(
1651
2149
  name: string = 'InvalidArgument',
@@ -1714,6 +2212,7 @@ export enum errors {
1714
2212
  PermissionDenied = 'PermissionDenied',
1715
2213
  SessionExpired = 'SessionExpired',
1716
2214
  Aborted = 'Aborted',
2215
+ Geoblocked = 'Geoblocked',
1717
2216
  InvalidArgument = 'InvalidArgument',
1718
2217
  Unavailable = 'Unavailable',
1719
2218
  QueryFailed = 'QueryFailed',
@@ -1736,6 +2235,7 @@ const webrpcErrorByCode: { [code: number]: any } = {
1736
2235
  [1001]: PermissionDeniedError,
1737
2236
  [1002]: SessionExpiredError,
1738
2237
  [1005]: AbortedError,
2238
+ [1006]: GeoblockedError,
1739
2239
  [2000]: InvalidArgumentError,
1740
2240
  [2002]: UnavailableError,
1741
2241
  [2003]: QueryFailedError,
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@ export * from './api.gen'
2
2
 
3
3
  import { API as ApiRpc } from './api.gen'
4
4
 
5
- const fetch = typeof global === 'object' ? global.fetch : window.fetch
5
+ const fetch = globalThis.fetch
6
6
 
7
7
  export class SequenceAPIClient extends ApiRpc {
8
8
  constructor(