@oasisprotocol/privana-sdk 0.2.1 → 0.4.0

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.
@@ -0,0 +1,115 @@
1
+ var networks = {
2
+ testnet: {
3
+ chainId: 23295,
4
+ name: "Sapphire Testnet",
5
+ accountingContract: "0xaF8e5de153A584528B57DD4B9B0195956BBDF571",
6
+ apiUrl: "https://testnet.privana.finance"
7
+ },
8
+ mainnet: {
9
+ chainId: 23294,
10
+ name: "Sapphire Mainnet",
11
+ accountingContract: "0x0000000000000000000000000000000000000000",
12
+ apiUrl: ""
13
+ }
14
+ };
15
+ var config = {
16
+ networks: networks
17
+ };
18
+
19
+ type Address = `0x${string}`;
20
+ type Bytes32 = `0x${string}`;
21
+ type HexString = `0x${string}`;
22
+ type IntegerLike = string | number;
23
+ type HostedAuthResponseMode = 'web_message' | 'redirect';
24
+ type Network = keyof typeof config.networks;
25
+ interface NetworkConfig {
26
+ chainId: number;
27
+ name: string;
28
+ accountingContract: Address;
29
+ apiUrl: string;
30
+ }
31
+ declare const NETWORK_CONFIG: {
32
+ readonly testnet: {
33
+ readonly accountingContract: Address;
34
+ readonly chainId: number;
35
+ readonly name: string;
36
+ readonly apiUrl: string;
37
+ };
38
+ readonly mainnet: {
39
+ readonly accountingContract: Address;
40
+ readonly chainId: number;
41
+ readonly name: string;
42
+ readonly apiUrl: string;
43
+ };
44
+ };
45
+ declare function getChainId(network: Network): number;
46
+ declare function getAccountingContract(network: Network): Address;
47
+ declare function getApiUrl(network: Network): string;
48
+ declare function normalizeHex(value: string): HexString;
49
+ declare function normalizeAddress(value: string): Address;
50
+
51
+ interface TokenConfig {
52
+ id: Bytes32;
53
+ symbol: string;
54
+ decimals: number;
55
+ contract: Address;
56
+ name: string;
57
+ chainId: number;
58
+ }
59
+
60
+ type OnRampStatus = 'pending' | 'completed' | 'failed' | 'cancelled';
61
+ /** Request body / response of POST /api/onramp/sign-url */
62
+ interface SignOnRampUrlRequest {
63
+ url: string;
64
+ }
65
+ interface SignOnRampUrlResponse {
66
+ signature: string;
67
+ }
68
+ /** Request body / response of POST /api/onramp/intent. */
69
+ interface CreateOnRampIntentRequest {
70
+ wallet_address?: Address;
71
+ token_id: Bytes32;
72
+ chain_id: number;
73
+ moonpay_currency_code: string;
74
+ base_currency_code?: string;
75
+ base_currency_amount?: string;
76
+ }
77
+ type CreateOnRampIntentResponse = OnRampRecord;
78
+ /** Request body / response of POST /api/onramp/{id}. */
79
+ interface UpdateOnRampRequest {
80
+ wallet_address?: Address;
81
+ token_id?: Bytes32;
82
+ chain_id?: number;
83
+ moonpay_transaction_id?: string;
84
+ base_currency_code?: string;
85
+ base_currency_amount?: string;
86
+ quote_currency_amount?: string;
87
+ on_chain_tx_hash?: HexString;
88
+ deposit_tx_hash?: HexString;
89
+ }
90
+ type UpdateOnRampResponse = OnRampRecord;
91
+ interface OnRampRecord {
92
+ transaction_id: string;
93
+ external_transaction_id?: string;
94
+ moonpay_transaction_id?: string;
95
+ status: OnRampStatus;
96
+ wallet_address?: Address;
97
+ token_id?: Bytes32;
98
+ chain_id?: number;
99
+ moonpay_currency_code?: string;
100
+ base_currency_code?: string;
101
+ base_currency_amount?: string;
102
+ quote_currency_amount?: string;
103
+ on_chain_tx_hash?: HexString;
104
+ deposit_tx_hash?: HexString;
105
+ deposit_triggered_at?: number;
106
+ credited_at?: number;
107
+ created_at: number;
108
+ updated_at: number;
109
+ }
110
+ /** Response body of GET /api/onramp/pending */
111
+ interface PendingOnRampsResponse {
112
+ pending: OnRampRecord[];
113
+ }
114
+
115
+ export { type Address as A, type Bytes32 as B, type CreateOnRampIntentRequest as C, type HexString as H, type IntegerLike as I, type NetworkConfig as N, type OnRampRecord as O, type PendingOnRampsResponse as P, type SignOnRampUrlRequest as S, type TokenConfig as T, type UpdateOnRampRequest as U, type HostedAuthResponseMode as a, type SignOnRampUrlResponse as b, type CreateOnRampIntentResponse as c, type UpdateOnRampResponse as d, NETWORK_CONFIG as e, type Network as f, type OnRampStatus as g, getAccountingContract as h, getApiUrl as i, getChainId as j, normalizeHex as k, normalizeAddress as n };
@@ -0,0 +1,115 @@
1
+ var networks = {
2
+ testnet: {
3
+ chainId: 23295,
4
+ name: "Sapphire Testnet",
5
+ accountingContract: "0xaF8e5de153A584528B57DD4B9B0195956BBDF571",
6
+ apiUrl: "https://testnet.privana.finance"
7
+ },
8
+ mainnet: {
9
+ chainId: 23294,
10
+ name: "Sapphire Mainnet",
11
+ accountingContract: "0x0000000000000000000000000000000000000000",
12
+ apiUrl: ""
13
+ }
14
+ };
15
+ var config = {
16
+ networks: networks
17
+ };
18
+
19
+ type Address = `0x${string}`;
20
+ type Bytes32 = `0x${string}`;
21
+ type HexString = `0x${string}`;
22
+ type IntegerLike = string | number;
23
+ type HostedAuthResponseMode = 'web_message' | 'redirect';
24
+ type Network = keyof typeof config.networks;
25
+ interface NetworkConfig {
26
+ chainId: number;
27
+ name: string;
28
+ accountingContract: Address;
29
+ apiUrl: string;
30
+ }
31
+ declare const NETWORK_CONFIG: {
32
+ readonly testnet: {
33
+ readonly accountingContract: Address;
34
+ readonly chainId: number;
35
+ readonly name: string;
36
+ readonly apiUrl: string;
37
+ };
38
+ readonly mainnet: {
39
+ readonly accountingContract: Address;
40
+ readonly chainId: number;
41
+ readonly name: string;
42
+ readonly apiUrl: string;
43
+ };
44
+ };
45
+ declare function getChainId(network: Network): number;
46
+ declare function getAccountingContract(network: Network): Address;
47
+ declare function getApiUrl(network: Network): string;
48
+ declare function normalizeHex(value: string): HexString;
49
+ declare function normalizeAddress(value: string): Address;
50
+
51
+ interface TokenConfig {
52
+ id: Bytes32;
53
+ symbol: string;
54
+ decimals: number;
55
+ contract: Address;
56
+ name: string;
57
+ chainId: number;
58
+ }
59
+
60
+ type OnRampStatus = 'pending' | 'completed' | 'failed' | 'cancelled';
61
+ /** Request body / response of POST /api/onramp/sign-url */
62
+ interface SignOnRampUrlRequest {
63
+ url: string;
64
+ }
65
+ interface SignOnRampUrlResponse {
66
+ signature: string;
67
+ }
68
+ /** Request body / response of POST /api/onramp/intent. */
69
+ interface CreateOnRampIntentRequest {
70
+ wallet_address?: Address;
71
+ token_id: Bytes32;
72
+ chain_id: number;
73
+ moonpay_currency_code: string;
74
+ base_currency_code?: string;
75
+ base_currency_amount?: string;
76
+ }
77
+ type CreateOnRampIntentResponse = OnRampRecord;
78
+ /** Request body / response of POST /api/onramp/{id}. */
79
+ interface UpdateOnRampRequest {
80
+ wallet_address?: Address;
81
+ token_id?: Bytes32;
82
+ chain_id?: number;
83
+ moonpay_transaction_id?: string;
84
+ base_currency_code?: string;
85
+ base_currency_amount?: string;
86
+ quote_currency_amount?: string;
87
+ on_chain_tx_hash?: HexString;
88
+ deposit_tx_hash?: HexString;
89
+ }
90
+ type UpdateOnRampResponse = OnRampRecord;
91
+ interface OnRampRecord {
92
+ transaction_id: string;
93
+ external_transaction_id?: string;
94
+ moonpay_transaction_id?: string;
95
+ status: OnRampStatus;
96
+ wallet_address?: Address;
97
+ token_id?: Bytes32;
98
+ chain_id?: number;
99
+ moonpay_currency_code?: string;
100
+ base_currency_code?: string;
101
+ base_currency_amount?: string;
102
+ quote_currency_amount?: string;
103
+ on_chain_tx_hash?: HexString;
104
+ deposit_tx_hash?: HexString;
105
+ deposit_triggered_at?: number;
106
+ credited_at?: number;
107
+ created_at: number;
108
+ updated_at: number;
109
+ }
110
+ /** Response body of GET /api/onramp/pending */
111
+ interface PendingOnRampsResponse {
112
+ pending: OnRampRecord[];
113
+ }
114
+
115
+ export { type Address as A, type Bytes32 as B, type CreateOnRampIntentRequest as C, type HexString as H, type IntegerLike as I, type NetworkConfig as N, type OnRampRecord as O, type PendingOnRampsResponse as P, type SignOnRampUrlRequest as S, type TokenConfig as T, type UpdateOnRampRequest as U, type HostedAuthResponseMode as a, type SignOnRampUrlResponse as b, type CreateOnRampIntentResponse as c, type UpdateOnRampResponse as d, NETWORK_CONFIG as e, type Network as f, type OnRampStatus as g, getAccountingContract as h, getApiUrl as i, getChainId as j, normalizeHex as k, normalizeAddress as n };