@proton/wrap-constants 0.0.47 → 0.0.50
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/dist/coins.d.ts +5 -1
- package/dist/parsers/actions.d.ts +725 -289
- package/dist/parsers/address.d.ts +571 -112
- package/dist/parsers/auth.d.ts +1268 -356
- package/dist/parsers/base.d.ts +10 -7
- package/dist/parsers/currency.d.ts +48 -13
- package/dist/parsers/deposit.d.ts +23 -9
- package/dist/parsers/otc.d.ts +15 -8
- package/dist/parsers/withdraw.d.ts +646 -130
- package/dist/parsers/withdrawalHistory.d.ts +37 -9
- package/dist/parsers/wrap.d.ts +35 -11
- package/dist/wrap-constants.cjs.development.js +112 -56
- package/dist/wrap-constants.cjs.development.js.map +1 -1
- package/dist/wrap-constants.cjs.production.min.js +1 -1
- package/dist/wrap-constants.cjs.production.min.js.map +1 -1
- package/dist/wrap-constants.esm.js +112 -56
- package/dist/wrap-constants.esm.js.map +1 -1
- package/package.json +9 -5
- package/src/coins.ts +107 -59
- package/src/parsers/actions.ts +21 -7
- package/src/parsers/auth.ts +1 -2
package/src/coins.ts
CHANGED
|
@@ -25,7 +25,9 @@ export enum Chains {
|
|
|
25
25
|
AvalancheXChain = 'Avalanche X-Chain',
|
|
26
26
|
AvalancheCChain = 'Avalanche C-Chain',
|
|
27
27
|
PolygonMainnet = 'Polygon',
|
|
28
|
-
TerraMainnet = 'Terra'
|
|
28
|
+
TerraMainnet = 'Terra',
|
|
29
|
+
RippleMainnet = 'Ripple',
|
|
30
|
+
SolanaMainnet = 'Solana'
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
export enum Networks {
|
|
@@ -96,8 +98,11 @@ export const explorerLinkByChain = {
|
|
|
96
98
|
[Chains.AvalancheCChain] : (txid: string) => `https://snowtrace.io/tx/${txid}`,
|
|
97
99
|
[Chains.PolygonMainnet] : (txid: string) => `https://polygonscan.com/tx/${txid}`,
|
|
98
100
|
[Chains.TerraMainnet] : (txid: string) => `https://terra.stake.id/?#/tx/${txid}`,
|
|
101
|
+
[Chains.RippleMainnet] : (txid: string) => `https://xrpscan.com/tx/${txid}`,
|
|
102
|
+
[Chains.SolanaMainnet] : (txid: string) => `https://explorer.solana.com/tx/${txid}`,
|
|
99
103
|
}
|
|
100
104
|
|
|
105
|
+
// Initialize
|
|
101
106
|
export const initializeCoins = (protonChain: string): {
|
|
102
107
|
allCoins : Coin[];
|
|
103
108
|
swapCoins : Coin[];
|
|
@@ -304,7 +309,7 @@ export const initializeCoins = (protonChain: string): {
|
|
|
304
309
|
coingeckoId: 'proton-loan'
|
|
305
310
|
},
|
|
306
311
|
{
|
|
307
|
-
allowSwap:
|
|
312
|
+
allowSwap: true,
|
|
308
313
|
allowBridge: true,
|
|
309
314
|
allowLend: false,
|
|
310
315
|
allowBorrow: false,
|
|
@@ -740,6 +745,106 @@ export const initializeCoins = (protonChain: string): {
|
|
|
740
745
|
image: 'https://www.protonchain.com/images/tokens/xtokensXADA.png',
|
|
741
746
|
coingeckoId: 'cardano'
|
|
742
747
|
},
|
|
748
|
+
|
|
749
|
+
// Adding
|
|
750
|
+
{
|
|
751
|
+
allowSwap: false,
|
|
752
|
+
allowBridge: IS_MAINNET,
|
|
753
|
+
allowLend: false,
|
|
754
|
+
allowBorrow: false,
|
|
755
|
+
name: 'Terra',
|
|
756
|
+
coin: 'LUNA',
|
|
757
|
+
xtokenSymbol: 'XLUNA',
|
|
758
|
+
xtokenPrecision: 6,
|
|
759
|
+
xtokenContract: 'xtokens',
|
|
760
|
+
wallets: [
|
|
761
|
+
...(IS_MAINNET ? [{
|
|
762
|
+
wallet: 'LUNA',
|
|
763
|
+
symbol: 'LUNA',
|
|
764
|
+
chain: Chains.TerraMainnet,
|
|
765
|
+
network: Networks.Mainnet,
|
|
766
|
+
precision: 6,
|
|
767
|
+
contract: undefined,
|
|
768
|
+
hasWithdrawMemo: true
|
|
769
|
+
}]: [])
|
|
770
|
+
],
|
|
771
|
+
image: 'https://www.protonchain.com/images/tokens/xtokensXLUNA.png',
|
|
772
|
+
coingeckoId: 'terra-luna'
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
allowSwap: false,
|
|
776
|
+
allowBridge: IS_MAINNET,
|
|
777
|
+
allowLend: false,
|
|
778
|
+
allowBorrow: false,
|
|
779
|
+
name: 'TerraUSD',
|
|
780
|
+
coin: 'UST',
|
|
781
|
+
xtokenSymbol: 'XUST',
|
|
782
|
+
xtokenPrecision: 6,
|
|
783
|
+
xtokenContract: 'xtokens',
|
|
784
|
+
wallets: [
|
|
785
|
+
...(IS_MAINNET ? [{
|
|
786
|
+
wallet: 'UST',
|
|
787
|
+
symbol: 'UST',
|
|
788
|
+
chain: Chains.TerraMainnet,
|
|
789
|
+
network: Networks.Mainnet,
|
|
790
|
+
precision: 6,
|
|
791
|
+
contract: undefined,
|
|
792
|
+
hasWithdrawMemo: true
|
|
793
|
+
}]: [])
|
|
794
|
+
],
|
|
795
|
+
image: 'https://www.protonchain.com/images/tokens/xtokensXUST.png',
|
|
796
|
+
coingeckoId: 'terrausd'
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
allowSwap: false,
|
|
800
|
+
allowBridge: IS_MAINNET,
|
|
801
|
+
allowLend: false,
|
|
802
|
+
allowBorrow: false,
|
|
803
|
+
name: 'Solana',
|
|
804
|
+
coin: 'SOL',
|
|
805
|
+
xtokenSymbol: 'XSOL',
|
|
806
|
+
xtokenPrecision: 6,
|
|
807
|
+
xtokenContract: 'xtokens',
|
|
808
|
+
wallets: [
|
|
809
|
+
...(IS_MAINNET ? [{
|
|
810
|
+
wallet: 'SOL',
|
|
811
|
+
symbol: 'SOL',
|
|
812
|
+
chain: Chains.SolanaMainnet,
|
|
813
|
+
network: Networks.Mainnet,
|
|
814
|
+
precision: 9,
|
|
815
|
+
contract: undefined,
|
|
816
|
+
hasWithdrawMemo: false
|
|
817
|
+
}]: [])
|
|
818
|
+
],
|
|
819
|
+
image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/xsol.png',
|
|
820
|
+
coingeckoId: 'solana'
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
allowSwap: false,
|
|
824
|
+
allowBridge: IS_MAINNET,
|
|
825
|
+
allowLend: false,
|
|
826
|
+
allowBorrow: false,
|
|
827
|
+
name: 'Ripple',
|
|
828
|
+
coin: 'XRP',
|
|
829
|
+
xtokenSymbol: 'XXRP',
|
|
830
|
+
xtokenPrecision: 6,
|
|
831
|
+
xtokenContract: 'xtokens',
|
|
832
|
+
wallets: [
|
|
833
|
+
...(IS_MAINNET ? [{
|
|
834
|
+
wallet: 'XRP',
|
|
835
|
+
symbol: 'XRP',
|
|
836
|
+
chain: Chains.RippleMainnet,
|
|
837
|
+
network: Networks.Mainnet,
|
|
838
|
+
precision: 6,
|
|
839
|
+
contract: undefined,
|
|
840
|
+
hasWithdrawMemo: true
|
|
841
|
+
}]: [])
|
|
842
|
+
],
|
|
843
|
+
image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/xxrp.png',
|
|
844
|
+
coingeckoId: 'ripple'
|
|
845
|
+
},
|
|
846
|
+
|
|
847
|
+
// Future
|
|
743
848
|
{
|
|
744
849
|
allowSwap: false,
|
|
745
850
|
allowBridge: false,
|
|
@@ -752,15 +857,6 @@ export const initializeCoins = (protonChain: string): {
|
|
|
752
857
|
xtokenContract: 'xtokens',
|
|
753
858
|
wallets: [
|
|
754
859
|
...(IS_MAINNET ? [
|
|
755
|
-
{
|
|
756
|
-
wallet: 'AVAX',
|
|
757
|
-
symbol: 'AVAX',
|
|
758
|
-
chain: Chains.AvalancheXChain,
|
|
759
|
-
network: Networks.Mainnet,
|
|
760
|
-
precision: 9,
|
|
761
|
-
contract: undefined,
|
|
762
|
-
hasWithdrawMemo: false
|
|
763
|
-
},
|
|
764
860
|
{
|
|
765
861
|
wallet: 'AVAX',
|
|
766
862
|
symbol: 'AVAX',
|
|
@@ -799,54 +895,6 @@ export const initializeCoins = (protonChain: string): {
|
|
|
799
895
|
image: 'https://www.protonchain.com/images/tokens/xtokensXMATIC.png',
|
|
800
896
|
coingeckoId: 'matic-network'
|
|
801
897
|
},
|
|
802
|
-
{
|
|
803
|
-
allowSwap: false,
|
|
804
|
-
allowBridge: false,
|
|
805
|
-
allowLend: false,
|
|
806
|
-
allowBorrow: false,
|
|
807
|
-
name: 'Luna',
|
|
808
|
-
coin: 'LUNA',
|
|
809
|
-
xtokenSymbol: 'XLUNA',
|
|
810
|
-
xtokenPrecision: 6,
|
|
811
|
-
xtokenContract: 'xtokens',
|
|
812
|
-
wallets: [
|
|
813
|
-
...(IS_MAINNET ? [{
|
|
814
|
-
wallet: 'LUNA',
|
|
815
|
-
symbol: 'LUNA',
|
|
816
|
-
chain: Chains.TerraMainnet,
|
|
817
|
-
network: Networks.Mainnet,
|
|
818
|
-
precision: 6,
|
|
819
|
-
contract: undefined,
|
|
820
|
-
hasWithdrawMemo: true
|
|
821
|
-
}]: [])
|
|
822
|
-
],
|
|
823
|
-
image: 'https://www.protonchain.com/images/tokens/xtokensXLUNA.png',
|
|
824
|
-
coingeckoId: 'terra-luna'
|
|
825
|
-
},
|
|
826
|
-
{
|
|
827
|
-
allowSwap: false,
|
|
828
|
-
allowBridge: false,
|
|
829
|
-
allowLend: false,
|
|
830
|
-
allowBorrow: false,
|
|
831
|
-
name: 'TerraUSD',
|
|
832
|
-
coin: 'UST',
|
|
833
|
-
xtokenSymbol: 'XUST',
|
|
834
|
-
xtokenPrecision: 6,
|
|
835
|
-
xtokenContract: 'xtokens',
|
|
836
|
-
wallets: [
|
|
837
|
-
...(IS_MAINNET ? [{
|
|
838
|
-
wallet: 'UST',
|
|
839
|
-
symbol: 'UST',
|
|
840
|
-
chain: Chains.TerraMainnet,
|
|
841
|
-
network: Networks.Mainnet,
|
|
842
|
-
precision: 6,
|
|
843
|
-
contract: undefined,
|
|
844
|
-
hasWithdrawMemo: true
|
|
845
|
-
}]: [])
|
|
846
|
-
],
|
|
847
|
-
image: 'https://www.protonchain.com/images/tokens/xtokensXUST.png',
|
|
848
|
-
coingeckoId: 'terrausd'
|
|
849
|
-
},
|
|
850
898
|
{
|
|
851
899
|
allowSwap: false,
|
|
852
900
|
allowBridge: IS_TESTNET,
|
package/src/parsers/actions.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import * as z from 'zod'
|
|
2
|
-
import { ZodRawShape } from 'zod/lib/src/types/base'
|
|
3
2
|
import { accountParser, authorizationsParser } from './base'
|
|
4
3
|
|
|
4
|
+
const actionParser = z.object({
|
|
5
|
+
account: z.string(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
authorization: z.array(
|
|
8
|
+
z.object({
|
|
9
|
+
actor: z.string(),
|
|
10
|
+
permission: z.string(),
|
|
11
|
+
})
|
|
12
|
+
),
|
|
13
|
+
data: z.any(),
|
|
14
|
+
hex_data: z.string().optional()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const transactionExtensionsParser = z.array(z.number().or(z.string())).optional()
|
|
18
|
+
|
|
5
19
|
const rawTransactionParser = z.object({
|
|
6
20
|
expiration : z.string(),
|
|
7
21
|
ref_block_num : z.number(),
|
|
@@ -9,25 +23,25 @@ const rawTransactionParser = z.object({
|
|
|
9
23
|
max_net_usage_words : z.number(),
|
|
10
24
|
max_cpu_usage_ms : z.number(),
|
|
11
25
|
delay_sec : z.number(),
|
|
12
|
-
context_free_actions : z.array(
|
|
13
|
-
transaction_extensions: z.array(
|
|
26
|
+
context_free_actions : z.array(actionParser),
|
|
27
|
+
transaction_extensions: z.array(transactionExtensionsParser)
|
|
14
28
|
})
|
|
15
29
|
|
|
16
|
-
export const baseActionParser = <T extends ZodRawShape>(contract: string, action: string, data: T) => z.object({
|
|
30
|
+
export const baseActionParser = <T extends z.ZodRawShape>(contract: string, action: string, data: T) => z.object({
|
|
17
31
|
account: contract === '*' ? accountParser : z.literal(contract),
|
|
18
32
|
name: z.literal(action),
|
|
19
33
|
data: z.object(data),
|
|
20
34
|
authorization: authorizationsParser
|
|
21
35
|
})
|
|
22
36
|
|
|
23
|
-
export const baseActionSerializedParser = <T extends ZodRawShape>(contract: string, action: string, data: T) => z.object({
|
|
37
|
+
export const baseActionSerializedParser = <T extends z.ZodRawShape>(contract: string, action: string, data: T) => z.object({
|
|
24
38
|
account: contract === '*' ? accountParser : z.literal(contract),
|
|
25
39
|
name: z.literal(action),
|
|
26
40
|
data: z.string().or(z.object(data)),
|
|
27
41
|
authorization: authorizationsParser
|
|
28
42
|
})
|
|
29
43
|
|
|
30
|
-
export const webauthActionParser = <T extends ZodRawShape>(contract: string, action: string, data: T) => z.object({
|
|
44
|
+
export const webauthActionParser = <T extends z.ZodRawShape>(contract: string, action: string, data: T) => z.object({
|
|
31
45
|
account: z.literal('webauthn'),
|
|
32
46
|
name: z.literal('exec'),
|
|
33
47
|
data: z.object({
|
|
@@ -58,7 +72,7 @@ export const webauthActionParser = <T extends ZodRawShape>(contract: string, act
|
|
|
58
72
|
authorization: authorizationsParser
|
|
59
73
|
})
|
|
60
74
|
|
|
61
|
-
export const singleActionTransactionParser = <T extends ZodRawShape>(contract: string, action: string, data: T) => {
|
|
75
|
+
export const singleActionTransactionParser = <T extends z.ZodRawShape>(contract: string, action: string, data: T) => {
|
|
62
76
|
const baseAction = baseActionParser(contract, action, data)
|
|
63
77
|
const webauthAction = webauthActionParser(contract, action, data)
|
|
64
78
|
|
package/src/parsers/auth.ts
CHANGED
|
@@ -2,9 +2,8 @@ import * as z from 'zod'
|
|
|
2
2
|
import { baseActionParser, singleActionTransactionParser } from './actions'
|
|
3
3
|
import { authorizationParser } from './base'
|
|
4
4
|
import { WRAP_CONTRACT, WRAP_AUTH_ACTION } from '../constants'
|
|
5
|
-
import { ZodRawShape } from 'zod/lib/src/types/base'
|
|
6
5
|
|
|
7
|
-
export const createAbstractAuthParser = (contract: string, action: string, data: ZodRawShape) => {
|
|
6
|
+
export const createAbstractAuthParser = (contract: string, action: string, data: z.ZodRawShape) => {
|
|
8
7
|
return z.object({
|
|
9
8
|
signer : authorizationParser,
|
|
10
9
|
signatures : z.array(z.string()).length(1),
|