signet.js 0.0.1-beta.1 → 0.0.1-beta.3

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "signet.js",
3
- "version": "0.0.1-beta.1",
3
+ "version": "0.0.1-beta.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "types": "./src/index.d.ts",
8
8
  "scripts": {
9
- "build": "tsc --project tsconfig.json",
9
+ "build": "tsc --project tsconfig.json && tsc-alias",
10
10
  "pre:deploy": "npm run build && cp package.json README.md dist/",
11
11
  "publish-npm": "npm run pre:deploy && cd dist && npm publish",
12
12
  "publish-npm:beta": "npm run pre:deploy && cd dist && npm publish --tag beta",
@@ -35,6 +35,7 @@
35
35
  "jest": "^29.7.0",
36
36
  "prettier": "^3.2.5",
37
37
  "ts-node": "^10.9.2",
38
+ "tsc-alias": "^1.8.10",
38
39
  "typescript": "^5.4.3",
39
40
  "vocs": "1.0.0-alpha.62"
40
41
  },
@@ -1,4 +1,4 @@
1
- import type { BTCTransaction, BTCInput, BTCOutput } from '@chains';
1
+ import type { BTCTransaction, BTCInput, BTCOutput } from '../../index.js';
2
2
  export declare abstract class BTCRpcAdapter {
3
3
  abstract selectUTXOs(from: string, targets: BTCOutput[]): Promise<{
4
4
  inputs: BTCInput[];
@@ -1,5 +1,5 @@
1
- import { BTCRpcAdapter } from '@chains';
2
- import type { BTCTransaction, BTCInput, BTCOutput } from '@chains';
1
+ import { BTCRpcAdapter } from '../../../Bitcoin/BTCRpcAdapter';
2
+ import type { BTCTransaction, BTCInput, BTCOutput } from '../../../Bitcoin/types';
3
3
  export declare class Mempool extends BTCRpcAdapter {
4
4
  private readonly providerUrl;
5
5
  constructor(providerUrl: string);
@@ -2,7 +2,7 @@
2
2
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
3
  // @ts-expect-error
4
4
  import coinselect from 'coinselect';
5
- import { BTCRpcAdapter } from '@chains';
5
+ import { BTCRpcAdapter } from '../../../Bitcoin/BTCRpcAdapter';
6
6
  export class Mempool extends BTCRpcAdapter {
7
7
  constructor(providerUrl) {
8
8
  super();
@@ -1,6 +1,6 @@
1
1
  import * as bitcoin from 'bitcoinjs-lib';
2
- import type { MPCPayloads, RSVSignature, KeyDerivationPath, ChainSignatureContract, BTCRpcAdapter, BTCNetworkIds, BTCTransactionRequest, BTCUnsignedTransaction } from '@chains';
3
- import { Chain } from '@chains';
2
+ import type { MPCPayloads, RSVSignature, KeyDerivationPath, ChainSignatureContract, BTCRpcAdapter, BTCNetworkIds, BTCTransactionRequest, BTCUnsignedTransaction } from '../index.js';
3
+ import { Chain } from '../index.js';
4
4
  /**
5
5
  * Implementation of the Chain interface for Bitcoin network.
6
6
  * Handles interactions with both Bitcoin mainnet and testnet, supporting P2WPKH transactions.
@@ -1,6 +1,6 @@
1
1
  import * as bitcoin from 'bitcoinjs-lib';
2
- import { Chain, utils } from '@chains';
3
- import { parseBTCNetwork } from '@chains/Bitcoin/utils';
2
+ import { Chain, utils } from '../index.js';
3
+ import { parseBTCNetwork } from '../Bitcoin/utils';
4
4
  /**
5
5
  * Implementation of the Chain interface for Bitcoin network.
6
6
  * Handles interactions with both Bitcoin mainnet and testnet, supporting P2WPKH transactions.
@@ -1,4 +1,4 @@
1
- import type { KeyDerivationPath, MPCPayloads, RSVSignature } from '@chains';
1
+ import type { KeyDerivationPath, MPCPayloads, RSVSignature } from './index.js';
2
2
  /**
3
3
  * Core interface for blockchain implementations.
4
4
  * Provides a standardized way to interact with different blockchain networks through a common set of methods.
@@ -1,5 +1,5 @@
1
1
  import type BN from 'bn.js';
2
- import type { RSVSignature, UncompressedPubKeySEC1 } from '@chains';
2
+ import type { RSVSignature, UncompressedPubKeySEC1 } from './index.js';
3
3
  /**
4
4
  * Arguments for the sign method
5
5
  */
@@ -1,5 +1,5 @@
1
- import type { MPCPayloads, RSVSignature, KeyDerivationPath, CosmosNetworkIds, CosmosTransactionRequest, CosmosUnsignedTransaction, ChainSignatureContract } from '@chains';
2
- import { Chain } from '@chains';
1
+ import type { MPCPayloads, RSVSignature, KeyDerivationPath, CosmosNetworkIds, CosmosTransactionRequest, CosmosUnsignedTransaction, ChainSignatureContract } from '../index.js';
2
+ import { Chain } from '../index.js';
3
3
  /**
4
4
  * Implementation of the Chain interface for Cosmos-based networks.
5
5
  * Handles interactions with Cosmos SDK chains like Cosmos Hub, Osmosis, etc.
@@ -6,8 +6,8 @@ import { GasPrice, StargateClient, calculateFee } from '@cosmjs/stargate';
6
6
  import { bech32 } from 'bech32';
7
7
  import { SignMode } from 'cosmjs-types/cosmos/tx/signing/v1beta1/signing';
8
8
  import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
9
- import { Chain, utils } from '@chains';
10
- import { fetchChainInfo } from '@chains/Cosmos/utils';
9
+ import { Chain, utils } from '../index.js';
10
+ import { fetchChainInfo } from '../Cosmos/utils';
11
11
  /**
12
12
  * Implementation of the Chain interface for Cosmos-based networks.
13
13
  * Handles interactions with Cosmos SDK chains like Cosmos Hub, Osmosis, etc.
@@ -1,2 +1,2 @@
1
- import { type ChainInfo } from '@chains/Cosmos/types';
1
+ import { type ChainInfo } from '../Cosmos/types';
2
2
  export declare const fetchChainInfo: (chainId: string) => Promise<ChainInfo>;
@@ -1,5 +1,5 @@
1
- import { type MPCPayloads, type RSVSignature, type KeyDerivationPath, type EVMTransactionRequest, type EVMUnsignedTransaction, type ChainSignatureContract } from '@chains';
2
- import { Chain } from '@chains';
1
+ import { type MPCPayloads, type RSVSignature, type KeyDerivationPath, type EVMTransactionRequest, type EVMUnsignedTransaction, type ChainSignatureContract } from '../index.js';
2
+ import { Chain } from '../index.js';
3
3
  /**
4
4
  * Implementation of the Chain interface for EVM-compatible networks.
5
5
  * Handles interactions with Ethereum Virtual Machine based blockchains like Ethereum, BSC, Polygon, etc.
@@ -1,6 +1,6 @@
1
1
  import { fromHex } from '@cosmjs/encoding';
2
2
  import { ethers, keccak256 } from 'ethers';
3
- import { Chain, fetchEVMFeeProperties } from '@chains';
3
+ import { Chain, fetchEVMFeeProperties } from '../index.js';
4
4
  /**
5
5
  * Implementation of the Chain interface for EVM-compatible networks.
6
6
  * Handles interactions with Ethereum Virtual Machine based blockchains like Ethereum, BSC, Polygon, etc.
@@ -1,4 +1,4 @@
1
- import { type SignArgs } from '@chains';
1
+ import { type SignArgs } from './index.js';
2
2
  interface SuccessResponse {
3
3
  transactionHash: string;
4
4
  success: true;
@@ -1,4 +1,4 @@
1
- import { type MPCSignature, type RSVSignature, type UncompressedPubKeySEC1 } from '@chains';
1
+ import { type MPCSignature, type RSVSignature, type UncompressedPubKeySEC1 } from './index.js';
2
2
  export declare const toRSV: (signature: MPCSignature) => RSVSignature;
3
3
  /**
4
4
  * Compresses an uncompressed public key to its compressed format following SEC1 standards.
@@ -1,7 +1,7 @@
1
1
  import { Account, Connection } from '@near-js/accounts';
2
2
  import { KeyPair } from '@near-js/crypto';
3
3
  import { InMemoryKeyStore } from '@near-js/keystores';
4
- import { DONT_CARE_ACCOUNT_ID } from '@utils/chains/near/constants';
4
+ import { DONT_CARE_ACCOUNT_ID } from '../../chains/near/constants';
5
5
  export const getNearAccount = async ({ networkId, accountId = DONT_CARE_ACCOUNT_ID, keypair = KeyPair.fromRandom('ed25519'), }) => {
6
6
  const keyStore = new InMemoryKeyStore();
7
7
  await keyStore.setKey(networkId, accountId, keypair);
@@ -1,9 +1,9 @@
1
1
  import { type Account } from '@near-js/accounts';
2
2
  import { KeyPair } from '@near-js/crypto';
3
3
  import BN from 'bn.js';
4
- import { ChainSignatureContract } from '@chains';
5
- import type { RSVSignature, UncompressedPubKeySEC1, SignArgs } from '@chains';
6
- import { type NearNetworkIds, type ChainSignatureContractIds } from '@utils/chains/near/types';
4
+ import { ChainSignatureContract } from '../../../chains/index.js';
5
+ import type { RSVSignature, UncompressedPubKeySEC1, SignArgs } from '../../../chains/index.js';
6
+ import { type NearNetworkIds, type ChainSignatureContractIds } from '../../chains/near/types';
7
7
  interface ChainSignatureContractArgs {
8
8
  networkId: NearNetworkIds;
9
9
  contractId: ChainSignatureContractIds;
@@ -3,11 +3,11 @@ import { KeyPair } from '@near-js/crypto';
3
3
  import { actionCreators } from '@near-js/transactions';
4
4
  import BN from 'bn.js';
5
5
  import { base_decode } from 'near-api-js/lib/utils/serialize';
6
- import { ChainSignatureContract, utils } from '@chains';
7
- import { chains } from '@utils';
8
- import { getNearAccount } from '@utils/chains/near/account';
9
- import { DONT_CARE_ACCOUNT_ID, NEAR_MAX_GAS, } from '@utils/chains/near/constants';
10
- import { parseSignedDelegateForRelayer } from '@utils/chains/near/relayer';
6
+ import { ChainSignatureContract, utils } from '../../../chains/index.js';
7
+ import { chains } from '../../index.js';
8
+ import { getNearAccount } from '../../chains/near/account';
9
+ import { DONT_CARE_ACCOUNT_ID, NEAR_MAX_GAS, } from '../../chains/near/constants';
10
+ import { parseSignedDelegateForRelayer } from '../../chains/near/relayer';
11
11
  const najToUncompressedPubKey = (najPubKey) => {
12
12
  return `04${Buffer.from(base_decode(najPubKey.split(':')[1])).toString('hex')}`;
13
13
  };
@@ -1,6 +1,6 @@
1
1
  import { type KeyPair } from '@near-js/crypto';
2
- import { type Response } from '@chains';
3
- import { type BitcoinRequest, type CosmosRequest, type EVMRequest } from '@utils/chains/near/types';
2
+ import { type Response } from '../../../../chains/index.js';
3
+ import { type BitcoinRequest, type CosmosRequest, type EVMRequest } from '../../../chains/near/types';
4
4
  export declare const EVMTransaction: (req: EVMRequest, keyPair: KeyPair) => Promise<Response>;
5
5
  export declare const BTCTransaction: (req: BitcoinRequest, keyPair: KeyPair) => Promise<Response>;
6
6
  export declare const CosmosTransaction: (req: CosmosRequest, keyPair: KeyPair) => Promise<Response>;
@@ -1,6 +1,6 @@
1
- import { Bitcoin, Cosmos, EVM, BTCRpcAdapters } from '@chains';
2
- import { getNearAccount } from '@utils/chains/near/account';
3
- import { NearChainSignatureContract } from '@utils/chains/near/contract';
1
+ import { Bitcoin, Cosmos, EVM, BTCRpcAdapters } from '../../../../chains/index.js';
2
+ import { getNearAccount } from '../../../chains/near/account';
3
+ import { NearChainSignatureContract } from '../../../chains/near/contract';
4
4
  export const EVMTransaction = async (req, keyPair) => {
5
5
  try {
6
6
  const account = await getNearAccount({
@@ -1,6 +1,6 @@
1
1
  import type { Action, FinalExecutionOutcome, NetworkId } from '@near-wallet-selector/core';
2
- import { type RSVSignature, type KeyDerivationPath, type MPCPayloads } from '@chains';
3
- import { type NFTKeysContracts, type ChainSignatureContractIds } from '@utils/chains/near/types';
2
+ import { type RSVSignature, type KeyDerivationPath, type MPCPayloads } from '../../../chains/index.js';
3
+ import { type NFTKeysContracts, type ChainSignatureContractIds } from '../../chains/near/types';
4
4
  export declare const mpcPayloadsToChainSigTransaction: ({ networkId, contractId, mpcPayloads, path, }: {
5
5
  networkId: NetworkId;
6
6
  contractId: ChainSignatureContractIds;
@@ -1,7 +1,7 @@
1
1
  import BN from 'bn.js';
2
- import { utils } from '@chains';
3
- import { NEAR_MAX_GAS } from '@utils/chains/near/constants';
4
- import { NearChainSignatureContract } from '@utils/chains/near/contract';
2
+ import { utils } from '../../../chains/index.js';
3
+ import { NEAR_MAX_GAS } from '../../chains/near/constants';
4
+ import { NearChainSignatureContract } from '../../chains/near/contract';
5
5
  export const mpcPayloadsToChainSigTransaction = async ({ networkId, contractId, mpcPayloads, path, }) => {
6
6
  const contract = new NearChainSignatureContract({
7
7
  networkId,
@@ -1,4 +1,4 @@
1
- import { type BTCTransactionRequest, type BTCNetworkIds, type CosmosNetworkIds, type CosmosTransactionRequest, type EVMTransactionRequest, type KeyDerivationPath } from '@chains';
1
+ import { type BTCTransactionRequest, type BTCNetworkIds, type CosmosNetworkIds, type CosmosTransactionRequest, type EVMTransactionRequest, type KeyDerivationPath } from '../../../chains/index.js';
2
2
  /**
3
3
  Available ChainSignature contracts:
4
4
  - Mainnet: v1.signer