@proton/wrap-constants 0.0.46 → 0.0.49
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 +582 -101
- package/dist/parsers/auth.d.ts +1296 -340
- 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 +110 -55
- 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 +110 -55
- package/dist/wrap-constants.esm.js.map +1 -1
- package/package.json +6 -5
- package/src/coins.ts +106 -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,6 +98,8 @@ 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
|
|
|
101
105
|
export const initializeCoins = (protonChain: string): {
|
|
@@ -382,7 +386,7 @@ export const initializeCoins = (protonChain: string): {
|
|
|
382
386
|
}]: [])
|
|
383
387
|
],
|
|
384
388
|
image: 'https://www.protonchain.com/images/tokens/xtokensXPAX.png',
|
|
385
|
-
coingeckoId: '
|
|
389
|
+
coingeckoId: 'paxos-standard'
|
|
386
390
|
},
|
|
387
391
|
{
|
|
388
392
|
allowSwap: false,
|
|
@@ -740,6 +744,106 @@ export const initializeCoins = (protonChain: string): {
|
|
|
740
744
|
image: 'https://www.protonchain.com/images/tokens/xtokensXADA.png',
|
|
741
745
|
coingeckoId: 'cardano'
|
|
742
746
|
},
|
|
747
|
+
|
|
748
|
+
// Adding
|
|
749
|
+
{
|
|
750
|
+
allowSwap: false,
|
|
751
|
+
allowBridge: IS_MAINNET,
|
|
752
|
+
allowLend: false,
|
|
753
|
+
allowBorrow: false,
|
|
754
|
+
name: 'Terra',
|
|
755
|
+
coin: 'LUNA',
|
|
756
|
+
xtokenSymbol: 'XLUNA',
|
|
757
|
+
xtokenPrecision: 6,
|
|
758
|
+
xtokenContract: 'xtokens',
|
|
759
|
+
wallets: [
|
|
760
|
+
...(IS_MAINNET ? [{
|
|
761
|
+
wallet: 'LUNA',
|
|
762
|
+
symbol: 'LUNA',
|
|
763
|
+
chain: Chains.TerraMainnet,
|
|
764
|
+
network: Networks.Mainnet,
|
|
765
|
+
precision: 6,
|
|
766
|
+
contract: undefined,
|
|
767
|
+
hasWithdrawMemo: true
|
|
768
|
+
}]: [])
|
|
769
|
+
],
|
|
770
|
+
image: 'https://www.protonchain.com/images/tokens/xtokensXLUNA.png',
|
|
771
|
+
coingeckoId: 'terra-luna'
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
allowSwap: false,
|
|
775
|
+
allowBridge: IS_MAINNET,
|
|
776
|
+
allowLend: false,
|
|
777
|
+
allowBorrow: false,
|
|
778
|
+
name: 'TerraUSD',
|
|
779
|
+
coin: 'UST',
|
|
780
|
+
xtokenSymbol: 'XUST',
|
|
781
|
+
xtokenPrecision: 6,
|
|
782
|
+
xtokenContract: 'xtokens',
|
|
783
|
+
wallets: [
|
|
784
|
+
...(IS_MAINNET ? [{
|
|
785
|
+
wallet: 'UST',
|
|
786
|
+
symbol: 'UST',
|
|
787
|
+
chain: Chains.TerraMainnet,
|
|
788
|
+
network: Networks.Mainnet,
|
|
789
|
+
precision: 6,
|
|
790
|
+
contract: undefined,
|
|
791
|
+
hasWithdrawMemo: true
|
|
792
|
+
}]: [])
|
|
793
|
+
],
|
|
794
|
+
image: 'https://www.protonchain.com/images/tokens/xtokensXUST.png',
|
|
795
|
+
coingeckoId: 'terrausd'
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
allowSwap: false,
|
|
799
|
+
allowBridge: IS_MAINNET,
|
|
800
|
+
allowLend: false,
|
|
801
|
+
allowBorrow: false,
|
|
802
|
+
name: 'Solana',
|
|
803
|
+
coin: 'SOL',
|
|
804
|
+
xtokenSymbol: 'XSOL',
|
|
805
|
+
xtokenPrecision: 6,
|
|
806
|
+
xtokenContract: 'xtokens',
|
|
807
|
+
wallets: [
|
|
808
|
+
...(IS_MAINNET ? [{
|
|
809
|
+
wallet: 'SOL',
|
|
810
|
+
symbol: 'SOL',
|
|
811
|
+
chain: Chains.SolanaMainnet,
|
|
812
|
+
network: Networks.Mainnet,
|
|
813
|
+
precision: 9,
|
|
814
|
+
contract: undefined,
|
|
815
|
+
hasWithdrawMemo: false
|
|
816
|
+
}]: [])
|
|
817
|
+
],
|
|
818
|
+
image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/xsol.png',
|
|
819
|
+
coingeckoId: 'solana'
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
allowSwap: false,
|
|
823
|
+
allowBridge: IS_MAINNET,
|
|
824
|
+
allowLend: false,
|
|
825
|
+
allowBorrow: false,
|
|
826
|
+
name: 'Ripple',
|
|
827
|
+
coin: 'XRP',
|
|
828
|
+
xtokenSymbol: 'XXRP',
|
|
829
|
+
xtokenPrecision: 6,
|
|
830
|
+
xtokenContract: 'xtokens',
|
|
831
|
+
wallets: [
|
|
832
|
+
...(IS_MAINNET ? [{
|
|
833
|
+
wallet: 'XRP',
|
|
834
|
+
symbol: 'XRP',
|
|
835
|
+
chain: Chains.RippleMainnet,
|
|
836
|
+
network: Networks.Mainnet,
|
|
837
|
+
precision: 6,
|
|
838
|
+
contract: undefined,
|
|
839
|
+
hasWithdrawMemo: true
|
|
840
|
+
}]: [])
|
|
841
|
+
],
|
|
842
|
+
image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/xxrp.png',
|
|
843
|
+
coingeckoId: 'ripple'
|
|
844
|
+
},
|
|
845
|
+
|
|
846
|
+
// Future
|
|
743
847
|
{
|
|
744
848
|
allowSwap: false,
|
|
745
849
|
allowBridge: false,
|
|
@@ -752,15 +856,6 @@ export const initializeCoins = (protonChain: string): {
|
|
|
752
856
|
xtokenContract: 'xtokens',
|
|
753
857
|
wallets: [
|
|
754
858
|
...(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
859
|
{
|
|
765
860
|
wallet: 'AVAX',
|
|
766
861
|
symbol: 'AVAX',
|
|
@@ -799,54 +894,6 @@ export const initializeCoins = (protonChain: string): {
|
|
|
799
894
|
image: 'https://www.protonchain.com/images/tokens/xtokensXMATIC.png',
|
|
800
895
|
coingeckoId: 'matic-network'
|
|
801
896
|
},
|
|
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
897
|
{
|
|
851
898
|
allowSwap: false,
|
|
852
899
|
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),
|