@n1xyz/nord-ts 0.0.4 → 0.0.5
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/bridge/client.d.ts +4 -4
- package/dist/bridge/client.js +4 -4
- package/dist/bridge/const.d.ts +2 -2
- package/dist/bridge/const.js +22 -22
- package/dist/bridge/index.d.ts +4 -4
- package/dist/bridge/types.d.ts +3 -3
- package/dist/bridge/utils.d.ts +4 -4
- package/dist/bridge/utils.js +10 -10
- package/dist/const.d.ts +1 -1
- package/dist/const.js +17 -17
- package/dist/gen/nord.d.ts +1 -4
- package/dist/idl/bridge.d.ts +1 -1
- package/dist/idl/bridge.js +185 -185
- package/dist/index.d.ts +8 -8
- package/dist/nord/api/actions.d.ts +3 -3
- package/dist/nord/api/actions.js +21 -21
- package/dist/nord/api/core.d.ts +3 -3
- package/dist/nord/api/core.js +12 -12
- package/dist/nord/api/market.d.ts +1 -1
- package/dist/nord/api/market.js +12 -12
- package/dist/nord/api/metrics.d.ts +1 -1
- package/dist/nord/api/metrics.js +6 -6
- package/dist/nord/api/queries.d.ts +1 -1
- package/dist/nord/api/queries.js +9 -9
- package/dist/nord/client/Nord.d.ts +4 -4
- package/dist/nord/client/Nord.js +18 -18
- package/dist/nord/client/NordUser.d.ts +7 -7
- package/dist/nord/client/NordUser.js +45 -49
- package/dist/nord/index.d.ts +9 -9
- package/dist/nord/models/Subscriber.d.ts +6 -6
- package/dist/nord/models/Subscriber.js +1 -5
- package/dist/nord/utils/NordError.js +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utils.d.ts +6 -6
- package/dist/utils.js +8 -8
- package/dist/websocket/NordWebSocketClient.d.ts +2 -2
- package/dist/websocket/NordWebSocketClient.js +38 -38
- package/dist/websocket/events.d.ts +1 -1
- package/dist/websocket/index.d.ts +2 -2
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +16 -16
- package/docs/assets/icons.js +17 -14
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +5 -4
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +1423 -1227
- package/docs/classes/Nord.html +190 -31
- package/docs/classes/NordError.html +24 -0
- package/docs/classes/NordUser.html +120 -35
- package/docs/classes/NordWebSocketClient.html +335 -0
- package/docs/classes/SolanaBridgeClient.html +86 -0
- package/docs/classes/Subscriber.html +10 -0
- package/docs/enums/FillMode.html +5 -5
- package/docs/enums/KeyType.html +4 -4
- package/docs/enums/MetricPeriod.html +9 -0
- package/docs/enums/PdaSeedType.html +9 -0
- package/docs/enums/PeakTpsPeriodUnit.html +7 -7
- package/docs/enums/Side.html +3 -3
- package/docs/enums/WebSocketMessageType.html +7 -0
- package/docs/functions/actionQueryRollman.html +6 -0
- package/docs/functions/actionsQueryRollman.html +6 -0
- package/docs/functions/aggregateMetrics-1.html +7 -0
- package/docs/functions/assert.html +1 -1
- package/docs/functions/bigIntToProtoU128.html +3 -3
- package/docs/functions/blockQueryRollman.html +6 -0
- package/docs/functions/blockSummaryQueryRollman.html +6 -0
- package/docs/functions/bridgeToBN.html +5 -0
- package/docs/functions/bufferToHex.html +4 -0
- package/docs/functions/cancelOrder.html +1 -0
- package/docs/functions/checkPubKeyLength.html +1 -1
- package/docs/functions/checkedFetch.html +4 -4
- package/docs/functions/createSession.html +1 -0
- package/docs/functions/decodeLengthDelimited.html +7 -6
- package/docs/functions/encodeLengthDelimited.html +4 -4
- package/docs/functions/fillModeToProtoFillMode.html +4 -4
- package/docs/functions/findMarket.html +1 -1
- package/docs/functions/findPda.html +6 -0
- package/docs/functions/findToken.html +1 -1
- package/docs/functions/fromBN.html +5 -0
- package/docs/functions/getAccount.html +6 -0
- package/docs/functions/getActionNonce.html +5 -0
- package/docs/functions/getCurrentTps.html +6 -0
- package/docs/functions/getInfo.html +5 -0
- package/docs/functions/getMedianLatency.html +6 -0
- package/docs/functions/getOrderbook.html +6 -0
- package/docs/functions/getPeakTps.html +6 -0
- package/docs/functions/getTimestamp.html +5 -0
- package/docs/functions/getTotalTransactions.html +5 -0
- package/docs/functions/getTrades.html +6 -0
- package/docs/functions/getUserAccountIds.html +6 -0
- package/docs/functions/hexToBuffer.html +4 -0
- package/docs/functions/initWebSocketClient.html +12 -0
- package/docs/functions/keypairFromPrivateKey.html +4 -0
- package/docs/functions/makeSigningFunction.html +4 -0
- package/docs/functions/makeWalletSignFn.html +5 -5
- package/docs/functions/marketsStats.html +5 -0
- package/docs/functions/optExpect.html +4 -4
- package/docs/functions/optMap.html +5 -5
- package/docs/functions/optUnwrap.html +2 -2
- package/docs/functions/panic.html +1 -1
- package/docs/functions/placeOrder.html +1 -0
- package/docs/functions/queryAction.html +6 -0
- package/docs/functions/queryBlock.html +6 -0
- package/docs/functions/queryLastNBlocks.html +5 -0
- package/docs/functions/queryPrometheus.html +6 -0
- package/docs/functions/queryRecentActions.html +6 -0
- package/docs/functions/queryRecentBlocks.html +6 -0
- package/docs/functions/revokeSession.html +1 -0
- package/docs/functions/shortenPublicKey.html +5 -0
- package/docs/functions/signAction.html +2 -2
- package/docs/functions/toBN.html +5 -0
- package/docs/functions/toScaledU128.html +5 -5
- package/docs/functions/toScaledU64.html +5 -5
- package/docs/functions/transfer.html +1 -0
- package/docs/functions/withdraw.html +1 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +39 -20
- package/docs/interfaces/Account.html +8 -8
- package/docs/interfaces/ActionInfo.html +8 -8
- package/docs/interfaces/ActionNonceResponse.html +3 -0
- package/docs/interfaces/ActionQuery.html +4 -4
- package/docs/interfaces/ActionResponse.html +8 -8
- package/docs/interfaces/ActionsExtendedInfo.html +10 -10
- package/docs/interfaces/ActionsQuery.html +5 -5
- package/docs/interfaces/ActionsResponse.html +6 -6
- package/docs/interfaces/AggregateMetrics.html +12 -12
- package/docs/interfaces/BlockFacts.html +10 -0
- package/docs/interfaces/BlockQuery.html +6 -6
- package/docs/interfaces/BlockResponse.html +6 -6
- package/docs/interfaces/BlockSummary.html +8 -8
- package/docs/interfaces/BlockSummaryResponse.html +6 -6
- package/docs/interfaces/DeltaEvent.html +6 -6
- package/docs/interfaces/DepositSplParams.html +10 -0
- package/docs/interfaces/Info.html +3 -3
- package/docs/interfaces/Market.html +8 -6
- package/docs/interfaces/MarketStats.html +7 -7
- package/docs/interfaces/MarketsStatsResponse.html +2 -2
- package/docs/interfaces/NordConfig.html +14 -5
- package/docs/interfaces/NordWebSocketClientEvents.html +4 -0
- package/docs/interfaces/NordWebSocketEvents.html +8 -0
- package/docs/interfaces/Order.html +6 -6
- package/docs/interfaces/OrderInfo.html +6 -6
- package/docs/interfaces/OrderbookEntry.html +4 -0
- package/docs/interfaces/OrderbookQuery.html +6 -0
- package/docs/interfaces/OrderbookResponse.html +6 -0
- package/docs/interfaces/OrderbookSubscription.html +159 -0
- package/docs/interfaces/PerpMarketStats.html +5 -5
- package/docs/interfaces/RollmanActionExtendedInfo.html +4 -4
- package/docs/interfaces/RollmanActionInfo.html +4 -4
- package/docs/interfaces/RollmanActionResponse.html +4 -4
- package/docs/interfaces/RollmanActionsResponse.html +2 -2
- package/docs/interfaces/RollmanBlockResponse.html +3 -3
- package/docs/interfaces/SPLTokenInfo.html +10 -0
- package/docs/interfaces/SolanaBridgeConfig.html +10 -0
- package/docs/interfaces/StateFacts.html +10 -0
- package/docs/interfaces/SubscriberConfig.html +3 -3
- package/docs/interfaces/TimestampResponse.html +3 -0
- package/docs/interfaces/Token.html +5 -5
- package/docs/interfaces/TokenInfo.html +5 -0
- package/docs/interfaces/Trade.html +5 -5
- package/docs/interfaces/TradeSubscription.html +159 -0
- package/docs/interfaces/Trades.html +5 -5
- package/docs/interfaces/TradesQuery.html +6 -0
- package/docs/interfaces/TradesResponse.html +7 -0
- package/docs/interfaces/TransferParams.html +8 -0
- package/docs/interfaces/UserAccountIdsQuery.html +3 -0
- package/docs/interfaces/UserAccountIdsResponse.html +3 -0
- package/docs/interfaces/WebSocketDeltaUpdate.html +9 -0
- package/docs/interfaces/WebSocketSubscription.html +4 -0
- package/docs/interfaces/WebSocketTradeUpdate.html +6 -0
- package/docs/interfaces/WebSocketUserUpdate.html +6 -0
- package/docs/interfaces/WithdrawalClaim.html +14 -0
- package/docs/interfaces/WithdrawalParams.html +8 -0
- package/docs/modules.html +1 -70
- package/docs/types/BigIntValue.html +2 -2
- package/docs/types/WebSocketMessage.html +1 -0
- package/docs/variables/DEBUG_KEYS.html +1 -1
- package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -1
- package/docs/variables/DEV_TOKEN_INFOS.html +1 -1
- package/docs/variables/DEV_URL.html +1 -1
- package/docs/variables/MAX_BUFFER_LEN.html +1 -1
- package/docs/variables/SESSION_TTL.html +1 -1
- package/docs/variables/WEBSERVER_DEV_URL.html +1 -1
- package/docs/variables/ZERO_DECIMAL.html +1 -1
- package/docs/variables/_private.html +2 -0
- package/eslint.config.mjs +66 -0
- package/package.json +12 -13
- package/src/bridge/client.ts +10 -10
- package/src/bridge/const.ts +24 -24
- package/src/bridge/index.ts +4 -4
- package/src/bridge/types.ts +10 -10
- package/src/bridge/utils.ts +14 -14
- package/src/const.ts +18 -18
- package/src/gen/nord.ts +1 -4
- package/src/idl/bridge.ts +186 -186
- package/src/index.ts +8 -8
- package/src/nord/api/actions.ts +25 -25
- package/src/nord/api/core.ts +16 -16
- package/src/nord/api/market.ts +15 -15
- package/src/nord/api/metrics.ts +16 -16
- package/src/nord/api/queries.ts +12 -12
- package/src/nord/client/Nord.ts +27 -27
- package/src/nord/client/NordUser.ts +59 -63
- package/src/nord/index.ts +9 -9
- package/src/nord/models/Subscriber.ts +11 -12
- package/src/nord/utils/NordError.ts +2 -2
- package/src/types.ts +12 -12
- package/src/utils.ts +20 -20
- package/src/websocket/NordWebSocketClient.ts +42 -42
- package/src/websocket/events.ts +1 -1
- package/src/websocket/index.ts +2 -2
- package/tests/utils.spec.ts +24 -24
- package/tsconfig.eslint.json +12 -0
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -31
- package/dist/abis/ERC20_ABI.d.ts +0 -39
- package/dist/abis/ERC20_ABI.js +0 -313
- package/dist/abis/NORD_GETTERS_FACET_ABI.d.ts +0 -34
- package/dist/abis/NORD_GETTERS_FACET_ABI.js +0 -195
- package/dist/abis/NORD_RAMP_FACET_ABI.d.ts +0 -35
- package/dist/abis/NORD_RAMP_FACET_ABI.js +0 -144
- package/dist/abis/index.d.ts +0 -3
- package/dist/abis/index.js +0 -9
- package/dist/bridge/NordUser.d.ts +0 -78
- package/dist/bridge/NordUser.js +0 -196
- package/dist/client.d.ts +0 -70
- package/dist/client.js +0 -129
- package/dist/constants/endpoints.d.ts +0 -65
- package/dist/constants/endpoints.js +0 -68
- package/dist/models/account.d.ts +0 -58
- package/dist/models/account.js +0 -6
- package/dist/models/index.d.ts +0 -8
- package/dist/models/index.js +0 -28
- package/dist/models/market.d.ts +0 -137
- package/dist/models/market.js +0 -6
- package/dist/models/order.d.ts +0 -211
- package/dist/models/order.js +0 -6
- package/dist/models/token.d.ts +0 -50
- package/dist/models/token.js +0 -6
- package/dist/nord/Nord.d.ts +0 -249
- package/dist/nord/Nord.js +0 -388
- package/dist/nord/NordError.d.ts +0 -23
- package/dist/nord/NordError.js +0 -48
- package/dist/nord/NordImpl.d.ts +0 -11
- package/dist/nord/NordImpl.js +0 -26
- package/dist/nord/NordUser.d.ts +0 -243
- package/dist/nord/NordUser.js +0 -481
- package/dist/nord/Subscriber.d.ts +0 -37
- package/dist/nord/Subscriber.js +0 -29
- package/dist/nord/actions.d.ts +0 -101
- package/dist/nord/actions.js +0 -254
- package/dist/nord/api/index.d.ts +0 -1
- package/dist/nord/api/index.js +0 -17
- package/dist/nord/api/orderFunctions.d.ts +0 -168
- package/dist/nord/api/orderFunctions.js +0 -133
- package/dist/nord/core.d.ts +0 -48
- package/dist/nord/core.js +0 -97
- package/dist/nord/market.d.ts +0 -36
- package/dist/nord/market.js +0 -90
- package/dist/nord/metrics.d.ts +0 -67
- package/dist/nord/metrics.js +0 -124
- package/dist/nord/queries.d.ts +0 -81
- package/dist/nord/queries.js +0 -181
- package/dist/nord/types.d.ts +0 -88
- package/dist/nord/types.js +0 -2
- package/dist/nord/websocket.d.ts +0 -49
- package/dist/nord/websocket.js +0 -107
- package/dist/operations/account.d.ts +0 -58
- package/dist/operations/account.js +0 -112
- package/dist/operations/market.d.ts +0 -65
- package/dist/operations/market.js +0 -131
- package/dist/operations/orders.d.ts +0 -57
- package/dist/operations/orders.js +0 -129
- package/dist/solana/NordUser.d.ts +0 -78
- package/dist/solana/NordUser.js +0 -196
- package/dist/solana/client.d.ts +0 -139
- package/dist/solana/client.js +0 -360
- package/dist/solana/const.d.ts +0 -23
- package/dist/solana/const.js +0 -47
- package/dist/solana/index.d.ts +0 -5
- package/dist/solana/index.js +0 -23
- package/dist/solana/types.d.ts +0 -118
- package/dist/solana/types.js +0 -16
- package/dist/solana/utils.d.ts +0 -64
- package/dist/solana/utils.js +0 -131
- package/dist/types/api.d.ts +0 -152
- package/dist/types/api.js +0 -6
- package/dist/types/config.d.ts +0 -34
- package/dist/types/config.js +0 -6
- package/dist/utils/errors.d.ts +0 -96
- package/dist/utils/errors.js +0 -132
- package/dist/utils/http.d.ts +0 -35
- package/dist/utils/http.js +0 -105
- package/dist/websocket/client.d.ts +0 -93
- package/dist/websocket/client.js +0 -222
- package/dist/websocket.d.ts +0 -55
- package/dist/websocket.js +0 -211
- package/docs/interfaces/ERC20TokenInfo.html +0 -5
- package/docs/variables/DEV_CONTRACT_ADDRESS.html +0 -1
- package/docs/variables/ERC20_ABI.html +0 -1
- package/docs/variables/EVM_DEV_URL.html +0 -1
- package/docs/variables/FAUCET_PRIVATE_ADDRESS.html +0 -1
- package/docs/variables/NORD_GETTERS_FACET_ABI.html +0 -1
- package/docs/variables/NORD_RAMP_FACET_ABI.html +0 -1
package/dist/bridge/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as anchor from
|
|
2
|
-
import { AnchorProvider } from
|
|
3
|
-
import { Connection, Keypair, PublicKey } from
|
|
4
|
-
import { BlockFacts, DepositSplParams, PdaSeedType, SolanaBridgeConfig, WithdrawalParams } from
|
|
1
|
+
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
+
import { AnchorProvider } from "@coral-xyz/anchor";
|
|
3
|
+
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
|
|
4
|
+
import { BlockFacts, DepositSplParams, PdaSeedType, SolanaBridgeConfig, WithdrawalParams } from "./types";
|
|
5
5
|
/**
|
|
6
6
|
* Solana Bridge Client for interacting with the bridge program
|
|
7
7
|
*/
|
package/dist/bridge/client.js
CHANGED
|
@@ -82,10 +82,10 @@ class SolanaBridgeClient {
|
|
|
82
82
|
if (seed instanceof web3_js_1.PublicKey) {
|
|
83
83
|
return seed.toBuffer();
|
|
84
84
|
}
|
|
85
|
-
else if (typeof seed ===
|
|
85
|
+
else if (typeof seed === "string") {
|
|
86
86
|
return Buffer.from(seed);
|
|
87
87
|
}
|
|
88
|
-
else if (typeof seed ===
|
|
88
|
+
else if (typeof seed === "number") {
|
|
89
89
|
// Convert number to little-endian byte array (8 bytes for u64)
|
|
90
90
|
const buffer = Buffer.alloc(8);
|
|
91
91
|
buffer.writeBigUInt64LE(BigInt(seed), 0);
|
|
@@ -204,7 +204,7 @@ class SolanaBridgeClient {
|
|
|
204
204
|
try {
|
|
205
205
|
await this.connection.getTokenAccountBalance(params.toAccount);
|
|
206
206
|
}
|
|
207
|
-
catch
|
|
207
|
+
catch {
|
|
208
208
|
// Account doesn't exist, add instruction to create it
|
|
209
209
|
// Get the authority PDA which is the owner of the toAccount
|
|
210
210
|
const [authority] = await this.findAuthorityPda();
|
|
@@ -382,7 +382,7 @@ class SolanaBridgeClient {
|
|
|
382
382
|
try {
|
|
383
383
|
await this.connection.getTokenAccountBalance(associatedTokenAddress);
|
|
384
384
|
}
|
|
385
|
-
catch
|
|
385
|
+
catch {
|
|
386
386
|
// Account doesn't exist, create it
|
|
387
387
|
const transaction = new web3_js_1.Transaction().add((0, spl_token_1.createAssociatedTokenAccountInstruction)(payer.publicKey, associatedTokenAddress, owner, mint));
|
|
388
388
|
// Sign and send the transaction using our helper method
|
package/dist/bridge/const.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SPLTokenInfo } from
|
|
2
|
-
import { Commitment } from
|
|
1
|
+
import { SPLTokenInfo } from "./types";
|
|
2
|
+
import { Commitment } from "@solana/web3.js";
|
|
3
3
|
export declare const SOLANA_MAINNET_URL = "https://api.mainnet-beta.solana.com";
|
|
4
4
|
export declare const SOLANA_DEVNET_URL = "https://api.devnet.solana.com";
|
|
5
5
|
export declare const SOLANA_TESTNET_URL = "https://api.testnet.solana.com";
|
package/dist/bridge/const.js
CHANGED
|
@@ -2,46 +2,46 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PDA_SEEDS = exports.DEFAULT_FUNDING_AMOUNTS = exports.DEV_TOKEN_INFOS = exports.SOLANA_PROGRAM_ID = exports.WEBSERVER_DEV_URL = exports.DEV_URL = exports.DEFAULT_COMMITMENT = exports.SOLANA_LOCALNET_URL = exports.SOLANA_TESTNET_URL = exports.SOLANA_DEVNET_URL = exports.SOLANA_MAINNET_URL = void 0;
|
|
4
4
|
// Solana RPC endpoints
|
|
5
|
-
exports.SOLANA_MAINNET_URL =
|
|
6
|
-
exports.SOLANA_DEVNET_URL =
|
|
7
|
-
exports.SOLANA_TESTNET_URL =
|
|
8
|
-
exports.SOLANA_LOCALNET_URL =
|
|
5
|
+
exports.SOLANA_MAINNET_URL = "https://api.mainnet-beta.solana.com";
|
|
6
|
+
exports.SOLANA_DEVNET_URL = "https://api.devnet.solana.com";
|
|
7
|
+
exports.SOLANA_TESTNET_URL = "https://api.testnet.solana.com";
|
|
8
|
+
exports.SOLANA_LOCALNET_URL = "http://localhost:8899";
|
|
9
9
|
// Default commitment level
|
|
10
|
-
exports.DEFAULT_COMMITMENT =
|
|
10
|
+
exports.DEFAULT_COMMITMENT = "confirmed";
|
|
11
11
|
// Webserver configuration
|
|
12
|
-
const WEBSERVER_PORT =
|
|
13
|
-
exports.DEV_URL =
|
|
14
|
-
exports.WEBSERVER_DEV_URL = exports.DEV_URL +
|
|
12
|
+
const WEBSERVER_PORT = "80";
|
|
13
|
+
exports.DEV_URL = "http://localhost";
|
|
14
|
+
exports.WEBSERVER_DEV_URL = exports.DEV_URL + ":" + WEBSERVER_PORT;
|
|
15
15
|
// Program ID (will be supplied externally)
|
|
16
|
-
exports.SOLANA_PROGRAM_ID =
|
|
16
|
+
exports.SOLANA_PROGRAM_ID = "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB";
|
|
17
17
|
// Sample token information for development
|
|
18
18
|
exports.DEV_TOKEN_INFOS = [
|
|
19
19
|
{
|
|
20
|
-
mint:
|
|
20
|
+
mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC on devnet
|
|
21
21
|
precision: 6,
|
|
22
22
|
tokenId: 0,
|
|
23
|
-
name:
|
|
23
|
+
name: "usdc",
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
mint:
|
|
26
|
+
mint: "So11111111111111111111111111111111111111112", // Wrapped SOL
|
|
27
27
|
precision: 9,
|
|
28
28
|
tokenId: 1,
|
|
29
|
-
name:
|
|
29
|
+
name: "sol",
|
|
30
30
|
},
|
|
31
31
|
];
|
|
32
32
|
// Default funding amounts for development
|
|
33
33
|
exports.DEFAULT_FUNDING_AMOUNTS = {
|
|
34
|
-
SOL: [
|
|
34
|
+
SOL: ["0.2", 9],
|
|
35
35
|
// USDC mint address
|
|
36
|
-
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v: [
|
|
36
|
+
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v: ["10000", 6],
|
|
37
37
|
};
|
|
38
38
|
// PDA seed constants
|
|
39
39
|
exports.PDA_SEEDS = {
|
|
40
|
-
CONTRACT_STORAGE:
|
|
41
|
-
ASSET_WHITELISTED:
|
|
42
|
-
DEPOSIT_STORAGE:
|
|
43
|
-
BLOCK_STORAGE:
|
|
44
|
-
WITHDRAWAL_NULLIFIER:
|
|
45
|
-
AUTHORITY:
|
|
46
|
-
DA_FACT_STORAGE:
|
|
40
|
+
CONTRACT_STORAGE: "contract_storage",
|
|
41
|
+
ASSET_WHITELISTED: "asset_whitelisted",
|
|
42
|
+
DEPOSIT_STORAGE: "deposit_storage",
|
|
43
|
+
BLOCK_STORAGE: "block_storage",
|
|
44
|
+
WITHDRAWAL_NULLIFIER: "withdrawal_nullifier",
|
|
45
|
+
AUTHORITY: "authority",
|
|
46
|
+
DA_FACT_STORAGE: "da_fact_storage",
|
|
47
47
|
};
|
package/dist/bridge/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
import { BRIDGE_IDL } from
|
|
1
|
+
export * from "./client";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
export * from "./utils";
|
|
4
|
+
import { BRIDGE_IDL } from "../idl/bridge";
|
|
5
5
|
export { BRIDGE_IDL };
|
package/dist/bridge/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PublicKey } from
|
|
2
|
-
import { BN } from
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
import { BN } from "@coral-xyz/anchor";
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for Solana bridge
|
|
5
5
|
*/
|
|
@@ -9,7 +9,7 @@ export interface SolanaBridgeConfig {
|
|
|
9
9
|
/** Program ID for the bridge program */
|
|
10
10
|
programId: string;
|
|
11
11
|
/** Commitment level for transactions */
|
|
12
|
-
commitment:
|
|
12
|
+
commitment: "processed" | "confirmed" | "finalized";
|
|
13
13
|
/** Token information for supported SPL tokens */
|
|
14
14
|
tokenInfos: SPLTokenInfo[];
|
|
15
15
|
}
|
package/dist/bridge/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Keypair, PublicKey } from
|
|
2
|
-
import { BN } from
|
|
3
|
-
import { PdaSeedType } from
|
|
1
|
+
import { Keypair, PublicKey } from "@solana/web3.js";
|
|
2
|
+
import { BN } from "@coral-xyz/anchor";
|
|
3
|
+
import { PdaSeedType } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* Convert a private key string to a Solana Keypair
|
|
6
6
|
*
|
|
@@ -14,7 +14,7 @@ export declare function keypairFromPrivateKey(privateKey: string | Uint8Array):
|
|
|
14
14
|
* @param keypair Solana keypair
|
|
15
15
|
* @returns Signing function
|
|
16
16
|
*/
|
|
17
|
-
export declare function makeSigningFunction(keypair: Keypair): (
|
|
17
|
+
export declare function makeSigningFunction(keypair: Keypair): (_message: Uint8Array) => Promise<Uint8Array>;
|
|
18
18
|
/**
|
|
19
19
|
* Convert a number to a BN with the specified number of decimals
|
|
20
20
|
*
|
package/dist/bridge/utils.js
CHANGED
|
@@ -21,13 +21,13 @@ const bs58_1 = __importDefault(require("bs58"));
|
|
|
21
21
|
* @returns Solana Keypair
|
|
22
22
|
*/
|
|
23
23
|
function keypairFromPrivateKey(privateKey) {
|
|
24
|
-
if (typeof privateKey ===
|
|
24
|
+
if (typeof privateKey === "string") {
|
|
25
25
|
// Check if it's a base58 encoded string
|
|
26
|
-
if (!privateKey.startsWith(
|
|
26
|
+
if (!privateKey.startsWith("0x")) {
|
|
27
27
|
return web3_js_1.Keypair.fromSecretKey(bs58_1.default.decode(privateKey));
|
|
28
28
|
}
|
|
29
29
|
// It's a hex string
|
|
30
|
-
const hex = privateKey.startsWith(
|
|
30
|
+
const hex = privateKey.startsWith("0x") ? privateKey.slice(2) : privateKey;
|
|
31
31
|
const bytes = new Uint8Array(hex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
|
|
32
32
|
return web3_js_1.Keypair.fromSecretKey(bytes);
|
|
33
33
|
}
|
|
@@ -41,7 +41,7 @@ function keypairFromPrivateKey(privateKey) {
|
|
|
41
41
|
* @returns Signing function
|
|
42
42
|
*/
|
|
43
43
|
function makeSigningFunction(keypair) {
|
|
44
|
-
return async (
|
|
44
|
+
return async (_message) => {
|
|
45
45
|
// Use the correct API for signing with a Keypair
|
|
46
46
|
const signature = keypair.secretKey.slice(0, 32);
|
|
47
47
|
const publicKey = keypair.publicKey.toBytes();
|
|
@@ -88,10 +88,10 @@ function findPda(programId, type, ...seeds) {
|
|
|
88
88
|
if (seed instanceof web3_js_1.PublicKey) {
|
|
89
89
|
return seed.toBuffer();
|
|
90
90
|
}
|
|
91
|
-
else if (typeof seed ===
|
|
91
|
+
else if (typeof seed === "string") {
|
|
92
92
|
return Buffer.from(seed);
|
|
93
93
|
}
|
|
94
|
-
else if (typeof seed ===
|
|
94
|
+
else if (typeof seed === "number") {
|
|
95
95
|
return Buffer.from([seed]);
|
|
96
96
|
}
|
|
97
97
|
return seed;
|
|
@@ -106,7 +106,7 @@ function findPda(programId, type, ...seeds) {
|
|
|
106
106
|
* @returns Hex string
|
|
107
107
|
*/
|
|
108
108
|
function bufferToHex(buffer) {
|
|
109
|
-
return
|
|
109
|
+
return "0x" + Buffer.from(buffer).toString("hex");
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
112
|
* Convert a hex string to a buffer
|
|
@@ -115,8 +115,8 @@ function bufferToHex(buffer) {
|
|
|
115
115
|
* @returns Buffer
|
|
116
116
|
*/
|
|
117
117
|
function hexToBuffer(hex) {
|
|
118
|
-
const hexString = hex.startsWith(
|
|
119
|
-
return Buffer.from(hexString,
|
|
118
|
+
const hexString = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
119
|
+
return Buffer.from(hexString, "hex");
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
122
|
* Shorten a public key for display
|
|
@@ -126,6 +126,6 @@ function hexToBuffer(hex) {
|
|
|
126
126
|
* @returns Shortened public key
|
|
127
127
|
*/
|
|
128
128
|
function shortenPublicKey(publicKey, chars = 4) {
|
|
129
|
-
const key = typeof publicKey ===
|
|
129
|
+
const key = typeof publicKey === "string" ? publicKey : publicKey.toBase58();
|
|
130
130
|
return `${key.slice(0, chars)}...${key.slice(-chars)}`;
|
|
131
131
|
}
|
package/dist/const.d.ts
CHANGED
package/dist/const.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_FUNDING_AMOUNTS = exports.DEV_TOKEN_INFOS = exports.WEBSERVER_DEV_URL = exports.DEV_URL = exports.DEBUG_KEYS = void 0;
|
|
4
|
-
const WEBSERVER_PORT =
|
|
4
|
+
const WEBSERVER_PORT = "80";
|
|
5
5
|
exports.DEBUG_KEYS = [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
|
|
7
|
+
"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
|
|
8
|
+
"0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a",
|
|
9
|
+
"0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6",
|
|
10
|
+
"0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a",
|
|
11
|
+
"0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba",
|
|
12
|
+
"0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e",
|
|
13
|
+
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356",
|
|
14
|
+
"0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97",
|
|
15
|
+
"0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6",
|
|
16
16
|
];
|
|
17
|
-
exports.DEV_URL =
|
|
18
|
-
exports.WEBSERVER_DEV_URL = exports.DEV_URL +
|
|
17
|
+
exports.DEV_URL = "http://localhost";
|
|
18
|
+
exports.WEBSERVER_DEV_URL = exports.DEV_URL + ":" + WEBSERVER_PORT;
|
|
19
19
|
exports.DEV_TOKEN_INFOS = [
|
|
20
20
|
{
|
|
21
|
-
address:
|
|
21
|
+
address: "0x9a9f2ccfde556a7e9ff0848998aa4a0cfd8863ae",
|
|
22
22
|
precision: 6,
|
|
23
23
|
tokenId: 0,
|
|
24
|
-
name:
|
|
24
|
+
name: "usdc",
|
|
25
25
|
},
|
|
26
26
|
];
|
|
27
27
|
exports.DEFAULT_FUNDING_AMOUNTS = {
|
|
28
|
-
SOL: [
|
|
29
|
-
|
|
28
|
+
SOL: ["0.2", 0],
|
|
29
|
+
"0x9a9f2ccfde556a7e9ff0848998aa4a0cfd8863ae": ["10000", 6],
|
|
30
30
|
};
|
package/dist/gen/nord.d.ts
CHANGED
|
@@ -450,10 +450,7 @@ export interface Action_CancelOrderById {
|
|
|
450
450
|
senderAccountId?: number | undefined;
|
|
451
451
|
}
|
|
452
452
|
export interface Action_Deposit {
|
|
453
|
-
/**
|
|
454
|
-
* used for integration of rollup with nord app
|
|
455
|
-
* todo(n1): remove when integrated with gate
|
|
456
|
-
*/
|
|
453
|
+
/** used for integration of rollup with nord app */
|
|
457
454
|
actionNonce: bigint;
|
|
458
455
|
tokenAddr: Uint8Array;
|
|
459
456
|
/** Shifted by the token's decimals. */
|
package/dist/idl/bridge.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Idl } from
|
|
1
|
+
import { Idl } from "@coral-xyz/anchor";
|
|
2
2
|
export declare const BRIDGE_IDL: Idl;
|