├── .nojekyll
├── .nvmrc
├── .husky
└── pre-push
├── .npmignore
├── packages
├── core
│ ├── .gitignore
│ ├── src
│ │ ├── address
│ │ │ ├── index.ts
│ │ │ ├── __tests__
│ │ │ │ ├── ensureReedSolomonAddress.spec.ts
│ │ │ │ └── convertReedSolomonAddressToNumericId.spec.ts
│ │ │ └── ensureReedSolomonAddress.ts
│ │ ├── ledgerClient
│ │ │ └── index.ts
│ │ ├── internal
│ │ │ ├── verifyTransaction
│ │ │ │ ├── index.ts
│ │ │ │ ├── baseTransaction.ts
│ │ │ │ └── __tests__
│ │ │ │ │ └── getAttachmentFields.spec.ts
│ │ │ └── index.ts
│ │ ├── attachment
│ │ │ ├── index.ts
│ │ │ └── getAttachmentVersion.ts
│ │ ├── service
│ │ │ └── index.ts
│ │ ├── api
│ │ │ ├── factories
│ │ │ │ ├── message
│ │ │ │ │ └── index.ts
│ │ │ │ ├── block
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── getBlockId.ts
│ │ │ │ │ ├── getBlockByTimestamp.ts
│ │ │ │ │ ├── getBlockById.ts
│ │ │ │ │ ├── getBlockByHeight.ts
│ │ │ │ │ └── getBlocks.ts
│ │ │ │ ├── network
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── getMiningInfo.ts
│ │ │ │ │ ├── getNetworkInfo.ts
│ │ │ │ │ ├── getPeer.ts
│ │ │ │ │ ├── getTime.ts
│ │ │ │ │ ├── getServerStatus.ts
│ │ │ │ │ ├── getPeers.ts
│ │ │ │ │ ├── getBlockchainStatus.ts
│ │ │ │ │ └── getSuggestedFees.ts
│ │ │ │ ├── alias
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── getAliasById.ts
│ │ │ │ │ ├── getAliasByName.ts
│ │ │ │ │ ├── getTopLevelDomains.ts
│ │ │ │ │ ├── searchAliasesByName.ts
│ │ │ │ │ ├── getAliases.ts
│ │ │ │ │ └── getAliasesOnSale.ts
│ │ │ │ ├── contract
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── getContract.ts
│ │ │ │ │ ├── getSingleContractMapValue.ts
│ │ │ │ │ ├── getAllContractIds.ts
│ │ │ │ │ ├── getContractMapValuesByFirstKey.ts
│ │ │ │ │ └── getContractsByAccount.ts
│ │ │ │ ├── account
│ │ │ │ │ ├── getAccountBalance.ts
│ │ │ │ │ ├── getRewardRecipient.ts
│ │ │ │ │ ├── getAccountSubscriptions.ts
│ │ │ │ │ ├── getSubscriptionsToAccount.ts
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── getAccountBlocks.ts
│ │ │ │ │ ├── getAccount.ts
│ │ │ │ │ ├── getUnconfirmedAccountTransactions.ts
│ │ │ │ │ └── getAccountBlockIds.ts
│ │ │ │ ├── transaction
│ │ │ │ │ ├── getUnconfirmedTransactions.ts
│ │ │ │ │ ├── getTransactionByFullHash.ts
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── getSubscription.ts
│ │ │ │ │ ├── parseTransactionBytes.ts
│ │ │ │ │ ├── getTransaction.ts
│ │ │ │ │ ├── broadcastTransaction.ts
│ │ │ │ │ └── getSubscriptionPayments.ts
│ │ │ │ ├── asset
│ │ │ │ │ ├── getAllAssets.ts
│ │ │ │ │ ├── placeAskOrder.ts
│ │ │ │ │ ├── placeBidOrder.ts
│ │ │ │ │ ├── cancelAskOrder.ts
│ │ │ │ │ ├── cancelBidOrder.ts
│ │ │ │ │ ├── burnAsset.ts
│ │ │ │ │ ├── getAllTrades.ts
│ │ │ │ │ ├── getAsset.ts
│ │ │ │ │ ├── getOpenAskOrders.ts
│ │ │ │ │ ├── getOpenBidOrders.ts
│ │ │ │ │ ├── getAssetTradesPerAsset.ts
│ │ │ │ │ ├── getAssetTradesPerAccount.ts
│ │ │ │ │ ├── getOpenAskOrdersPerAsset.ts
│ │ │ │ │ ├── getOpenBidOrdersPerAsset.ts
│ │ │ │ │ ├── getAssetTransfersPerAsset.ts
│ │ │ │ │ ├── getOpenAskOrdersPerAccount.ts
│ │ │ │ │ ├── getOpenBidOrdersPerAccount.ts
│ │ │ │ │ └── getAssetTransfersPerAccount.ts
│ │ │ │ └── index.ts
│ │ │ ├── index.ts
│ │ │ └── __tests__
│ │ │ │ └── e2e
│ │ │ │ └── helpers
│ │ │ │ └── account.ts
│ │ ├── typings
│ │ │ ├── indexable.ts
│ │ │ ├── assetBalance.ts
│ │ │ ├── contractIdList.ts
│ │ │ ├── blockId.ts
│ │ │ ├── peerAddressList.ts
│ │ │ ├── rewardRecipient.ts
│ │ │ ├── multioutAssetQuantities.ts
│ │ │ ├── multioutRecipientAmount.ts
│ │ │ ├── args
│ │ │ │ ├── getAssetOpenOrdersArgs.ts
│ │ │ │ ├── getAssetTradesPerAssetArgs.ts
│ │ │ │ ├── getAssetsByNameArgs.ts
│ │ │ │ ├── getAllContractIdsArgs.ts
│ │ │ │ ├── getAssetTransfersPerAssetArgs.ts
│ │ │ │ ├── getAssetsByIssuerArgs.ts
│ │ │ │ ├── getAssetTransfersArgs.ts
│ │ │ │ ├── getAssetTransfersPerAccountArgs.ts
│ │ │ │ ├── unsignedTransactionArgs.ts
│ │ │ │ ├── getTradeHistoryPerAccountArgs.ts
│ │ │ │ ├── getAssetTradesArgs.ts
│ │ │ │ ├── getAssetTradesPerAccountArgs.ts
│ │ │ │ ├── getAssetHoldersArgs.ts
│ │ │ │ ├── getAssetOpenOrdersPerAssetArgs.ts
│ │ │ │ ├── cancelSubscriptionArgs.ts
│ │ │ │ ├── setRewardRecipientArgs.ts
│ │ │ │ ├── getAllTradesArgs.ts
│ │ │ │ ├── cancelOrderArgs.ts
│ │ │ │ ├── getContractMapValuesByFirstKeyArgs.ts
│ │ │ │ ├── calculateDistributionFeeArgs.ts
│ │ │ │ ├── getContractsByAccountArgs.ts
│ │ │ │ ├── setAccountInfoArgs.ts
│ │ │ │ ├── getSingleContractMapValueArgs.ts
│ │ │ │ ├── buyTopLevelDomainArgs.ts
│ │ │ │ ├── setAliasArgs.ts
│ │ │ │ ├── callContractMethodArgs.ts
│ │ │ │ ├── getAssetOpenOrdersPerAccountArgs.ts
│ │ │ │ ├── getSubscriptionPaymentsArgs.ts
│ │ │ │ ├── buyAliasArgs.ts
│ │ │ │ ├── sendAmountToMultipleRecipientsArgs.ts
│ │ │ │ ├── mintAssetArgs.ts
│ │ │ │ ├── sendSameAmountToMultipleRecipientsArgs.ts
│ │ │ │ ├── getTopLevelDomainsArgs.ts
│ │ │ │ ├── transferAssetOwnershipArgs.ts
│ │ │ │ ├── addAssetTreasuryAccountArgs.ts
│ │ │ │ ├── getAliasesOnSaleArgs.ts
│ │ │ │ ├── sendMessageArgs.ts
│ │ │ │ ├── searchAliasesByNameArgs.ts
│ │ │ │ ├── sendEncryptedMessageArgs.ts
│ │ │ │ ├── getAllContractsByCodeHashArgs.ts
│ │ │ │ ├── transferMultipleAssetsArgs.ts
│ │ │ │ ├── createSubscriptionArgs.ts
│ │ │ │ ├── getAliasesArgs.ts
│ │ │ │ ├── sellAliasArgs.ts
│ │ │ │ ├── placeOrderArgs.ts
│ │ │ │ ├── getAccountBlocksArgs.ts
│ │ │ │ ├── transferAssetArgs.ts
│ │ │ │ ├── getAccountArgs.ts
│ │ │ │ ├── distributeToAssetHoldersArgs.ts
│ │ │ │ └── getAllAssetsArgs.ts
│ │ │ ├── unconfirmedAssetBalance.ts
│ │ │ ├── distributionFee.ts
│ │ │ ├── aliasList.ts
│ │ │ ├── blockList.ts
│ │ │ ├── suggestedFees.ts
│ │ │ ├── topLevelDomainList.ts
│ │ │ ├── assetList.ts
│ │ │ ├── contractMapValueList.ts
│ │ │ ├── blockIdList.ts
│ │ │ ├── contractList.ts
│ │ │ ├── subscriptionList.ts
│ │ │ ├── assetAccount.ts
│ │ │ ├── assetTradeList.ts
│ │ │ ├── assetAskOrderList.ts
│ │ │ ├── assetBidOrderList.ts
│ │ │ ├── unconfirmedTransactionList.ts
│ │ │ ├── assetTransferList.ts
│ │ │ ├── chainTimestamp.ts
│ │ │ ├── assetAccountList.ts
│ │ │ ├── miningInfo.ts
│ │ │ ├── transactionList.ts
│ │ │ ├── balance.ts
│ │ │ ├── assetTransfer.ts
│ │ │ ├── peer.ts
│ │ │ ├── distributionAmount.ts
│ │ │ ├── topLevelDomain.ts
│ │ │ ├── unsignedTransaction.ts
│ │ │ ├── blockchainStatus.ts
│ │ │ ├── subscription.ts
│ │ │ ├── transactionId.ts
│ │ │ └── assetOrder.ts
│ │ ├── __tests__
│ │ │ └── helpers
│ │ │ │ ├── index.ts
│ │ │ │ └── createChainService.ts
│ │ ├── constants
│ │ │ ├── apiVersion.ts
│ │ │ ├── transactionLeasingSubtype.ts
│ │ │ ├── transactionPaymentSubtype.ts
│ │ │ ├── transactionMiningSubtype.ts
│ │ │ ├── transactionSmartContractSubtype.ts
│ │ │ ├── transactionArbitrarySubtype.ts
│ │ │ ├── transactionAdvancedPaymentSubtype.ts
│ │ │ ├── transactionMarketplaceSubtype.ts
│ │ │ └── transactionAssetSubtype.ts
│ │ └── transaction
│ │ │ ├── index.ts
│ │ │ ├── isMultiOutTransaction.ts
│ │ │ └── isMultiOutSameTransaction.ts
│ ├── .npmignore
│ ├── vitest.setup.ts
│ ├── tsconfig.json
│ ├── vitest.config.js
│ └── bundle.js
├── http
│ ├── .npmignore
│ ├── src
│ │ ├── httpResponse.ts
│ │ ├── httpError.ts
│ │ ├── __tests__
│ │ │ └── httpClientFactory.spec.ts
│ │ ├── index.ts
│ │ └── httpClientFactory.ts
│ ├── vitest.config.js
│ ├── tsconfig.json
│ └── bundle.js
├── util
│ ├── .npmignore
│ ├── src
│ │ ├── typings
│ │ │ └── index.ts
│ │ ├── constants.ts
│ │ ├── internal
│ │ │ ├── twosComplementBinary.ts
│ │ │ └── padStartPolyfill.ts
│ │ ├── convertBase36StringToHexString.ts
│ │ ├── convertBase64StringToString.ts
│ │ ├── convertHexStringToBase36String.ts
│ │ ├── convertAssetPriceToPlanck.ts
│ │ ├── convertStringToByteArray.ts
│ │ ├── convertHexStringToString.ts
│ │ ├── convertStringToHexString.ts
│ │ ├── convertHexEndianess.ts
│ │ ├── convertByteArrayToHexString.ts
│ │ ├── convertPlanckToAssetPrice.ts
│ │ ├── asyncRetry.ts
│ │ ├── convertHexStringToByteArray.ts
│ │ └── convertStringToBase64String.ts
│ ├── vitest.config.js
│ ├── tsconfig.json
│ └── bundle.js
├── wallets
│ ├── .npmignore
│ ├── src
│ │ ├── deeplinkable
│ │ │ ├── index.ts
│ │ │ └── deepLinkableOptions.ts
│ │ ├── extension
│ │ │ ├── index.ts
│ │ │ ├── args
│ │ │ │ ├── index.ts
│ │ │ │ ├── requestSignArgs.ts
│ │ │ │ ├── requestSendEncryptedMessageArgs.ts
│ │ │ │ └── requestPermissionArgs.ts
│ │ │ ├── extensionListener.ts
│ │ │ └── extensionNotificationHandler.ts
│ │ ├── typings
│ │ │ ├── args
│ │ │ │ ├── index.ts
│ │ │ │ └── sendEncryptedMessageArgs.ts
│ │ │ ├── index.ts
│ │ │ └── confirmedTransaction.ts
│ │ ├── __tests__
│ │ │ └── isNodeJS.spec.ts
│ │ ├── index.ts
│ │ ├── isNodeJS.ts
│ │ └── assertAddress.ts
│ ├── vitest.config.js
│ ├── tsconfig.json
│ └── bundle.js
├── contracts
│ ├── .npmignore
│ ├── src
│ │ ├── typings
│ │ │ ├── args
│ │ │ │ ├── index.ts
│ │ │ │ ├── calculateMinimumCreationFeeArgs.ts
│ │ │ │ └── generateMethodCallArgs.ts
│ │ │ ├── index.ts
│ │ │ ├── contractData.ts
│ │ │ └── contract.ts
│ │ ├── constants.ts
│ │ ├── __tests__
│ │ │ ├── countCodePages.spec.ts
│ │ │ ├── countDataPages.spec.ts
│ │ │ ├── convertSortStringToContractData.spec.ts
│ │ │ └── generateMethodCall.spec.ts
│ │ ├── internal
│ │ │ └── convertContractData.ts
│ │ ├── countDataPages.ts
│ │ ├── countCodePages.ts
│ │ ├── index.ts
│ │ ├── calculateMinimumCreationFee.ts
│ │ └── convertShortStringToContractData.ts
│ ├── vitest.config.js
│ ├── tsconfig.json
│ └── bundle.js
├── standards
│ ├── .npmignore
│ ├── src
│ │ ├── src44
│ │ │ ├── exceptions
│ │ │ │ ├── index.ts
│ │ │ │ ├── src44ParseException.ts
│ │ │ │ └── src44ValidationException.ts
│ │ │ ├── typings
│ │ │ │ ├── index.ts
│ │ │ │ ├── IpfsMediaType.ts
│ │ │ │ ├── SRC44DescriptorType.ts
│ │ │ │ └── args
│ │ │ │ │ ├── setAccountDescriptorArgs.ts
│ │ │ │ │ ├── setAliasDescriptorArgs.ts
│ │ │ │ │ ├── setAssetBrandingArgs.ts
│ │ │ │ │ └── setContractBrandingArgs.ts
│ │ │ └── parseIpfsMedia.ts
│ │ ├── src22
│ │ │ ├── index.ts
│ │ │ ├── encoderFormat.ts
│ │ │ ├── args
│ │ │ │ └── createDeeplinkArgs.ts
│ │ │ └── DeeplinkParts.ts
│ │ ├── src47
│ │ │ └── index.ts
│ │ └── index.ts
│ ├── vitest.config.js
│ ├── tsconfig.json
│ └── bundle.js
└── crypto
│ ├── .npmignore
│ ├── src
│ ├── typings
│ │ ├── cryptoError.ts
│ │ ├── encryptedData.ts
│ │ ├── encryptedMessage.ts
│ │ ├── cryptoAdapter.ts
│ │ └── signKeys.ts
│ ├── adapters
│ │ └── index.ts
│ ├── base
│ │ ├── cryptoParams.ts
│ │ └── index.ts
│ ├── index.ts
│ ├── __tests__
│ │ └── sha256.spec.ts
│ └── web-bundle.ts
│ ├── vitest.setup.ts
│ ├── tsconfig.json
│ ├── vitest.config.js
│ └── bundle.js
├── assets
└── signumjs.png
├── docs
└── .nojekyll
├── generate-coverage-report.sh
├── examples
├── nodejs
│ ├── helper
│ │ ├── ledgerHostUrls.js
│ │ ├── handleError.js
│ │ ├── index.js
│ │ ├── askAccount.js
│ │ ├── api.js
│ │ ├── provideLedger.js
│ │ └── confirmTransaction.js
│ ├── README.MD
│ ├── basic
│ │ ├── convertTimestampsAndDates.js
│ │ └── calculateSignaPlanck.js
│ ├── advanced
│ │ └── contracts
│ │ │ └── claimContract.smart.c
│ └── package.json
└── web
│ ├── send-message
│ ├── README.MD
│ └── css
│ │ └── custom.css
│ └── connect-xt-wallet
│ ├── README.MD
│ ├── src
│ └── notification.js
│ └── css
│ └── custom.css
├── jest.config.e2e.js
├── .changeset
├── config.json
└── README.md
├── typedoc.json
├── sonar-project.properties
├── jest.config.js
├── turbo.json
├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── tsconfig.json
/.nojekyll:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.nvmrc:
--------------------------------------------------------------------------------
1 | 20
2 |
--------------------------------------------------------------------------------
/.husky/pre-push:
--------------------------------------------------------------------------------
1 | turbo run compile test bundle
2 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | *.log
2 | /docs
3 | /docstheme
4 | *.tgz
5 |
--------------------------------------------------------------------------------
/packages/core/.gitignore:
--------------------------------------------------------------------------------
1 | src/api/__tests__/e2e/helpers/.env
2 |
--------------------------------------------------------------------------------
/packages/http/.npmignore:
--------------------------------------------------------------------------------
1 | .turbo/
2 | src/
3 | bundle.js
4 |
5 |
--------------------------------------------------------------------------------
/packages/util/.npmignore:
--------------------------------------------------------------------------------
1 | .turbo/
2 | src/
3 | bundle.js
4 |
5 |
--------------------------------------------------------------------------------
/packages/wallets/.npmignore:
--------------------------------------------------------------------------------
1 | .turbo/
2 | src/
3 | bundle.js
4 |
5 |
--------------------------------------------------------------------------------
/packages/contracts/.npmignore:
--------------------------------------------------------------------------------
1 | .turbo/
2 | src/
3 | bundle.js
4 |
5 |
--------------------------------------------------------------------------------
/packages/standards/.npmignore:
--------------------------------------------------------------------------------
1 | .turbo/
2 | src/
3 | bundle.js
4 |
5 |
--------------------------------------------------------------------------------
/packages/core/src/address/index.ts:
--------------------------------------------------------------------------------
1 | export {Address} from './address';
2 |
3 |
--------------------------------------------------------------------------------
/packages/util/src/typings/index.ts:
--------------------------------------------------------------------------------
1 | export * from './args/asyncRetryArgs';
2 |
--------------------------------------------------------------------------------
/packages/core/.npmignore:
--------------------------------------------------------------------------------
1 | .turbo/
2 | src/
3 | websandbox/
4 | bundle.js
5 |
6 |
--------------------------------------------------------------------------------
/packages/core/src/ledgerClient/index.ts:
--------------------------------------------------------------------------------
1 | export * from './ledgerClientFactory';
2 |
--------------------------------------------------------------------------------
/packages/crypto/.npmignore:
--------------------------------------------------------------------------------
1 | .turbo/
2 | src/
3 | websandbox/
4 | bundle.js
5 |
6 |
--------------------------------------------------------------------------------
/packages/crypto/src/typings/cryptoError.ts:
--------------------------------------------------------------------------------
1 | export class CryptoError extends Error {}
2 |
--------------------------------------------------------------------------------
/assets/signumjs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/signum-network/signumjs/HEAD/assets/signumjs.png
--------------------------------------------------------------------------------
/packages/core/src/internal/verifyTransaction/index.ts:
--------------------------------------------------------------------------------
1 | export * from './verifyTransaction';
2 |
--------------------------------------------------------------------------------
/packages/core/src/attachment/index.ts:
--------------------------------------------------------------------------------
1 | export {getAttachmentVersion} from './getAttachmentVersion';
2 |
3 |
4 |
--------------------------------------------------------------------------------
/packages/core/src/service/index.ts:
--------------------------------------------------------------------------------
1 | export * from './chainService';
2 | export * from './chainServiceSettings';
3 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/message/index.ts:
--------------------------------------------------------------------------------
1 | export * from './sendMessage';
2 | export * from './sendEncryptedMessage';
3 |
--------------------------------------------------------------------------------
/packages/wallets/src/deeplinkable/index.ts:
--------------------------------------------------------------------------------
1 | export * from './genericDeeplinkableWallet';
2 | export * from './deeplinkableWallet';
3 |
--------------------------------------------------------------------------------
/packages/standards/src/src44/exceptions/index.ts:
--------------------------------------------------------------------------------
1 | export * from './src44ParseException';
2 | export * from './src44ValidationException';
3 |
--------------------------------------------------------------------------------
/docs/.nojekyll:
--------------------------------------------------------------------------------
1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
--------------------------------------------------------------------------------
/packages/crypto/src/adapters/index.ts:
--------------------------------------------------------------------------------
1 | export {NodeJSCryptoAdapter} from "./nodeJSCryptoAdapter"
2 | export {WebCryptoAdapter} from "./webCryptoAdapter"
3 |
--------------------------------------------------------------------------------
/packages/wallets/src/extension/index.ts:
--------------------------------------------------------------------------------
1 | export * from './genericExtensionWallet';
2 | export * from './walletConnection';
3 | export * from './errors';
4 |
--------------------------------------------------------------------------------
/packages/crypto/vitest.setup.ts:
--------------------------------------------------------------------------------
1 | import {Crypto} from './src';
2 | import {NodeJSCryptoAdapter} from './src/adapters';
3 |
4 | Crypto.init(new NodeJSCryptoAdapter())
5 |
--------------------------------------------------------------------------------
/packages/core/src/internal/index.ts:
--------------------------------------------------------------------------------
1 | export * from './createParametersFromAttachment';
2 | export * from './signIfPrivateKey';
3 | export * from './verifyTransaction';
4 |
5 |
6 |
--------------------------------------------------------------------------------
/packages/core/src/typings/indexable.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Interface extension for indexable responses
3 | *
4 | */
5 | export interface Indexable {
6 | nextIndex?: number;
7 | }
8 |
--------------------------------------------------------------------------------
/packages/core/vitest.setup.ts:
--------------------------------------------------------------------------------
1 | import {Crypto} from '@signumjs/crypto';
2 | import {NodeJSCryptoAdapter} from "@signumjs/crypto/adapters"
3 | Crypto.init(new NodeJSCryptoAdapter())
4 |
--------------------------------------------------------------------------------
/packages/wallets/src/extension/args/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 | export * from './requestPermissionArgs';
5 | export * from './requestSignArgs';
6 |
--------------------------------------------------------------------------------
/packages/wallets/src/typings/args/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 | export * from './easyWalletPayArgs';
5 | export * from './sendEncryptedMessageArgs';
6 |
--------------------------------------------------------------------------------
/packages/core/src/__tests__/helpers/index.ts:
--------------------------------------------------------------------------------
1 | export {createChainService} from './createChainService';
2 | // export {mockSignAndBroadcastTransaction} from './mockSignAndBroadcastTransaction'
3 |
--------------------------------------------------------------------------------
/packages/core/src/constants/apiVersion.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | *
4 | * */
5 | export enum ApiVersion {
6 | /**
7 | * Currently, the only version.
8 | */
9 | V1 = 0,
10 | }
11 |
--------------------------------------------------------------------------------
/packages/crypto/src/base/cryptoParams.ts:
--------------------------------------------------------------------------------
1 | /**
2 |
3 | * @internal
4 | * @ignore
5 | */
6 | export const CryptoParams = {
7 | IvLength: 16,
8 | SharedKeyLength: 32
9 | };
10 |
--------------------------------------------------------------------------------
/packages/standards/src/src44/typings/index.ts:
--------------------------------------------------------------------------------
1 | export * from './Descriptor';
2 | export * from './SRC44Descriptor';
3 | export * from './SRC44DescriptorType';
4 | export * from './IpfsMediaType';
5 |
--------------------------------------------------------------------------------
/packages/contracts/src/typings/args/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | export * from './generateMethodCallArgs';
6 | export * from './calculateMinimumCreationFeeArgs';
7 |
8 |
--------------------------------------------------------------------------------
/packages/standards/src/src22/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./createDeeplink"
2 | export * from "./parseDeeplink"
3 | export * from "./DeeplinkParts"
4 | export * from "./args/createDeeplinkArgs"
5 | export * from "./encoderFormat"
--------------------------------------------------------------------------------
/packages/core/src/api/factories/block/index.ts:
--------------------------------------------------------------------------------
1 | export * from './getBlockByHeight';
2 | export * from './getBlockById';
3 | export * from './getBlockByTimestamp';
4 | export * from './getBlocks';
5 | export * from './getBlockId';
6 |
--------------------------------------------------------------------------------
/packages/core/src/transaction/index.ts:
--------------------------------------------------------------------------------
1 | export * from './isMultiOutSameTransaction';
2 | export * from './isMultiOutTransaction';
3 | export * from './getRecipientAmountsFromMultiOutPayment';
4 | export * from './getRecipientsAmount';
5 |
--------------------------------------------------------------------------------
/packages/wallets/src/typings/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 | export * from './args';
5 | export * from './wallet';
6 | export * from './easyWallet';
7 | export * from './confirmedTransaction';
8 |
9 |
--------------------------------------------------------------------------------
/generate-coverage-report.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | rm -rf .nyc_output
4 | mkdir -p .nyc_output
5 | find packages/*/coverage -name '*.json' -exec cp {} .nyc_output/ \;
6 | nyc merge .nyc_output coverage.json
7 | nyc report --reporter=lcov
8 |
--------------------------------------------------------------------------------
/packages/contracts/src/typings/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | * Modified work (c) 2022 Signum Network
4 | */
5 |
6 | export * from './args';
7 | export * from './contract';
8 | export * from './contractData';
9 |
--------------------------------------------------------------------------------
/packages/contracts/src/constants.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * @internal
7 | * @ignore
8 | *
9 | * Size of Code Pages in bytes
10 | *
11 | */
12 | export const CodePageSize = 256;
13 |
--------------------------------------------------------------------------------
/packages/wallets/src/extension/args/requestSignArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Arguments for {@link ExtensionAdapter.requestSign}
3 | * @internal
4 | * @module wallets
5 | */
6 | export interface RequestSignArgs {
7 | unsignedTransaction: string;
8 | }
9 |
--------------------------------------------------------------------------------
/examples/nodejs/helper/ledgerHostUrls.js:
--------------------------------------------------------------------------------
1 | // these are our possible networks
2 | module.exports = {
3 | TestNet: 'http://localhost:6876',
4 | // TestNet: 'https://europe3.testnet.signum.network',
5 | MainNet: 'https://europe.signum.network',
6 | }
7 |
--------------------------------------------------------------------------------
/packages/standards/src/src22/encoderFormat.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Encoder format constants
3 | * @see {@link createDeeplink} and {@link CreateDeeplinkArgs}
4 | *
5 | *
6 | */
7 | export enum EncoderFormat {
8 | Text,
9 | Hexadecimal,
10 | Base64
11 | }
--------------------------------------------------------------------------------
/packages/standards/src/src44/exceptions/src44ParseException.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 |
5 | /**
6 | *
7 | * SRC44 Parse Exception
8 | *
9 | * @internal
10 | *
11 | */
12 | export class SRC44ParseException extends Error {}
13 |
--------------------------------------------------------------------------------
/packages/wallets/src/__tests__/isNodeJS.spec.ts:
--------------------------------------------------------------------------------
1 | import {isNodeJS} from '../isNodeJS';
2 |
3 | describe('isNodeJS', () => {
4 | it('should return true...because these tests just run on NodeJS', () => {
5 | expect(isNodeJS()).toBeTruthy();
6 | });
7 | });
8 |
--------------------------------------------------------------------------------
/packages/core/src/typings/assetBalance.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 | /**
5 | * AssetBalance
6 | *
7 | * @category entities
8 | */
9 | export interface AssetBalance {
10 | balanceQNT: string;
11 | asset: string;
12 | }
13 |
--------------------------------------------------------------------------------
/packages/core/src/typings/contractIdList.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * Contract Id List
7 | * @category entities
8 | */
9 | export interface ContractIdList {
10 | atIds: string[];
11 | requestProcessingTime: number;
12 | }
13 |
--------------------------------------------------------------------------------
/examples/nodejs/README.MD:
--------------------------------------------------------------------------------
1 | # SignumJS NodeJS examples
2 |
3 | ## Get started
4 |
5 | > Requirement is having [NodeJS](https://nodejs.org/en/download/) installed (V12+)
6 |
7 | Run `npm i` and then simply run of the js files like this
8 |
9 | `node getAccountBalance.js`
10 |
11 |
12 |
--------------------------------------------------------------------------------
/packages/core/src/typings/blockId.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | /**
7 | * Block Id
8 | * @category entities
9 | */
10 | export interface BlockId {
11 | readonly block: string;
12 | }
13 |
--------------------------------------------------------------------------------
/packages/core/src/typings/peerAddressList.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | /**
7 | * Peer Address List
8 | * @category entities
9 | * */
10 | export interface PeerAddressList {
11 | peers: string[];
12 | requestProcessingTime: number;
13 | }
14 |
--------------------------------------------------------------------------------
/packages/core/src/typings/rewardRecipient.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2020 Burst Apps Team
3 | */
4 |
5 | /**
6 | * Reward Recipient
7 | * @category entities
8 | * */
9 | export interface RewardRecipient {
10 | rewardRecipient: string;
11 | requestProcessingTime: number;
12 | }
13 |
--------------------------------------------------------------------------------
/packages/core/src/typings/multioutAssetQuantities.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * MultioutAssetQuantities interface
3 | * @see {@link transferMultipleAssets}
4 | * @category entities
5 | */
6 | export interface MultioutAssetQuantities {
7 | readonly assetId: string;
8 | readonly quantity: string;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/http/src/httpResponse.ts:
--------------------------------------------------------------------------------
1 | /**
2 | *Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * Http Response
7 | *
8 | * Returned by Http request
9 | * @module http
10 | */
11 | export class HttpResponse {
12 | constructor(public status: number, public response: any) {}
13 | }
14 |
--------------------------------------------------------------------------------
/jest.config.e2e.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | "preset": "ts-jest",
3 | "testEnvironment": "node",
4 | "globals": {
5 | "ts-jest": {
6 | "diagnostics": false
7 | }
8 | },
9 | "testPathIgnorePatterns": [
10 | "helpers",
11 | ".*\\.spec\\.ts"
12 | ],
13 | };
14 |
15 |
16 |
--------------------------------------------------------------------------------
/packages/core/src/api/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This is the API submodule providing Signum Network API functions
3 | *
4 | *
5 | * @see {@link composeApi} and/or {@link ApiComposer}
6 | *
7 | *
8 | * */
9 | export * from './apiComposer';
10 | export * from './composeApi';
11 | export * from './factories';
12 |
--------------------------------------------------------------------------------
/packages/core/src/constants/transactionLeasingSubtype.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * Constants for leasing subtypes
7 | *
8 | * @category transaction-types
9 | */
10 | export enum TransactionLeasingSubtype {
11 | Ordinary = 0
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/packages/core/src/typings/multioutRecipientAmount.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * MultioutRecipientAmount interface
3 | * @see {@link getRecipientAmountsFromMultiOutPayment}
4 | * @category entities
5 | */
6 | export interface MultioutRecipientAmount {
7 | readonly recipient: string;
8 | readonly amountNQT: string;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAssetOpenOrdersArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link AssetApi.getOpenAskOrders} and {@link AssetApi.getOpenBidOrders}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAssetOpenOrdersArgs {
9 | firstIndex?: number;
10 | lastIndex?: number;
11 | }
12 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAssetTradesPerAssetArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link AssetApi.getAssetTradesPerAsset}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAssetTradesPerAssetArgs {
9 | assetId: string;
10 | firstIndex?: number;
11 | lastIndex?: number;
12 | }
13 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAssetsByNameArgs.ts:
--------------------------------------------------------------------------------
1 | import {GetAllAssetsArgs} from './getAllAssetsArgs';
2 |
3 | /**
4 | * The argument object for {@link AssetApi.getAssetsByName}
5 | *
6 | *
7 | * @category args
8 | */
9 | export interface GetAssetsByNameArgs extends GetAllAssetsArgs {
10 | name: string;
11 | }
12 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/network/index.ts:
--------------------------------------------------------------------------------
1 | export * from './getBlockchainStatus';
2 | export * from './getMiningInfo';
3 | export * from './getPeer';
4 | export * from './getPeers';
5 | export * from './getServerStatus';
6 | export * from './getTime';
7 | export * from './getSuggestedFees';
8 | export * from './getNetworkInfo';
9 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAllContractIdsArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link ContractApi.getAllContractIds}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAllContractIdsArgs {
9 | /**
10 | * The hash of the machine code
11 | */
12 | machineCodeHash?: string;
13 | }
14 |
--------------------------------------------------------------------------------
/packages/core/src/api/__tests__/e2e/helpers/account.ts:
--------------------------------------------------------------------------------
1 | import {generateMasterKeys, getAccountIdFromPublicKey} from '@signumjs/crypto';
2 |
3 | export const getAccountIdFromPassphrase = (passphrase: string): string => {
4 | const {publicKey} = generateMasterKeys(passphrase);
5 | return getAccountIdFromPublicKey(publicKey);
6 | };
7 |
8 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAssetTransfersPerAssetArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link AssetApi.getAssetTransfersPerAsset}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAssetTransfersPerAssetArgs {
9 | assetId: string;
10 | firstIndex?: number;
11 | lastIndex?: number;
12 | }
13 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAssetsByIssuerArgs.ts:
--------------------------------------------------------------------------------
1 | import {GetAllAssetsArgs} from './getAllAssetsArgs';
2 |
3 | /**
4 | * The argument object for {@link AssetApi.getAssetsByIssuer}
5 | *
6 | *
7 | * @category args
8 | */
9 | export interface GetAssetsByIssuerArgs extends GetAllAssetsArgs {
10 | accountId: string;
11 | }
12 |
--------------------------------------------------------------------------------
/packages/core/src/typings/unconfirmedAssetBalance.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Original work Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | /**
7 | * Unconfirmed Asset Balance
8 | *
9 | * @category entities
10 | * */
11 | export interface UnconfirmedAssetBalance {
12 | unconfirmedBalanceQNT: string;
13 | asset: string;
14 | }
15 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAssetTransfersArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link AssetApi.getAssetTransfers}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAssetTransfersArgs {
9 | assetId?: string;
10 | accountId?: string;
11 | firstIndex?: number;
12 | lastIndex?: number;
13 | }
14 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAssetTransfersPerAccountArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link AssetApi.getAssetTransfersPerAccount}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAssetTransfersPerAccountArgs {
9 | accountId: string;
10 | firstIndex?: number;
11 | lastIndex?: number;
12 | }
13 |
--------------------------------------------------------------------------------
/packages/crypto/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "./out",
5 | "types": ["node", "vitest/globals"]
6 | },
7 | "typeRoots": [
8 | "src/typings",
9 | "node_modules/@types"
10 | ],
11 | "include": [
12 | "./src",
13 | "README.md"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/packages/http/vitest.config.js:
--------------------------------------------------------------------------------
1 | // vitest.config.ts
2 | import { defineConfig } from 'vitest/config'
3 |
4 | export default defineConfig({
5 | test: {
6 | globals: true,
7 | coverage: {
8 | reporter: [['json', {file : "http-coverage.json"}]],
9 | include: ["src/**"],
10 | }
11 | }
12 | })
--------------------------------------------------------------------------------
/packages/util/vitest.config.js:
--------------------------------------------------------------------------------
1 | // vitest.config.ts
2 | import { defineConfig } from 'vitest/config'
3 |
4 | export default defineConfig({
5 | test: {
6 | globals: true,
7 | coverage: {
8 | reporter: [['json', {file : "util-coverage.json"}]],
9 | include: ["src/**"],
10 | }
11 | }
12 | })
--------------------------------------------------------------------------------
/packages/crypto/src/base/index.ts:
--------------------------------------------------------------------------------
1 | import {Buffer} from 'buffer';
2 | import {Crypto} from './crypto';
3 |
4 | export * from './ec-kcdsa';
5 | export * from './curve25519';
6 | export * from './cryptoParams';
7 | export {
8 | Crypto,
9 | Buffer
10 | };
11 |
12 | // browser polyfill!
13 | // @ts-ignore
14 | globalThis.Buffer = Buffer;
15 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/unsignedTransactionArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link TransactionApi.signAndBroadcastTransaction}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface UnsignedTransactionArgs {
9 | unsignedHexMessage: string;
10 | senderPrivateKey: string;
11 | senderPublicKey: string;
12 | }
13 |
--------------------------------------------------------------------------------
/packages/crypto/src/typings/encryptedData.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * The interface for encrypted raw data
7 | * @see {@link encryptData}
8 | *
9 | * @category en/decryption
10 | */
11 | export interface EncryptedData {
12 | data: Uint8Array;
13 | nonce: Uint8Array;
14 | }
15 |
--------------------------------------------------------------------------------
/packages/wallets/vitest.config.js:
--------------------------------------------------------------------------------
1 | // vitest.config.ts
2 | import { defineConfig } from 'vitest/config'
3 |
4 | export default defineConfig({
5 | test: {
6 | globals: true,
7 | coverage: {
8 | reporter: [['json', {file : "wallets-coverage.json"}]],
9 | include: ["src/**"],
10 | }
11 | }
12 | })
--------------------------------------------------------------------------------
/.changeset/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json",
3 | "changelog": "@changesets/cli/changelog",
4 | "commit": false,
5 | "fixed": [],
6 | "linked": [["@signumjs/*"]],
7 | "access": "public",
8 | "baseBranch": "main",
9 | "updateInternalDependencies": "patch",
10 | "ignore": []
11 | }
12 |
--------------------------------------------------------------------------------
/packages/core/src/constants/transactionPaymentSubtype.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * Constants for payment subtypes
7 | *
8 | * @category transaction-types
9 | */
10 | export enum TransactionPaymentSubtype {
11 | Ordinary = 0,
12 | MultiOut,
13 | MultiOutSameAmount,
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/packages/contracts/vitest.config.js:
--------------------------------------------------------------------------------
1 | // vitest.config.ts
2 | import { defineConfig } from 'vitest/config'
3 |
4 | export default defineConfig({
5 | test: {
6 | globals: true,
7 | coverage: {
8 | reporter: [['json', {file : "contracts-coverage.json"}]],
9 | include: ["src/**"],
10 |
11 | }
12 | }
13 | })
--------------------------------------------------------------------------------
/packages/standards/vitest.config.js:
--------------------------------------------------------------------------------
1 | // vitest.config.ts
2 | import { defineConfig } from 'vitest/config'
3 |
4 | export default defineConfig({
5 | test: {
6 | globals: true,
7 | coverage: {
8 | reporter: [['json', {file : "standards-coverage.json"}]],
9 | include: ["src/**"],
10 | }
11 |
12 | }
13 | })
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getTradeHistoryPerAccountArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link AssetApi.getTradeHistoryPerAccount}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetTradeHistoryPerAccountArgs {
9 | accountId: string;
10 | assetId?: string;
11 | firstIndex?: number;
12 | lastIndex?: number;
13 | }
14 |
--------------------------------------------------------------------------------
/packages/core/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "./out",
5 | "types": ["vitest/globals"],
6 | },
7 | "typeRoots": [
8 | "typings",
9 | "node_modules/@types"
10 | ],
11 | "include": [
12 | "./src",
13 | "README.md"
14 | ],
15 | }
16 |
--------------------------------------------------------------------------------
/packages/util/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "./out",
5 | "types": ["vitest/globals"]
6 | },
7 | "typeRoots": [
8 | "typings",
9 | "node_modules/@types"
10 | ],
11 | "include": [
12 | "./src",
13 | "README.md"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/packages/wallets/src/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The Wallets package provides tools to interact with wallets remotely.
3 | *
4 | * WIP: This documentation is still under construction. Comprehensive examples will be provided soon
5 | *
6 | * @module wallets
7 | * */
8 | export * from './typings';
9 | export * from './deeplinkable';
10 | export * from './extension';
11 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAssetTradesArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link AssetApi.getAssetTrades}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAssetTradesArgs {
9 | assetId?: string;
10 | accountId?: string;
11 | firstIndex?: number;
12 | lastIndex?: number;
13 | includeAssetInfo?: boolean;
14 | }
15 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAssetTradesPerAccountArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link AssetApi.getAssetTradesPerAccount}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAssetTradesPerAccountArgs {
9 | accountId: string;
10 | includeAssetInfo?: boolean;
11 | firstIndex?: number;
12 | lastIndex?: number;
13 | }
14 |
--------------------------------------------------------------------------------
/packages/wallets/src/extension/args/requestSendEncryptedMessageArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Arguments for {@link ExtensionAdapter.requestSign}
3 | * @internal
4 | * @module wallets
5 | */
6 | export interface RequestSendEncryptedMessageArgs {
7 | plainMessage: string;
8 | messageIsText: boolean;
9 | recipientPublicKey: string;
10 | feeSigna?: string;
11 | }
12 |
--------------------------------------------------------------------------------
/packages/core/src/typings/distributionFee.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2023 Signum Network
3 | */
4 | import {Amount} from '@signumjs/util';
5 |
6 | /**
7 | * Distribution Fee
8 | * See {@link calculateDistributionFee}
9 | * @category entities
10 | */
11 | export interface DistributionFee {
12 | fee: Amount;
13 | numberOfAccounts: number;
14 | }
15 |
--------------------------------------------------------------------------------
/packages/crypto/src/typings/encryptedMessage.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * The interface for encrypted message
7 | * @see {@link encryptMessage}
8 | *
9 | * @category en/decryption
10 | */
11 | export interface EncryptedMessage {
12 | data: string;
13 | nonce: string;
14 | isText: boolean;
15 | }
16 |
--------------------------------------------------------------------------------
/packages/contracts/src/typings/contractData.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Generic Datatype for contracts
3 | *
4 | * The data type can only be a numeric as contracts accept only longs.
5 | *
6 | *
7 | * Text is not supported
8 | *
9 | * @see {@link GenerateMethodCallArgs} and {@link generateMethodCall}
10 | *
11 | */
12 | export type ContractData = string | number | boolean;
13 |
--------------------------------------------------------------------------------
/packages/core/src/constants/transactionMiningSubtype.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2021 Burst Apps Team
3 | */
4 |
5 | /**
6 | * Constants for mining subtypes
7 | *
8 | * @category transaction-types
9 | */
10 | export enum TransactionMiningSubtype {
11 | RewardRecipientAssignment = 0,
12 | AddCommitment = 1,
13 | RemoveCommitment = 2,
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/packages/core/src/constants/transactionSmartContractSubtype.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * Constants for smart contract (aka AT) subtypes
7 | *
8 | * @category transaction-types
9 | */
10 | export enum TransactionSmartContractSubtype {
11 | SmartContractCreation = 0,
12 | SmartContractPayment
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAssetHoldersArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link AssetApi.getAssetHolders}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAssetHoldersArgs {
9 | assetId: string;
10 | ignoreTreasuryAccount?: boolean;
11 | minimumQuantity?: string;
12 | firstIndex?: number;
13 | lastIndex?: number;
14 | }
15 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAssetOpenOrdersPerAssetArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link AssetApi.getOpenAskOrdersPerAsset} and {@link AssetApi.getOpenBidOrdersPerAsset}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAssetOpenOrdersPerAssetArgs {
9 | assetId: string;
10 | firstIndex?: number;
11 | lastIndex?: number;
12 | }
13 |
--------------------------------------------------------------------------------
/packages/wallets/src/isNodeJS.ts:
--------------------------------------------------------------------------------
1 | /* globals process */
2 | /** @ignore */
3 | /** @internal */
4 | /** @module wallets */
5 |
6 | /**
7 | * Checks if the runtime environment is NodeJS
8 | */
9 | export function isNodeJS(): boolean {
10 | return typeof process === 'object'
11 | && String(process) === '[object process]'
12 | && !process.versions.nw;
13 | }
14 |
--------------------------------------------------------------------------------
/typedoc.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://typedoc.org/schema.json",
3 | "entryPoints": [
4 | "packages/**/src/index.ts"
5 | ],
6 | "exclude": [
7 | "**/*.spec.ts"
8 | ],
9 | "out": "docs",
10 | "tsconfig": "./tsconfig.json",
11 | "suppressCommentWarningsInDeclarationFiles": true,
12 | "navigation": {
13 | "includeCategories": true
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/alias/index.ts:
--------------------------------------------------------------------------------
1 | export * from './getAliasById';
2 | export * from './getAliasByName';
3 | export * from './getAliasesOnSale';
4 | export * from './getAliases';
5 | export * from './buyAlias';
6 | export * from './sellAlias';
7 | export * from './getTopLevelDomains';
8 | export * from './buyTopLevelDomain';
9 | export * from './searchAliasesByName';
10 |
--------------------------------------------------------------------------------
/packages/core/src/typings/aliasList.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 | import {Alias} from './alias';
5 | import {Indexable} from './indexable';
6 |
7 | /**
8 | * Alias List
9 | *
10 | * @category entities
11 | */
12 | export interface AliasList extends Indexable{
13 | aliases: Alias[];
14 | requestProcessingTime: number;
15 | }
16 |
--------------------------------------------------------------------------------
/packages/core/src/typings/blockList.ts:
--------------------------------------------------------------------------------
1 | import {Block} from './block';
2 | import {Indexable} from './indexable';
3 |
4 | /**
5 | * Original work Copyright (c) 2020 Burst Apps Team
6 | */
7 |
8 | /**
9 | * Block List
10 | * @category entities
11 | */
12 | export interface BlockList extends Indexable {
13 | blocks: Block[];
14 | requestProcessingTime: number;
15 | }
16 |
--------------------------------------------------------------------------------
/packages/core/src/typings/suggestedFees.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * Suggested fees (in Planck)
7 | * @category entities
8 | * */
9 | export interface SuggestedFees {
10 | minimum: number;
11 | standard: number;
12 | cheap: number;
13 | priority: number;
14 | requestProcessingTime: number;
15 | }
16 |
--------------------------------------------------------------------------------
/packages/core/src/typings/topLevelDomainList.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2023 Signum Network
3 | */
4 |
5 | import {TopLevelDomain} from './topLevelDomain';
6 |
7 | /**
8 | * Top Level Domain List
9 | *
10 | * @category entities
11 | */
12 | export interface TopLevelDomainList {
13 | tlds: TopLevelDomain[];
14 | requestProcessingTime: number;
15 | }
16 |
--------------------------------------------------------------------------------
/packages/core/src/typings/assetList.ts:
--------------------------------------------------------------------------------
1 | import {Asset} from './asset';
2 | import {Indexable} from './indexable';
3 |
4 | /**
5 | * Original work Copyright (c) 2019 Burst Apps Team
6 | */
7 |
8 | /**
9 | * Asset List
10 | *
11 | * @category entities
12 | */
13 | export interface AssetList extends Indexable {
14 | assets: Asset[];
15 | requestProcessingTime: number;
16 | }
17 |
--------------------------------------------------------------------------------
/packages/core/src/typings/contractMapValueList.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 |
5 | interface KeyValue {
6 | key2: string;
7 | value: string;
8 | }
9 |
10 | /**
11 | * Contract Map Value List
12 | * @category entities
13 | */
14 | export interface ContractMapValueList {
15 | keyValues: KeyValue[];
16 | requestProcessingTime: number;
17 | }
18 |
--------------------------------------------------------------------------------
/packages/core/vitest.config.js:
--------------------------------------------------------------------------------
1 | // vitest.config.ts
2 | import { defineConfig } from 'vitest/config'
3 |
4 | export default defineConfig({
5 | test: {
6 | globals: true,
7 | setupFiles: ['./vitest.setup.ts'],
8 | coverage: {
9 | reporter: [['json', {file : "core-coverage.json"}]],
10 | include: ["src/**"],
11 | }
12 | }
13 | })
14 |
--------------------------------------------------------------------------------
/packages/standards/src/src44/exceptions/src44ValidationException.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 |
5 | /**
6 | *
7 | * SRC44 Validation Exception
8 | *
9 | * @internal
10 | *
11 | */
12 | export class SRC44ValidationException extends Error {
13 | constructor(message: string) {
14 | super(`[SRC44 Validation Error]: ${message}`);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/packages/standards/src/src44/typings/IpfsMediaType.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 |
5 | /**
6 | * Type for media data used in SRC44
7 | *
8 | *
9 | */
10 | export interface IpfsMediaType {
11 | /**
12 | * IPFS CID
13 | */
14 | ipfsCid: string;
15 | /**
16 | * Mime Type, e.g. image/png
17 | */
18 | mimeType: string;
19 | }
20 |
--------------------------------------------------------------------------------
/sonar-project.properties:
--------------------------------------------------------------------------------
1 | # Path to sources
2 | sonar.sources=packages
3 | sonar.test.inclusions=**/*.spec.ts
4 | sonar.exclusions=docs/**/*;docstheme/**/*;**/*.spec.e2e.ts;src/core/websandbox/**/*;src/crypto/websandbox;**/bundle.js
5 | sonar.javascript.lcov.reportPaths=coverage/lcov.info
6 | sonar.projectKey=signum-network_signumjs
7 | sonar.organization=signum-network
8 | sonar.projectName=signumjs
9 |
--------------------------------------------------------------------------------
/packages/contracts/src/__tests__/countCodePages.spec.ts:
--------------------------------------------------------------------------------
1 | import {countCodePages} from '../countCodePages';
2 |
3 | describe('countCodePage', () => {
4 | it('counts pages as expected', () => {
5 | expect(countCodePages('xx'.repeat(513))).toBe(3);
6 | expect(countCodePages('xx'.repeat(300))).toBe(2);
7 | expect(countCodePages('xx'.repeat(1))).toBe(1);
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/core/src/typings/blockIdList.ts:
--------------------------------------------------------------------------------
1 | import {BlockId} from './blockId';
2 | import {Indexable} from './indexable';
3 |
4 | /**
5 | * Original work Copyright (c) 2020 Burst Apps Team
6 | */
7 |
8 | /**
9 | * Block Id List
10 | * @category entities
11 | */
12 | export interface BlockIdList extends Indexable{
13 | blockIds: BlockId[];
14 | requestProcessingTime: number;
15 | }
16 |
--------------------------------------------------------------------------------
/packages/crypto/vitest.config.js:
--------------------------------------------------------------------------------
1 | // vitest.config.ts
2 | import { defineConfig } from 'vitest/config'
3 |
4 | export default defineConfig({
5 | test: {
6 | globals: true,
7 | setupFiles: ['./vitest.setup.ts'],
8 | coverage: {
9 | reporter: [['json', {file : "crypto-coverage.json"}]],
10 | include: ["src/**"],
11 | }
12 | }
13 | })
14 |
--------------------------------------------------------------------------------
/packages/core/src/typings/contractList.ts:
--------------------------------------------------------------------------------
1 | import {Indexable} from './indexable';
2 | import { Contract } from '@signumjs/contracts';
3 |
4 | /**
5 | * Copyright (c) 2019 Burst Apps Team
6 | */
7 |
8 | /**
9 | * The Contract Id List
10 | * @category entities
11 | */
12 | export interface ContractList extends Indexable {
13 | ats: Contract[];
14 | requestProcessingTime: number;
15 | }
16 |
--------------------------------------------------------------------------------
/packages/core/src/typings/subscriptionList.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Original work Copyright (c) 2020 Burst Apps Team
4 | */
5 |
6 | import {Subscription} from './subscription';
7 |
8 | /**
9 | * Subscription List
10 | *
11 | * @category entities
12 | * */
13 | export interface SubscriptionList {
14 | readonly requestProcessingTime: number;
15 | readonly subscriptions: Subscription[];
16 | }
17 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/cancelSubscriptionArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 | /**
4 | * The argument object for {@link TransactionApi.cancelSubscription}
5 | *
6 | * @category args
7 | */
8 | export interface CancelSubscriptionArgs extends DefaultSendArgs {
9 | /**
10 | The subscription to be cancelled
11 | */
12 | subscriptionId: string;
13 | }
14 |
--------------------------------------------------------------------------------
/packages/core/src/typings/assetAccount.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 |
5 | /**
6 | * Asset Account
7 | *
8 | * @category entities
9 | */
10 | export interface AssetAccount {
11 | account: string;
12 | accountRS: string;
13 | isTreasury: boolean;
14 | asset: string;
15 | quantityQNT: string;
16 | unconfirmedQuantityQNT: string;
17 | }
18 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/setRewardRecipientArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 | /**
4 | * The argument object for {@link AccountApi.setRewardRecipient}
5 | *
6 | * @param recipientId The recipients id, i.e. pool address
7 | *
8 | * @category args
9 | */
10 | export interface SetRewardRecipientArgs extends DefaultSendArgs {
11 | recipientId: string;
12 | }
13 |
14 |
15 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAllTradesArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link AssetApi.getAllTrades}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAllTradesArgs {
9 | /**
10 | * The timestamp in seconds since genesis block
11 | * @see {@link util.ChainTime}
12 | */
13 | timestamp?: number;
14 | firstIndex?: number;
15 | lastIndex?: number;
16 | }
17 |
--------------------------------------------------------------------------------
/packages/core/src/typings/assetTradeList.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 |
5 | import {AssetTrade} from './assetTrade';
6 | import {Indexable} from './indexable';
7 |
8 | /**
9 | * Asset Trade List
10 | *
11 | * @category entities
12 | */
13 | export interface AssetTradeList extends Indexable {
14 | trades: AssetTrade[];
15 | requestProcessingTime: number;
16 | }
17 |
--------------------------------------------------------------------------------
/packages/wallets/src/extension/extensionListener.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 |
5 | /**
6 | * Interface for running subscriptions, i.e. returned by {@link WalletConnection.listen}
7 | * @module wallets
8 | */
9 | export interface ExtensionListener {
10 | /**
11 | * Unsubscribe from the internal event messaging
12 | */
13 | unlisten: () => void;
14 | }
15 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/cancelOrderArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 | /**
4 | * The argument object for {@link AssetApi.cancelAskOrder} and {@link AssetApi.cancelBidOrder}
5 | *
6 | *
7 | * @category args
8 | */
9 | export interface CancelOrderArgs extends DefaultSendArgs {
10 | /**
11 | * The order (transaction id) to be cancelled
12 | */
13 | order: string;
14 | }
15 |
--------------------------------------------------------------------------------
/packages/core/src/typings/assetAskOrderList.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 |
5 | import {AssetOrder} from './assetOrder';
6 | import {Indexable} from './indexable';
7 |
8 | /**
9 | * Asset Ask Order List
10 | *
11 | * @category entities
12 | */
13 | export interface AssetAskOrderList extends Indexable {
14 | askOrders: AssetOrder[];
15 | requestProcessingTime: number;
16 | }
17 |
--------------------------------------------------------------------------------
/packages/core/src/typings/assetBidOrderList.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 |
5 | import {AssetOrder} from './assetOrder';
6 | import {Indexable} from './indexable';
7 |
8 | /**
9 | * Asset Bid Order List
10 | *
11 | * @category entities
12 | */
13 | export interface AssetBidOrderList extends Indexable {
14 | bidOrders: AssetOrder[];
15 | requestProcessingTime: number;
16 | }
17 |
--------------------------------------------------------------------------------
/packages/core/src/typings/unconfirmedTransactionList.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Original work Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | import {Transaction} from './transaction';
7 |
8 | /**
9 | * Unconfirmed Transaction List
10 | * @category entities
11 | * */
12 | export interface UnconfirmedTransactionList {
13 | readonly requestProcessingTime: number;
14 | readonly unconfirmedTransactions: Transaction[];
15 | }
16 |
--------------------------------------------------------------------------------
/packages/core/src/typings/assetTransferList.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 |
5 | import {AssetTransfer} from './assetTransfer';
6 | import {Indexable} from './indexable';
7 |
8 | /**
9 | * Asset Transfer List
10 | *
11 | * @category entities
12 | */
13 | export interface AssetTransferList extends Indexable{
14 | transfers: AssetTransfer[];
15 | requestProcessingTime: number;
16 | }
17 |
--------------------------------------------------------------------------------
/packages/core/src/typings/chainTimestamp.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * ChainTime Interface
7 | * @see {@link util.ChainTime} to convert between chains timestamp and Date
8 | * @category entities
9 | * */
10 | export interface ChainTimestamp {
11 | /**
12 | * The chains time (in seconds since the genesis block)
13 | */
14 | readonly time: number;
15 | }
16 |
--------------------------------------------------------------------------------
/examples/web/send-message/README.MD:
--------------------------------------------------------------------------------
1 | #### Send Message
2 |
3 | > Level: Basic
4 |
5 | With this example application you can send a message to another account
6 |
7 | Run the `index.html` in any static file server.
8 |
9 | Using [serve](https://www.npmjs.com/package/serve) may be the easiest way:
10 |
11 | 1. `npm i -g serve`
12 | 2. `cd ./web/send-message`
13 | 3. `serve`
14 | 4. Open browser at given url, i.e. `http://localhost:5000`
15 |
--------------------------------------------------------------------------------
/packages/core/src/typings/assetAccountList.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Original work Copyright (c) 2022 Signum Network
4 | */
5 |
6 | import {AssetAccount} from './assetAccount';
7 | import {Indexable} from './indexable';
8 |
9 | /**
10 | * Asset Account List
11 | *
12 | * @category entities
13 | */
14 | export interface AssetAccountList extends Indexable {
15 | accountAssets: AssetAccount[];
16 | requestProcessingTime: number;
17 | }
18 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/contract/index.ts:
--------------------------------------------------------------------------------
1 | export * from './getContract';
2 | export * from './getAllContractIds';
3 | export * from './getContractsByAccount';
4 | export * from './publishContract';
5 | export * from './publishContractByReference';
6 | export * from './callContractMethod';
7 | export * from './getSingleContractMapValue';
8 | export * from './getContractMapValuesByFirstKey';
9 | export * from './getAllContractsByCodeHash';
10 |
--------------------------------------------------------------------------------
/packages/contracts/src/__tests__/countDataPages.spec.ts:
--------------------------------------------------------------------------------
1 | import {countDataPages} from '../countDataPages';
2 |
3 | describe('countDataPages', () => {
4 | it('counts data pages as expected', () => {
5 | expect(countDataPages('xx'.repeat(513))).toBe(3);
6 | expect(countDataPages('xx'.repeat(300))).toBe(2);
7 | expect(countDataPages('xx'.repeat(1))).toBe(1);
8 | expect(countDataPages('')).toBe(1);
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/packages/core/src/__tests__/helpers/createChainService.ts:
--------------------------------------------------------------------------------
1 | import {Http} from '@signumjs/http';
2 | import {ChainService} from '../../service';
3 |
4 | export const createChainService = (
5 | httpClient: Http = undefined,
6 | apiRootUrl: string = '',
7 | nodeHost: string = 'localhost',
8 | ): ChainService => {
9 | return new ChainService({
10 | nodeHost,
11 | apiRootUrl,
12 | httpClient,
13 | });
14 | };
15 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getContractMapValuesByFirstKeyArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link ContractApi.getContractMapValuesByFirstKey}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetContractMapValuesByFirstKeyArgs {
9 | /**
10 | * The id of the contract
11 | */
12 | contractId: string;
13 | /**
14 | * The first key of the mapping tuple.
15 | */
16 | key1: string;
17 | }
18 |
--------------------------------------------------------------------------------
/packages/util/src/constants.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Symbol/Character for currency unit
3 | * @deprecated Due to Multiverse feature it's not recommended to use this hard coded stuff.
4 | *
5 | * */
6 | export const CurrencySymbol = 'Ꞩ';
7 |
8 | /**
9 | * The smallest possible fee
10 | *
11 | */
12 | export const FeeQuantPlanck = 1000000;
13 |
14 | /**
15 | * One SIGNA expressed in Planck
16 | *
17 | */
18 | export const OneSignaPlanck = 100000000;
19 |
--------------------------------------------------------------------------------
/examples/nodejs/helper/handleError.js:
--------------------------------------------------------------------------------
1 | const {HttpError} = require("@signumjs/http");
2 | const handleError = e => {
3 | if (e instanceof HttpError) {
4 | console.error('Oh oh, something went wrong:',
5 | e.message,
6 | e.data || '',
7 | e.requestUrl || ''
8 | )
9 | } else {
10 | console.error('Oh oh, something went wrong:', e)
11 | }
12 | };
13 |
14 | module.exports = handleError;
15 |
--------------------------------------------------------------------------------
/packages/contracts/src/internal/convertContractData.ts:
--------------------------------------------------------------------------------
1 | import {ContractData} from '../typings/contractData';
2 |
3 | /**
4 | * @internal
5 | * @param value
6 | */
7 | export const convertContractData = (value: ContractData): string => {
8 | if (typeof (value) === 'boolean') {
9 | return value ? '1' : '0';
10 | }
11 | if (typeof (value) === 'number') {
12 | return `${value}`;
13 | }
14 |
15 | return value;
16 | };
17 |
--------------------------------------------------------------------------------
/packages/standards/src/src44/typings/SRC44DescriptorType.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 |
5 | /**
6 | * SRC44 Compliant type slugs
7 | *
8 | * See {@link DescriptorData} and {@link DescriptorDataBuilder} to create, update this structure
9 | *
10 | *
11 | */
12 | export type SRC44DescriptorType = 'hum' |
13 | 'smc' |
14 | 'bot' |
15 | 'biz' |
16 | 'cex' |
17 | 'dex' |
18 | 'tok' |
19 | 'oth';
20 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/calculateDistributionFeeArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The argument object for {@link AssetApi.calculateDistributionFee}
3 | *
4 | * @category args
5 | */
6 | export interface CalculateDistributionFeeArgs {
7 | /**
8 | * The asset Id
9 | */
10 | assetId: string;
11 | /**
12 | * The minimum quantity (in atomic chain value) necessary for distribution
13 | */
14 | minimumQuantity?: number | string;
15 | }
16 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getContractsByAccountArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link ContractApi.getContractsByAccount}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetContractsByAccountArgs {
9 | /**
10 | * Account Id
11 | */
12 | accountId: string;
13 | /**
14 | * The hash of the machine code, to get only the contracts that match this hash
15 | */
16 | machineCodeHash?: string;
17 | }
18 |
--------------------------------------------------------------------------------
/packages/core/src/typings/miningInfo.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2021 Signum Network
3 | */
4 |
5 | /**
6 | * Mining Info
7 | * @category entities
8 | */
9 | export interface MiningInfo {
10 | readonly height: string;
11 | readonly generationSignature: string;
12 | readonly baseTarget: string;
13 | readonly averageCommitmentNQT: string;
14 | readonly lastBlockReward: string;
15 | readonly timestamp: string;
16 | }
17 |
--------------------------------------------------------------------------------
/packages/wallets/src/typings/confirmedTransaction.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 |
5 | /**
6 | * Object returned from {@link GenericExtensionWallet.confirm}
7 | * @module wallets
8 | */
9 | export interface ConfirmedTransaction {
10 | /**
11 | * The transaction id
12 | */
13 | transactionId: string;
14 | /**
15 | * The hash of the transaction
16 | */
17 | fullHash: string;
18 | }
19 |
--------------------------------------------------------------------------------
/examples/nodejs/basic/convertTimestampsAndDates.js:
--------------------------------------------------------------------------------
1 | const {ChainTime} = require("@signumjs/util");
2 |
3 | (()=> {
4 | console.log('The current block timestamp is', ChainTime.fromDate(new Date()).getChainTimestamp())
5 | console.log('The Signum Mainnet went live on', ChainTime.fromChainTimestamp(0).getDate().toUTCString(), '(local time)')
6 | console.log('Expressed in the Epoch timestamp (1.1.1970) it was', ChainTime.fromChainTimestamp(0).getEpoch())
7 | })()
8 |
--------------------------------------------------------------------------------
/packages/wallets/src/assertAddress.ts:
--------------------------------------------------------------------------------
1 | /** @ignore */
2 | /** @internal */
3 |
4 | /**
5 | * Just a superficial check, if address seems valid
6 | * @param address The accountId or address
7 | * @throws If address is not valid
8 | */
9 | export function assertAddress(address: string) {
10 | if (!/^.+?-([a-zA-Z0-9]{4}-){3}[a-zA-Z0-9]{5}|^\d{18,24}$/gi.test(address)) {
11 | throw new Error(`Invalid address: ${address}`);
12 | }
13 | }
14 |
15 |
16 |
--------------------------------------------------------------------------------
/packages/contracts/src/countDataPages.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 |
5 | /**
6 | * Counts the data pages for given initialization data stack
7 | *
8 | * @param dataHex The contracts initial data stack in hex form
9 | * @return The number of data pages for the passed data
10 | *
11 | *
12 | */
13 | export function countDataPages(dataHex: string ): number {
14 | return Math.max(Math.ceil((dataHex.length / 16) / 32), 1);
15 | }
16 |
--------------------------------------------------------------------------------
/packages/contracts/src/typings/args/calculateMinimumCreationFeeArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 |
5 | /**
6 | *
7 | * The argument object for {@link calculateMinimumCreationFee}
8 | *
9 | * @param codeHex The contracts code in hex form
10 | * @param dataHex The contracts initial data stack in hex form
11 | *
12 | */
13 | export interface CalculateMinimumCreationFeeArgs {
14 | codeHex?: string;
15 | dataHex?: string;
16 | }
17 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/setAccountInfoArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 |
4 | /**
5 | * The argument object for {@link AccountApi.setAccountInfo}
6 | *
7 | *
8 | * @category args
9 | */
10 | export interface SetAccountInfoArgs extends DefaultSendArgs {
11 | /**
12 | * The accounts name
13 | */
14 | name: string;
15 | /**
16 | * The accounts description
17 | */
18 | description: string;
19 | }
20 |
--------------------------------------------------------------------------------
/packages/standards/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "./out",
5 | "types": ["vitest/globals"]
6 | },
7 | "typeRoots": [
8 | "typings",
9 | "node_modules/@types"
10 | ],
11 | "include": [
12 | "./src",
13 | "README.md"
14 | ],
15 | "autogenerate-readme": {
16 | "srcFiles": [
17 | "./src/**/*.ts"
18 | ],
19 | "template": "./README.md.hbs"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/examples/web/connect-xt-wallet/README.MD:
--------------------------------------------------------------------------------
1 | #### Connect XT Wallet
2 |
3 | > Level: Advanced
4 |
5 | With this example application you can send a message to another account using the XT Wallet
6 |
7 | Run the `index.html` in any static file server.
8 |
9 | Using [serve](https://www.npmjs.com/package/serve) may be the easiest way:
10 |
11 | 1. `npm i -g serve`
12 | 2. `cd ./web/connect-xt-wallet`
13 | 3. `serve`
14 | 4. Open browser at given url, i.e. `http://localhost:5000`
15 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getSingleContractMapValueArgs.ts:
--------------------------------------------------------------------------------
1 | import {GetContractMapValuesByFirstKeyArgs} from './getContractMapValuesByFirstKeyArgs';
2 |
3 | /**
4 | * The argument object for {@link ContractApi.getSingleContractMapValue}
5 | *
6 | *
7 | * @category args
8 | */
9 | export interface GetSingleContractMapValueArgs extends GetContractMapValuesByFirstKeyArgs {
10 | /**
11 | * The second key of the mapping tuple.
12 | */
13 | key2: string;
14 | }
15 |
--------------------------------------------------------------------------------
/packages/wallets/src/extension/args/requestPermissionArgs.ts:
--------------------------------------------------------------------------------
1 | import {ExtensionDAppMetadata} from '../messaging';
2 |
3 | /**
4 | * Argument object of ExtensionAdapter.requestPermission
5 | * @internal
6 | */
7 | export interface RequestPermissionArgs {
8 | /**
9 | * Just some additional meta data of the app
10 | */
11 | appMeta: ExtensionDAppMetadata;
12 | /**
13 | * The network on which the DApp operates
14 | */
15 | network: string;
16 | }
17 |
--------------------------------------------------------------------------------
/packages/contracts/src/countCodePages.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | import {CodePageSize} from './constants';
6 |
7 | /**
8 | * Counts the code pages for given machine code
9 | *
10 | * @param hexCode The contracts code in hex form
11 | * @return The number of code pages for the passed code
12 | *
13 | *
14 | */
15 | export function countCodePages(hexCode: string ): number {
16 | return Math.ceil((hexCode.length / 2) / CodePageSize);
17 | }
18 |
--------------------------------------------------------------------------------
/packages/contracts/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "./out",
5 | "types": [
6 | "vitest/globals"
7 | ]
8 | },
9 | "typeRoots": [
10 | "typings",
11 | "node_modules/@types"
12 | ],
13 | "include": [
14 | "./src",
15 | "README.md"
16 | ],
17 | "autogenerate-readme": {
18 | "srcFiles": [
19 | "./src/**/*.ts"
20 | ],
21 | "template": "./README.md.hbs"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/packages/http/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "./out",
5 | "types": ["axios","vitest/globals"]
6 | },
7 | "typeRoots": [
8 | "typings",
9 | "node_modules/@types"
10 | ],
11 | "include": [
12 | "./src",
13 | "README.md"
14 | ],
15 | "autogenerate-readme": {
16 | "srcFiles": [
17 | "./src/**/*.ts"
18 | ],
19 | "template": "./README.md.hbs"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/packages/core/src/typings/transactionList.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Original work Copyright (c) 2019 Burst Apps Team
4 | * Modified (c) 2023 Signum Network
5 | */
6 |
7 | import {Transaction} from './transaction';
8 | import {Indexable} from './indexable';
9 |
10 | /**
11 | * Transaction List
12 | *
13 | * @category entities
14 | * */
15 | export interface TransactionList extends Indexable {
16 | readonly requestProcessingTime: number;
17 | readonly transactions: Transaction[];
18 | }
19 |
--------------------------------------------------------------------------------
/examples/nodejs/helper/index.js:
--------------------------------------------------------------------------------
1 | const api = require('./api');
2 | const askAccount = require('./askAccount');
3 | const handleError = require('./handleError');
4 | const provideLedger = require('./provideLedger');
5 | const confirmTransaction = require('./confirmTransaction');
6 | const LedgerHostUrls = require('./ledgerHostUrls');
7 |
8 | module.exports = {
9 | api,
10 | askAccount,
11 | handleError,
12 | provideLedger,
13 | confirmTransaction,
14 | LedgerHostUrls,
15 | };
16 |
--------------------------------------------------------------------------------
/packages/core/src/constants/transactionArbitrarySubtype.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * Constants for arbitrary subtypes
7 | *
8 | * @category transaction-types
9 | */
10 | export enum TransactionArbitrarySubtype {
11 | Message = 0,
12 | AliasAssignment,
13 | PollCreation,
14 | VoteCasting,
15 | HubAnnouncement,
16 | AccountInfo,
17 | AliasSale,
18 | AliasBuy,
19 | TopLevelDomainAssignment
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | "preset": "ts-jest",
3 | "testEnvironment": "node",
4 | "globals": {
5 | "ts-jest": {
6 | "diagnostics": false
7 | }
8 | },
9 | "collectCoverageFrom": [
10 | "**/src/**/*.ts",
11 | "!**/e2e/**",
12 | ],
13 | "testPathIgnorePatterns": [
14 | "helpers",
15 | ".*\\.e2e\\.ts$",
16 | "out",
17 | "node_modules"
18 | ],
19 | "verbose": true
20 | };
21 |
22 |
23 |
--------------------------------------------------------------------------------
/packages/http/src/httpError.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * HttpError class
7 | *
8 | * Thrown on HTTP errors
9 | * @module http
10 | */
11 | export class HttpError extends Error {
12 | public timestamp: number = Date.now();
13 |
14 | constructor(public requestUrl: string,
15 | public status: number,
16 | public message: string,
17 | public data: any) {
18 | super(message);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/packages/core/src/constants/transactionAdvancedPaymentSubtype.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | * Modified 2024, Signum Network
4 | */
5 |
6 | /**
7 | * Constants for advanced payment subtypes
8 | *
9 | * @category transaction-types
10 | */
11 | export enum TransactionAdvancedPaymentSubtype {
12 | EscrowCreation = 0,
13 | EscrowSigning,
14 | EscrowResult,
15 | SubscriptionSubscribe,
16 | SubscriptionCancel,
17 | SubscriptionPayment,
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/packages/core/src/typings/balance.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * Account Balance
7 | *
8 | * @category entities
9 | */
10 | export interface Balance {
11 | readonly unconfirmedBalanceNQT: string;
12 | readonly guaranteedBalanceNQT: string;
13 | readonly effectiveBalanceNXT: string; // is really NXT!!
14 | readonly forgedBalanceNQT: string;
15 | readonly balanceNQT: string;
16 | readonly requestProcessingTime: number;
17 | }
18 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/buyTopLevelDomainArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 |
4 | /**
5 | * The argument object for {@link AliasApi.buyTopLevelDomain}
6 | *
7 | * @param tld The name of the Top Level Domain (max. 40 chars only digits and letters)
8 | * @param amountPlanck The amount in planck according SIP-48
9 | *
10 | * @category args
11 | */
12 | export interface BuyTopLevelDomainArgs extends DefaultSendArgs {
13 | tld: string;
14 | amountPlanck: string;
15 | }
16 |
--------------------------------------------------------------------------------
/packages/http/src/__tests__/httpClientFactory.spec.ts:
--------------------------------------------------------------------------------
1 | import {HttpClientFactory} from '../httpClientFactory';
2 |
3 | describe('HttpClientFactory', () => {
4 | it('should create adapter', () => {
5 | const http = HttpClientFactory.createHttpClient('http://localhost:3000');
6 | expect(http).toBeDefined();
7 | expect(http.delete).toBeDefined();
8 | expect(http.post).toBeDefined();
9 | expect(http.get).toBeDefined();
10 | expect(http.put).toBeDefined();
11 | });
12 | });
13 |
--------------------------------------------------------------------------------
/packages/core/src/typings/assetTransfer.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 |
5 | /**
6 | * Asset Transfer
7 | *
8 | * @category entities
9 | */
10 | export interface AssetTransfer {
11 | assetTransfer: string;
12 | asset: string;
13 | sender: string;
14 | senderRS: string;
15 | recipient: string;
16 | recipientRS: string;
17 | quantityQNT: string;
18 | height: number;
19 | timestamp: number;
20 | name?: string;
21 | decimals?: number;
22 | }
23 |
--------------------------------------------------------------------------------
/examples/nodejs/helper/askAccount.js:
--------------------------------------------------------------------------------
1 | const inquirer = require('inquirer');
2 |
3 | /**
4 | * Just a helper function to ask for the account id/address
5 | */
6 | function askAccount() {
7 | // inquirer is a pretty useful lib for CLI interaction
8 | return inquirer
9 | .prompt([
10 | {
11 | type: 'input',
12 | name: 'account',
13 | message: 'What\'s the account id or address?'
14 | }
15 | ])
16 | }
17 |
18 | module.exports = askAccount;
19 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/setAliasArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 |
4 | /**
5 | * The argument object for {@link AccountApi.setAlias}
6 | *
7 | * @param aliasName The alias name
8 | * @param aliasUri The alias uri
9 | * @param tld The name of the Top Level Domain (TLD) aka namespace where this alias belongs to
10 | *
11 | * @category args
12 | */
13 | export interface SetAliasArgs extends DefaultSendArgs {
14 | aliasName: string;
15 | aliasURI?: string;
16 | tld?: string;
17 | }
18 |
--------------------------------------------------------------------------------
/packages/core/src/typings/peer.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | /**
7 | * Peer Interface
8 | * @category entities
9 | * */
10 | export interface Peer {
11 | announcedAddress: string;
12 | application: string;
13 | blacklisted: boolean;
14 | downloadedVolume: number;
15 | lastUpdated: number;
16 | platform: string;
17 | requestProcessingTime: number;
18 | shareAddress: boolean;
19 | state: number;
20 | uploadedVolume: boolean;
21 | version: string;
22 | }
23 |
--------------------------------------------------------------------------------
/.changeset/README.md:
--------------------------------------------------------------------------------
1 | # Changesets
2 |
3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4 | with multi-package repos, or single-package repos to help you version and publish your code. You can
5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6 |
7 | We have a quick list of common questions to get you started engaging with this project in
8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
9 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/callContractMethodArgs.ts:
--------------------------------------------------------------------------------
1 | import {ContractData} from '@signumjs/contracts';
2 | import {DefaultSendArgs} from './defaultSendArgs';
3 |
4 | /**
5 | * The argument object for {@link ContractApi.callContractMethod}
6 | *
7 | *
8 | * @category args
9 | */
10 | export interface CallContractMethodArgs extends DefaultSendArgs {
11 | amountPlanck: string;
12 | assetId?: string;
13 | assetQuantity?: string;
14 | contractId: string;
15 | methodArgs?: ContractData[];
16 | methodId: string;
17 | }
18 |
--------------------------------------------------------------------------------
/packages/core/src/constants/transactionMarketplaceSubtype.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | /**
6 | * Constants for marketplace subtypes
7 | *
8 | * @category transaction-types
9 | */
10 | export enum TransactionMarketplaceSubtype {
11 | MarketplaceListing = 0,
12 | MarketplaceRemoval,
13 | MarketplaceItemPriceChange,
14 | MarketplaceItemQuantityChange,
15 | MarketplacePurchase,
16 | MarketplaceDelivery,
17 | MarketplaceFeedback,
18 | MarketplaceRefund
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://turbo.build/schema.json",
3 | "tasks": {
4 | "bundle": {
5 | "dependsOn": ["^compile","^bundle"],
6 | "outputs": ["dist/**"]
7 | },
8 | "compile": {
9 | "dependsOn": ["^compile"],
10 | "outputs": ["out/**"]
11 | },
12 | "test": {
13 | "dependsOn": ["^compile", "^test"]
14 | },
15 | "test:ci": {
16 | "dependsOn": ["^compile","^test:ci"]
17 | },
18 | "dev": {
19 | "persistent": true,
20 | "cache": false
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAssetOpenOrdersPerAccountArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link AssetApi.getOpenAskOrdersPerAccount} and {@link AssetApi.getOpenBidOrdersPerAccount}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAssetOpenOrdersPerAccountArgs {
9 | /**
10 | * The Account Identifier
11 | */
12 | accountId: string;
13 | /**
14 | * An optional asset identifier to filter by given asset
15 | */
16 | assetId?: string;
17 | firstIndex?: number;
18 | lastIndex?: number;
19 | }
20 |
--------------------------------------------------------------------------------
/packages/wallets/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "./out",
5 | "types": ["node", "vitest/globals"],
6 | "lib": [
7 | "ESNext",
8 | "dom"
9 | ]
10 | },
11 | "typeRoots": [
12 | "typings",
13 | "node_modules/@types"
14 | ],
15 | "include": [
16 | "./src",
17 | "README.md"
18 | ],
19 | "autogenerate-readme": {
20 | "srcFiles": [
21 | "./src/**/*.ts"
22 | ],
23 | "template": "./README.md.hbs"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/packages/contracts/src/__tests__/convertSortStringToContractData.spec.ts:
--------------------------------------------------------------------------------
1 | import {convertShortStringToContractData} from '../convertShortStringToContractData';
2 |
3 | describe('convertShortStringToContractData', () => {
4 | it('generates a valid contract data argument', () => {
5 | const message = convertShortStringToContractData('ShortMsg');
6 | expect(message).toBe('7454386970759751763');
7 | });
8 | it('throws if message too big', () => {
9 | expect(() => convertShortStringToContractData('LongInvalidMsg')).toThrow();
10 | });
11 | });
12 |
--------------------------------------------------------------------------------
/packages/core/src/transaction/isMultiOutTransaction.ts:
--------------------------------------------------------------------------------
1 | import {Transaction} from '../typings/transaction';
2 | import {TransactionPaymentSubtype, TransactionType} from '../constants';
3 |
4 | /**
5 | * Checks if a transaction is a multi out transaction (with different amounts)
6 | * @param transaction Transaction to be checked
7 | * @return true, if is a multi out transaction
8 | *
9 | */
10 | export const isMultiOutTransaction = (transaction: Transaction) =>
11 | transaction.type === TransactionType.Payment && transaction.subtype === TransactionPaymentSubtype.MultiOut;
12 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/network/getMiningInfo.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2021 Signum Network
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {MiningInfo} from '../../../typings/miningInfo';
6 |
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link NetworkApi}.
10 | *
11 | * See details at {@link NetworkApi.getMiningInfo}
12 | *
13 | * @category factories
14 | */
15 | export const getMiningInfo = (service: ChainService): () => Promise =>
16 | (): Promise => service.query('getMiningInfo');
17 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Additional context**
24 | Add any other context about the problem here.
25 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/network/getNetworkInfo.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2021,2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {NetworkInfo} from '../../../typings/networkInfo';
6 |
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link NetworkApi}.
10 | *
11 | * See details at {@link NetworkApi.getNetworkInfo}
12 | *
13 | * @category factories
14 | */
15 | export const getNetworkInfo = (service: ChainService): () => Promise =>
16 | (): Promise => service.query('getConstants');
17 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getSubscriptionPaymentsArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link TransactionApi.getSubscriptionPayments}
4 | *
5 | * @param {string} subscriptionId The numeric subscription Id
6 | * @param {number?} firstIndex The first index of the transaction list, beginning at 0
7 | * @param {number?} lastIndex The last index of the transaction list (BRS does not return more than 500)
8 | *
9 | * @category args
10 | */
11 | export interface GetSubscriptionPaymentsArgs {
12 | subscriptionId: string;
13 | firstIndex?: number;
14 | lastIndex?: number;
15 | }
16 |
--------------------------------------------------------------------------------
/packages/core/src/typings/distributionAmount.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 |
5 |
6 | /**
7 | * @category entities
8 | */
9 | export interface DistributionAmount {
10 | /**
11 | * Signa amount of distribution expressed in Planck
12 | */
13 | amountNQT: string;
14 | /**
15 | * The quantity of the additional asset that was distributed
16 | */
17 | quantityQNT: string;
18 | height: number;
19 | confirmations: number;
20 | requestProcessingTime: number;
21 | account: string;
22 | transaction: string;
23 | }
24 |
--------------------------------------------------------------------------------
/packages/core/src/typings/topLevelDomain.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2023 Signum Network
3 | */
4 |
5 | /**
6 | * Top Level Domain
7 | *
8 | * Top Level Domains are part of the Alias system. There are serving as namespaces for aliases
9 | * Look also at [SIP48](https://github.com/signum-network/SIPs/blob/master/SIP/sip-48.md)
10 | *
11 | * @category entities
12 | */
13 | export interface TopLevelDomain {
14 | account: string;
15 | accountRS: string;
16 | alias: string;
17 | aliasName: string;
18 | timestamp: number;
19 | numberOfAliases: number;
20 | }
21 |
--------------------------------------------------------------------------------
/packages/core/src/internal/verifyTransaction/baseTransaction.ts:
--------------------------------------------------------------------------------
1 | /** @ignore */
2 | /** @internal */
3 | export interface BaseTransaction {
4 | type?: number;
5 | version?: number;
6 | subtype?: number;
7 | timestamp?: number;
8 | deadline?: number;
9 | senderPublicKey?: string;
10 | sender?: string;
11 | recipient?: string;
12 | amountNQT?: string;
13 | feeNQT?: string;
14 | referencedTransactionFullHash?: string;
15 | signature?: string;
16 | flags?: number;
17 | ecBlockHeight?: number;
18 | ecBlockId?: string;
19 | cashBackId?: string;
20 | }
21 |
--------------------------------------------------------------------------------
/packages/standards/src/src47/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * SRC47: Standard for [URI Resolution](https://github.com/signum-network/SIPs/blob/master/SIP/sip-47.md)
4 | *
5 | * This (sub) package helps to resolve SRC47 compliant URI to URLs referenced in Aliases.
6 | *
7 | * Resolving a URI
8 | *
9 | * ```ts
10 | * const ledger = LedgerClientFactory.create({nodeHost: "https://europe.signum.network"})
11 | * const resolver = new URIResolver(ledger);
12 | * const url = await resolver.resolve('http://arts.johndoe.crypto');
13 | * ```
14 | *
15 | *
16 | */
17 |
18 | export * from './URIResolver';
19 |
--------------------------------------------------------------------------------
/packages/standards/src/src44/typings/args/setAccountDescriptorArgs.ts:
--------------------------------------------------------------------------------
1 | import {DescriptorData} from '../../DescriptorData';
2 |
3 | /**
4 | * Arguments for {@link DescriptorDataClient.setAccountDescriptor}
5 | *
6 | */
7 | export interface SetAccountDescriptorArgs {
8 | name?: string;
9 | descriptorData: DescriptorData;
10 | /**
11 | * If not given the minimum transaction fee is being calculated
12 | */
13 | feePlanck?: string;
14 | senderPublicKey: string;
15 | senderPrivateKey?: string;
16 | deadline?: number;
17 | referencedTransactionFullHash?: string;
18 | }
19 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/network/getPeer.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 | import { ChainService } from '../../../service/chainService';
5 | import { Peer } from '../../../typings/peer';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link NetworkApi}.
9 | *
10 | * See details at {@link NetworkApi.getPeer}
11 | *
12 | * @category factories
13 | */
14 | export const getPeer = (service: ChainService):
15 | (peer: string) => Promise =>
16 | (peer: string): Promise =>
17 | service.query('getPeer', {
18 | peer,
19 | });
20 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/buyAliasArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 |
4 | /**
5 | * The argument object for {@link buyAlias}
6 | *
7 | * @param alias The alias Id
8 | * @param aliasName Alternative to alias Id
9 | * @param amountPlanck The amount for buy in Planck
10 | * @param tld The name of the Top Level Domain (TLD) aka namespace where this alias belongs to
11 | *
12 | * @category args
13 | */
14 | export interface BuyAliasArgs extends DefaultSendArgs {
15 | aliasId: string;
16 | aliasName?: string;
17 | amountPlanck: string;
18 | tld?: string;
19 | }
20 |
--------------------------------------------------------------------------------
/packages/core/src/transaction/isMultiOutSameTransaction.ts:
--------------------------------------------------------------------------------
1 | import {Transaction} from '../typings/transaction';
2 | import {TransactionPaymentSubtype, TransactionType} from '../constants';
3 |
4 | /**
5 | * Checks if a transaction is a multi out transaction with same amounts for each recipient
6 | * @param transaction Transaction to be checked
7 | * @return true, if is a multi out transaction
8 | *
9 | */
10 | export const isMultiOutSameTransaction = (transaction: Transaction): boolean =>
11 | transaction.type === TransactionType.Payment && transaction.subtype === TransactionPaymentSubtype.MultiOutSameAmount;
12 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/sendAmountToMultipleRecipientsArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 | import {MultioutRecipientAmount} from '../multioutRecipientAmount';
3 |
4 | /**
5 | * The argument object for {@link TransactionApi.sendAmountToMultipleRecipients}
6 | *
7 | * @param recipientAmounts The list of recipients and their respective amounts
8 | * @throws if have duplicate recipient Ids in recipientAmounts
9 | *
10 | * @category args
11 | */
12 | export interface SendAmountToMultipleRecipientsArgs extends DefaultSendArgs {
13 | recipientAmounts: MultioutRecipientAmount[];
14 | }
15 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/contract/getContract.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {Contract} from '@signumjs/contracts';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link ContractApi}.
9 | *
10 | * See details at {@link ContractApi.getContract}
11 | *
12 | * @category factories
13 | */
14 | export const getContract = (service: ChainService):
15 | (id: string) => Promise =>
16 | (id: string): Promise =>
17 | service.query('getAT', {
18 | at: id,
19 | });
20 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/alias/getAliasById.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {AliasList} from '../../../typings/aliasList';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link AliasApi}.
9 | *
10 | * See details at {@link AliasApi.getAliasById}
11 | *
12 | * @category factories
13 | */
14 | export const getAliasById = (service: ChainService):
15 | (aliasId: string) => Promise =>
16 | (aliasId: string): Promise => service.query('getAlias', {
17 | alias: aliasId,
18 | });
19 |
--------------------------------------------------------------------------------
/packages/core/src/typings/unsignedTransaction.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Original work Copyright (c) 2019 Burst Apps Team
4 | * Modified work Copyright (c) 2022 Signum Network
5 | */
6 |
7 | /**
8 | * Unsigned Transaction
9 | *
10 | * This is being returned from transaction methods, if no private key was given
11 | *
12 | * @category entities
13 | * */
14 | export interface UnsignedTransaction {
15 | readonly signatureHash: string;
16 | readonly unsignedTransactionBytes: string;
17 | readonly transactionJSON: object;
18 | readonly broadcasted: boolean;
19 | readonly requestProcessingTime: number;
20 | }
21 |
22 |
23 |
--------------------------------------------------------------------------------
/packages/util/src/internal/twosComplementBinary.ts:
--------------------------------------------------------------------------------
1 | /** @ignore */
2 | /** @internal */
3 | /** */
4 | import BigNumber from 'bignumber.js';
5 |
6 | export const twosComplementBinary = (bn: BigNumber) => {
7 | // we manually implement our own two's complement (flip bits, add one)
8 | let bin = bn.multipliedBy(-1).toString(2);
9 | while (bin.length % 8) {
10 | bin = '0' + bin;
11 | }
12 | const prefix = ('1' === bin[0] && -1 !== bin.slice(1).indexOf('1')) ? '11111111' : '';
13 | bin = bin.split('').map(i => '0' === i ? '1' : '0').join('');
14 | return new BigNumber(prefix + bin, 2).plus(1);
15 | };
16 |
--------------------------------------------------------------------------------
/packages/crypto/src/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This package contains all cryptographic functions
3 | * needed for Burstcoin/Signum.
4 | *
5 | * @module crypto
6 | * */
7 | export * from './decrypt';
8 | export * from './encrypt';
9 | export * from './random';
10 | export * from './mnemonic';
11 | export * from './sha256';
12 | export * from './sign';
13 | export * from './typings/cryptoError';
14 | export * from './typings/signKeys';
15 | export * from './typings/encryptedMessage';
16 | export * from './typings/encryptedData';
17 | export * from './typings/cryptoAdapter';
18 | export {Buffer, Crypto} from './base'; // export as very useful!
19 |
--------------------------------------------------------------------------------
/packages/http/src/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The Http Module is a thin wrapper around the isomorhpic Http Implementation [axios](https://github.com/axios/axios)
3 | * It mainly unifies responses such that its use is consistent
4 | *
5 | * @module http
6 | */
7 |
8 | import {Http} from './http';
9 | import {HttpResponse} from './httpResponse';
10 | import {HttpError} from './httpError';
11 | import {HttpMockBuilder} from './httpMockBuilder';
12 | import {HttpClientFactory} from './httpClientFactory';
13 |
14 | export {
15 | Http,
16 | HttpClientFactory,
17 | HttpResponse,
18 | HttpMockBuilder,
19 | HttpError,
20 | };
21 |
22 |
--------------------------------------------------------------------------------
/packages/util/src/convertBase36StringToHexString.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2021 Burst Apps Team
3 | */
4 |
5 | import BigNumber from 'bignumber.js';
6 |
7 | /**
8 | * Converts/Decodes a Base36 encoded string into hex string. UTF-8 is supported
9 | * Inverse function {@link convertHexStringToBase36String}
10 | * @param b36 The string to be decoded (either URI encoded or not)
11 | * @return {string} The hex representation of input string
12 | *
13 | * @category conversion
14 | */
15 | export const convertBase36StringToHexString = (b36: string): string => {
16 | return new BigNumber(b36, 36).toString(16);
17 | };
18 |
--------------------------------------------------------------------------------
/packages/util/src/convertBase64StringToString.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | import {Base64} from 'js-base64';
7 |
8 | /**
9 | * Converts/Decodes a Base64 encoded string to string. UTF-8 is supported
10 | * Inverse function {@link convertStringToBase64String}
11 | * @param b64 The string to be decoded (either URI encoded or not)
12 | * @return {string} The original string
13 | *
14 | * @category conversion
15 | */
16 | export const convertBase64StringToString = (b64: string): string => {
17 | return Base64.decode(b64);
18 | };
19 |
--------------------------------------------------------------------------------
/packages/util/src/convertHexStringToBase36String.ts:
--------------------------------------------------------------------------------
1 | /**
2 | Original work Copyright (c) 2021 Burst Apps Team
3 | */
4 |
5 | import BigNumber from 'bignumber.js';
6 |
7 | /**
8 | * Converts/Decodes a Hex encoded string into Base36 string. UTF-8 is supported
9 | * Inverse function {@link convertBase36StringToHexString}
10 | * @param hex The string to be decoded (either URI encoded or not)
11 | * @return {string} The hex representation of input string
12 | *
13 | * @category conversion
14 | */
15 | export const convertHexStringToBase36String = (hex: string): string => {
16 | return new BigNumber(hex, 16).toString(36);
17 | };
18 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/network/getTime.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {ChainTimestamp} from '../../../typings/chainTimestamp';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link NetworkApi}.
10 | *
11 | * See details at {@link NetworkApi.getTime}
12 | *
13 | * @category factories
14 | */
15 | export const getTime = (service: ChainService): () => Promise =>
16 | async (): Promise => service.query('getTime');
17 |
18 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/network/getServerStatus.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {ServerStatus} from '../../../typings/serverStatus';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link NetworkApi}.
10 | *
11 | * See details at {@link NetworkApi.getServerStatus}
12 | *
13 | * @category factories
14 | */
15 | export const getServerStatus = (service: ChainService): () => Promise =>
16 | (): Promise => service.query('getState');
17 |
--------------------------------------------------------------------------------
/packages/core/src/attachment/getAttachmentVersion.ts:
--------------------------------------------------------------------------------
1 | import {Transaction} from '../typings/transaction';
2 | import {AttachmentVersionIdentifier} from '../typings/attachmentVersionIdentifier';
3 |
4 | /**
5 | * Gets the attachment version
6 | * @param transaction The transaction to be checked
7 | * @param versionIdentifier The versionIdentifier string, i.e. MultiOutCreation
8 | * @return 0 if not existent, or version number
9 | *
10 | */
11 | export function getAttachmentVersion(transaction: Transaction, versionIdentifier: AttachmentVersionIdentifier): number {
12 | return transaction?.attachment?.[`version.${versionIdentifier}`] ?? 0;
13 | }
14 |
--------------------------------------------------------------------------------
/packages/core/src/constants/transactionAssetSubtype.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | * Modified work Copyright (c) 2023 Signum Network
4 | */
5 |
6 | /**
7 | * Constants for asset/token subtypes
8 | *
9 | * @category transaction-types
10 | */
11 | export enum TransactionAssetSubtype {
12 | AssetIssuance = 0,
13 | AssetTransfer,
14 | AskOrderPlacement,
15 | BidOrderPlacement,
16 | AskOrderCancellation,
17 | BidOrderCancellation,
18 | AssetMint,
19 | AssetAddTreasureyAccount,
20 | AssetDistributeToHolders,
21 | AssetMultiTransfer,
22 | AssetTransferOwnership
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/packages/core/src/typings/blockchainStatus.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | /**
7 | * Blockchain Status
8 | * @category entities
9 | */
10 | export interface BlockchainStatus {
11 | readonly application: string;
12 | readonly cumulativeDifficulty: string;
13 | readonly isScanning: boolean;
14 | readonly lastBlock: string;
15 | readonly lastBlockchainFeeder: string;
16 | readonly lastBlockchainFeederHeight: number;
17 | readonly numberOfBlocks: number;
18 | readonly time: number;
19 | readonly version: string;
20 | }
21 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/mintAssetArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 |
4 | /**
5 | * The argument object for {@link AssetApi.issueAsset}
6 | *
7 | *
8 | * @category args
9 | */
10 | export interface MintAssetArgs extends DefaultSendArgs {
11 | /**
12 | * The asset/token id to be minted. Note: Asset must be mintable
13 | */
14 | assetId: string;
15 | /**
16 | * The amount of assets to be minted (take the decimals into consideration)
17 | * If you set decimals to 4 and want to have 100 full assets, you need to set this value to 1000000
18 | */
19 | quantity: string | number;
20 | }
21 |
--------------------------------------------------------------------------------
/packages/standards/src/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The Standards Module implements all [Signum SRCs](https://github.com/signum-network/SIPs/tree/master/SRC)
3 | *
4 | * Implements
5 | *
6 | * - SRC44: Standard for [Deeplinks](https://github.com/signum-network/SIPs/blob/master/SIP/sip-22.md)
7 | * - SRC44: Standard for [Descriptions](https://github.com/signum-network/SIPs/blob/master/SIP/sip-44.md)
8 | * - SRC47: Standard for [URI Resolution](https://github.com/signum-network/SIPs/blob/master/SIP/sip-47.md)
9 | *
10 | * @module standards
11 | */
12 | export * as src22 from './src22';
13 | export * as src44 from './src44';
14 | export * as src47 from './src47';
15 |
--------------------------------------------------------------------------------
/packages/contracts/src/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The Contracts package provides functions and messages
3 | * to interact with Signum Smart Contracts, i.e. generate method calls
4 | * and inspect contract data
5 | *
6 | * @module contracts
7 | * */
8 |
9 |
10 | export * from './getContractDatablock';
11 | export * from './convertShortStringToContractData';
12 | export * from './ContractDataView';
13 | export * from './constants';
14 | export * from './countCodePages';
15 | export * from './countDataPages';
16 | export * from './calculateMinimumCreationFee';
17 | export * from './generateMethodCall';
18 | export * from './generateDataStack';
19 | export * from './typings';
20 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/account/getAccountBalance.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | import {ChainService} from '../../../service/chainService';
6 | import {Balance} from '../../../typings/balance';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link AccountApi}.
10 | *
11 | * See details at {@link AccountApi.getAccountBalance}
12 | *
13 | * @category factories
14 | */
15 | export const getAccountBalance = (service: ChainService):
16 | (accountId: string) => Promise =>
17 | (accountId: string): Promise => service.query('getBalance', {
18 | account: accountId,
19 | });
20 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/network/getPeers.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 | import { ChainService } from '../../../service/chainService';
5 | import { PeerAddressList } from '../../../typings/peerAddressList';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link NetworkApi}.
9 | *
10 | * See details at {@link NetworkApi.getPeers}
11 | *
12 | * @category factories
13 | */
14 | export const getPeers = (service: ChainService):
15 | (active: boolean) => Promise =>
16 | (active: boolean = true): Promise =>
17 | service.query('getPeers', {
18 | active,
19 | });
20 |
--------------------------------------------------------------------------------
/packages/crypto/src/typings/cryptoAdapter.ts:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * The CryptoAdapter interface used by {@link Crypto} class
4 | *
5 | * Out of the box, @signumjs/crypto provides web and nodejs using this interface
6 | *
7 | * One might need to implement this interface for other environments, i.e. React Native and use {@link Crypto.init}
8 | *
9 | */
10 | export interface CryptoAdapter {
11 | encryptAes256Cbc(plaintext: Uint8Array, key: Uint8Array): Promise;
12 | decryptAes256Cbc(ciphertext: Uint8Array, key: Uint8Array): Promise;
13 | sha256(data: ArrayBuffer): Uint8Array;
14 | getRandomValues(array: Uint8Array): Uint8Array;
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/sendSameAmountToMultipleRecipientsArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 | /**
4 | * The argument object for {@link TransactionApi.sendSameAmountToMultipleRecipients}
5 | *
6 | * @param recipientIds The list of recipient Ids
7 | * @param amountPlanck The amount to be sent to all recipients
8 | * @param dedupe Automatically removes duplicate recipient ids. Default is false, which will throw an error then.
9 | *
10 | * @category args
11 | */
12 | export interface SendSameAmountToMultipleRecipientsArgs extends DefaultSendArgs {
13 | recipientIds: string[];
14 | amountPlanck: string;
15 | dedupe?: boolean;
16 | }
17 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/block/getBlockId.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {BlockId} from '../../..';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link BlockApi}.
10 | *
11 | * See details at {@link BlockApi.getBlockId}
12 | *
13 | * @category factories
14 | */
15 | export const getBlockId = (service: ChainService):
16 | (height: number) => Promise =>
17 | (height: number): Promise =>
18 | service.query('getBlockId', {
19 | height,
20 | });
21 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/transaction/getUnconfirmedTransactions.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2020 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service';
5 | import {UnconfirmedTransactionList} from '../../..';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link TransactionApi}.
9 | *
10 | * See details at {@link TransactionApi.getUnconfirmedTransactions}
11 | *
12 | * @category factories
13 | */
14 | export const getUnconfirmedTransactions = (service: ChainService):
15 | () => Promise =>
16 | (): Promise =>
17 | service.query('getUnconfirmedTransactions');
18 |
--------------------------------------------------------------------------------
/packages/standards/src/src22/args/createDeeplinkArgs.ts:
--------------------------------------------------------------------------------
1 | import {EncoderFormat} from '../encoderFormat';
2 |
3 | /**
4 | * The argument object for {@link createDeeplink}
5 | *
6 | * @param {string?} domain The domain used in the protocol
7 | * @param {string?} action The actions name
8 | * @param {any?} payload The payload for the action. The payload will be encoded according the _encoderFormat_ parameter
9 | * @param {EncoderFormat?} encoderFormat The selected format for the payload encoding
10 | *
11 | *
12 | */
13 | export interface CreateDeeplinkArgs {
14 | domain?: string;
15 | action?: string;
16 | payload?: any;
17 | encoderFormat?: EncoderFormat;
18 | }
19 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/network/getBlockchainStatus.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {BlockchainStatus} from '../../../typings/blockchainStatus';
7 |
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link NetworkApi}.
11 | *
12 | * See details at {@link NetworkApi.getBlockchainStatus}
13 | *
14 | * @category factories
15 | */
16 | export const getBlockchainStatus = (service: ChainService): () => Promise =>
17 | (): Promise => service.query('getBlockchainStatus');
18 |
--------------------------------------------------------------------------------
/examples/nodejs/helper/api.js:
--------------------------------------------------------------------------------
1 | const {composeApi} = require("@signumjs/core");
2 |
3 | // this is not recommended, but it may happen that the SSL cert of a peer is not
4 | // completely valid
5 | process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
6 |
7 | // this is how you configure your api
8 | // Alternatively, you can use LedgerClientFactory.create({...})
9 | const api = composeApi({
10 | nodeHost: "https://europe.signum.network"
11 | });
12 |
13 | console.info('-------------------------------------------');
14 | console.info(`The selected Signum Node is node is: ${api.service.settings.nodeHost}`);
15 | console.info('-------------------------------------------');
16 |
17 | module.exports = api;
18 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getTopLevelDomainsArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The argument object for {@link AliasApi.getTopLevelDomains}
3 | *
4 | *
5 | * @category args
6 | */
7 | export interface GetTopLevelDomainsArgs {
8 | /**
9 | * The first index to be returned. Use this for pagination. Starts at 0
10 | */
11 | firstIndex?: number;
12 | /**
13 | * The last index to be returned. Use this for pagination. If not set, at maximum 500 items beginning at firstIndex will be returned
14 | */
15 | lastIndex?: number;
16 | /**
17 | * The timestamp in seconds since genesis block
18 | * @see {@link util.ChainTime}
19 | */
20 | timestamp?: number;
21 | }
22 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/transferAssetOwnershipArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 |
4 | /**
5 | * The argument object for {@link AssetApi.transferAssetOwnership}
6 | *
7 | *
8 | * @category args
9 | */
10 | export interface TransferAssetOwnershipArgs extends DefaultSendArgs {
11 | /**
12 | * The id of the recipient, i.e. new owner
13 | */
14 | recipientId: string;
15 |
16 | /**
17 | * The full hash of the token issuance transaction
18 | */
19 | referencedTransactionFullHash: string;
20 |
21 | /**
22 | * The _optional_ recipients public key in hex format.
23 | */
24 | recipientPublicKey?: string;
25 | }
26 |
--------------------------------------------------------------------------------
/packages/crypto/src/__tests__/sha256.spec.ts:
--------------------------------------------------------------------------------
1 | import {describe, expect, test} from 'vitest';
2 |
3 | import {sha256AsBase64, sha256AsHex} from '../sha256';
4 |
5 | describe('sha256', () => {
6 |
7 | // implicitely tests sha256Raw and sha256Byte
8 | test('Should be able to generate sha256AsHex', () => {
9 | const hash = sha256AsHex('Some Text');
10 | expect(hash).toEqual('a7fd4c665fbf6375d99046ef9c525e8578feb7a4794d119447282db151c12cae');
11 | });
12 | test('Should be able to generate sha256AsBase64', () => {
13 | const hash = sha256AsBase64('Some Text');
14 | expect(hash).toEqual('p/1MZl+/Y3XZkEbvnFJehXj+t6R5TRGURygtsVHBLK4=');
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getAllAssets.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Modified work Copyright (c) 2019 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service';
5 | import {AssetList} from '../../../typings/assetList';
6 | import {GetAllAssetsArgs} from '../../../typings/args/getAllAssetsArgs';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link AssetApi}.
10 | *
11 | * See details at {@link AssetApi.getAllAssets}
12 | *
13 | * @category factories
14 | */
15 | export const getAllAssets = (service: ChainService):
16 | (args: GetAllAssetsArgs) => Promise =>
17 | (args: GetAllAssetsArgs): Promise => service.query('getAllAssets', args);
18 |
--------------------------------------------------------------------------------
/packages/util/src/convertAssetPriceToPlanck.ts:
--------------------------------------------------------------------------------
1 | /**
2 | Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {Amount} from './amount';
5 |
6 | /**
7 | * Converts an Asset Price (priceNQT) into Planck returned in Trade and/or Order objects from node
8 | * @param assetPrice The priceNQT from asset queries
9 | * @param decimals The decimals of that asset
10 | *
11 | * @category conversion
12 | */
13 | export function convertAssetPriceToPlanck(assetPrice: string, decimals: number): string {
14 | // I'm "abusing" the Amount with its bignumber calculations here...Signa allows 8 decimals...
15 | return Amount.fromSigna(assetPrice).multiply(10 ** (decimals - 8)).getPlanck();
16 | }
17 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/transaction/getTransactionByFullHash.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2023 Signum Network
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {Transaction} from '../../../typings/transaction';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link TransactionApi}.
9 | *
10 | * See details at {@link TransactionApi.getTransactionByFullHash}
11 | *
12 | * @category factories
13 | */
14 | export const getTransactionByFullHash = (service: ChainService):
15 | (fullHash: string) => Promise =>
16 | (fullHash: string): Promise =>
17 | service.query('getTransaction', {fullHash: fullHash});
18 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/transaction/index.ts:
--------------------------------------------------------------------------------
1 | export * from './broadcastTransaction';
2 | export * from './getTransaction';
3 | export * from './getTransactionByFullHash';
4 | export * from './sendAmountToSingleRecipient';
5 | export * from './getDistributionAmountsFromTransaction';
6 | export * from './sendSameAmountToMultipleRecipients';
7 | export * from './sendAmountToMultipleRecipients';
8 | export * from './createSubscription';
9 | export * from './cancelSubscription';
10 | export * from './getSubscription';
11 | export * from './getUnconfirmedTransactions';
12 | export * from './signAndBroadcastTransaction';
13 | export * from './parseTransactionBytes';
14 | export * from './getSubscriptionPayments';
15 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/alias/getAliasByName.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | * Modified (c) 2023 Signum Network
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {AliasList} from '../../../typings/aliasList';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link AliasApi}.
10 | *
11 | * See details at {@link AliasApi.getAliasByName}
12 | *
13 | * @category factories
14 | */
15 | export const getAliasByName = (service: ChainService):
16 | (aliasName: string, tld?: string) => Promise =>
17 | (aliasName: string, tld?: string): Promise => service.query('getAlias', {
18 | aliasName,
19 | tld
20 | });
21 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/addAssetTreasuryAccountArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 |
4 | /**
5 | * The argument object for {@link AssetApi.addAssetTreasuryAccount}
6 | *
7 | * @category args
8 | */
9 | export interface AddAssetTreasuryAccountArgs extends DefaultSendArgs {
10 | /**
11 | * The account to be added
12 | */
13 | accountId: string;
14 | /**
15 | * The full hash of the transaction of issued asset. It's a hexadecimal value
16 | */
17 | referencedTransactionFullHash: string;
18 | /**
19 | * You may send a public key of the recipient, this might even "activate" the account.
20 | */
21 | recipientPublicKey?: string;
22 | }
23 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "module": "NodeNext",
5 | "declaration": true,
6 | "noImplicitAny": false,
7 | "noImplicitThis": true,
8 | "strictNullChecks": false,
9 | "skipLibCheck": true,
10 | "strict": true,
11 | "removeComments": false,
12 | "noLib": false,
13 | "emitDecoratorMetadata": true,
14 | "experimentalDecorators": true,
15 | "moduleResolution": "NodeNext",
16 | "target": "ESNext",
17 | "sourceMap": true,
18 | "lib": [
19 | "ESNext",
20 | "dom"
21 | ]
22 | },
23 | "exclude": [
24 | "node_modules",
25 | "**/*.spec.ts",
26 | "**/__tests__/**/*",
27 | "**/dist/**/*"
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/examples/nodejs/helper/provideLedger.js:
--------------------------------------------------------------------------------
1 | const {LedgerClientFactory} = require("@signumjs/core");
2 |
3 | // this is not recommended in production, but it may happen that the SSL cert of a peer is not
4 | // completely valid
5 | process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
6 |
7 | // We create the ledger with a custom node host
8 | module.exports = (nodeHost) => {
9 | const ledger = LedgerClientFactory.createClient({
10 | nodeHost
11 | });
12 |
13 | console.info('-------------------------------------------');
14 | console.info(`The selected Signum Node is node is: ${ledger.service.settings.nodeHost}`);
15 | console.info('-------------------------------------------');
16 |
17 | return ledger
18 | }
19 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/placeAskOrder.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2020 Burst Apps Team
3 | * Modified (c) 2022 Signum Network
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {PlaceOrderArgs} from '../../../typings/args';
7 | import {placeOrder} from './placeOrder';
8 |
9 | /**
10 | *
11 | * Use with {@link ApiComposer} and belongs to {@link AssetApi.placeAskOrder}.
12 | *
13 | * See details at {@link AssetApi.placeAskOrder}
14 | *
15 | *
16 | * @category factories
17 | */
18 | export const placeAskOrder = (service: ChainService) =>
19 | async (args: PlaceOrderArgs) =>
20 | placeOrder(service)({
21 | type: 'ask',
22 | ...args,
23 | });
24 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/placeBidOrder.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2020 Burst Apps Team
3 | * Modified (c) 2022 Signum Network
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {PlaceOrderArgs} from '../../../typings/args';
7 | import {placeOrder} from './placeOrder';
8 |
9 | /**
10 | *
11 | * Use with {@link ApiComposer} and belongs to {@link AssetApi.placeBidOrder}.
12 | *
13 | * See details at {@link AssetApi.placeBidOrder}
14 | *
15 | *
16 | * @category factories
17 | */
18 | export const placeBidOrder = (service: ChainService) =>
19 | async (args: PlaceOrderArgs) =>
20 | placeOrder(service)({
21 | type: 'bid',
22 | ...args,
23 | });
24 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/transaction/getSubscription.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 | import {ChainService} from '../../../service';
6 | import {Subscription} from '../../..';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link TransactionApi}.
10 | *
11 | * See details at {@link TransactionApi.getSubscription}
12 | *
13 | * @category factories
14 | */
15 | export const getSubscription = (service: ChainService):
16 | (subscriptionId: string) => Promise =>
17 | (subscriptionId: string): Promise =>
18 | service.query('getSubscription', {subscription: subscriptionId});
19 |
--------------------------------------------------------------------------------
/packages/core/src/typings/subscription.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Original work Copyright (c) 2020 Burst Apps Team
4 | * Modified 2023 Signum Network
5 | */
6 |
7 | /**
8 | * Subscription
9 | * @category entities
10 | * */
11 | export interface Subscription {
12 | readonly id: string;
13 | readonly sender: string;
14 | readonly senderRS: string;
15 | readonly recipient: string;
16 | readonly recipientRS: string;
17 | readonly amountNQT: string;
18 | readonly frequency: number;
19 | readonly timeNext: number;
20 | readonly requestProcessingTime: number;
21 | readonly alias?: string;
22 | readonly aliasName?: string;
23 | readonly tld?: string;
24 | readonly tldName?: string;
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/packages/standards/src/src44/typings/args/setAliasDescriptorArgs.ts:
--------------------------------------------------------------------------------
1 | import {DescriptorData} from '../../DescriptorData';
2 |
3 | /**
4 | * Arguments for {@link DescriptorDataClient.setAliasDescriptor}
5 | *
6 | */
7 | export interface SetAliasDescriptorArgs {
8 | aliasName: string;
9 | /**
10 | * Optional Top Level Domain, if not given 'signum' (as per default) is used
11 | */
12 | tld?: string;
13 | descriptorData: DescriptorData;
14 | /**
15 | * If not given the minimum transaction fee is being calculated
16 | */
17 | feePlanck?: string;
18 | senderPublicKey: string;
19 | senderPrivateKey?: string;
20 | deadline?: number;
21 | referencedTransactionFullHash?: string;
22 | }
23 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/cancelAskOrder.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2020 Burst Apps Team
3 | * Modified (c) 2022 Signum Network
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {CancelOrderArgs} from '../../../typings/args';
7 | import {cancelOrder} from './cancelOrder';
8 |
9 | /**
10 | *
11 | * Use with {@link ApiComposer} and belongs to {@link AssetApi.cancelAskOrder}.
12 | *
13 | * See details at {@link AssetApi.cancelAskOrder}
14 | *
15 | *
16 | * @category factories
17 | */
18 | export const cancelAskOrder = (service: ChainService) =>
19 | async (args: CancelOrderArgs) =>
20 | cancelOrder(service)({
21 | type: 'ask',
22 | ...args,
23 | });
24 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/cancelBidOrder.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2020 Burst Apps Team
3 | * Modified (c) 2022 Signum Network
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {CancelOrderArgs} from '../../../typings/args';
7 | import {cancelOrder} from './cancelOrder';
8 |
9 | /**
10 | *
11 | * Use with {@link ApiComposer} and belongs to {@link AssetApi.cancelBidOrder}.
12 | *
13 | * See details at {@link AssetApi.cancelBidOrder}
14 | *
15 | *
16 | * @category factories
17 | */
18 | export const cancelBidOrder = (service: ChainService) =>
19 | async (args: CancelOrderArgs) =>
20 | cancelOrder(service)({
21 | type: 'bid',
22 | ...args,
23 | });
24 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/transaction/parseTransactionBytes.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {Transaction} from '../../../typings/transaction';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link TransactionApi}.
9 | *
10 | * See details at {@link TransactionApi.parseTransactionBytes}
11 | *
12 | * @category factories
13 | */
14 | export const parseTransactionBytes = (service: ChainService):
15 | (transactionHexBytes: string) => Promise =>
16 | (transactionHexBytes: string): Promise =>
17 | service.query('parseTransaction', {transactionBytes: transactionHexBytes});
18 |
--------------------------------------------------------------------------------
/packages/crypto/src/typings/signKeys.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | * Modified work Copyright (c) 2024 Signum Network
5 | */
6 |
7 | /**
8 | * Sign Keys interface
9 | *
10 | * The Keys class is used to encompass keys associated to an account.
11 | *
12 | *
13 | * @category signing
14 | */
15 | export interface SignKeys {
16 | /**
17 | * The private key used for P2P message encryption
18 | */
19 | agreementPrivateKey: string;
20 | /**
21 | * The public key
22 | */
23 | publicKey: string;
24 | /**
25 | * The private key used for transaction signing
26 | */
27 | signPrivateKey: string;
28 | }
29 |
--------------------------------------------------------------------------------
/packages/util/src/convertStringToByteArray.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | /**
7 | * Converts a string into byte array
8 | * Inverse function {@link convertByteArrayToString}
9 | * @param str The string to be converted
10 | * @return {number[]} A byte array representing the string input
11 | *
12 | * @category conversion
13 | */
14 | export const convertStringToByteArray = (str: string): Uint8Array => {
15 | const s = unescape(encodeURIComponent(str));
16 | const bytes = new Uint8Array(s.length);
17 | for (let i = 0; i < s.length; ++i) {
18 | bytes[i] = s.charCodeAt(i);
19 | }
20 |
21 | return bytes;
22 | };
23 |
--------------------------------------------------------------------------------
/packages/standards/src/src22/DeeplinkParts.ts:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * The resulting structure of {@link parseDeeplink}
4 | *
5 | *
6 | */
7 | export interface DeeplinkParts {
8 | /**
9 | * The domain, if given
10 | */
11 | domain?: string;
12 | /**
13 | * The version
14 | */
15 | version: string;
16 | /**
17 | * The actions name, if given
18 | */
19 | action?: string;
20 | /**
21 | * The raw/encoded payload
22 | */
23 | payload?: string;
24 | /**
25 | * The decoded payload. As per default parseDeeplink tries to parse the content
26 | * as JSON object. If this does not work the decoded string will be returned.
27 | */
28 | decodedPayload?: object | string;
29 | }
30 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/alias/getTopLevelDomains.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2023 Signum Network
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {GetTopLevelDomainsArgs} from '../../../typings/args/getTopLevelDomainsArgs';
6 | import {TopLevelDomainList} from '../../../typings/topLevelDomainList';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link AliasApi}.
10 | *
11 | * See details at {@link AliasApi.getTopLevelDomains}
12 | *
13 | * @category factories
14 | */
15 | export const getTopLevelDomains = (service: ChainService):
16 | (args: GetTopLevelDomainsArgs) => Promise =>
17 | (args: GetTopLevelDomainsArgs): Promise => service.query('getTLDs', args);
18 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/alias/searchAliasesByName.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | * Modified (c) 2023 Signum Network
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {AliasList} from '../../../typings/aliasList';
7 | import { SearchAliasesByNameArgs } from '../../../typings/args/searchAliasesByNameArgs';
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link AliasApi}.
11 | *
12 | * See details at {@link AliasApi.searchAliasesByName}
13 | *
14 | * @category factories
15 | */
16 | export const searchAliasesByName = (service: ChainService):
17 | (args: SearchAliasesByNameArgs) => Promise =>
18 | (args): Promise => service.query('getAliasesByName', args);
19 |
--------------------------------------------------------------------------------
/packages/util/src/convertHexStringToString.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | import {convertByteArrayToString} from './convertByteArrayToString';
7 | import {convertHexStringToByteArray} from './convertHexStringToByteArray';
8 |
9 | /**
10 | * Converts a Hexadecimally encoded string into String
11 | * Inverse function {@link convertStringToHexString}
12 | * @param hex The Hex string to be converted
13 | * @return {string} The string represented by the Hex String
14 | *
15 | * @category conversion
16 | */
17 | export const convertHexStringToString = (hex: string): string => {
18 | return convertByteArrayToString(convertHexStringToByteArray(hex));
19 | };
20 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/block/getBlockByTimestamp.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {Block} from '../../../typings/block';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link BlockApi}.
9 | *
10 | * See details at {@link BlockApi.getBlockByTimestamp}
11 | *
12 | * @category factories
13 | */
14 | export const getBlockByTimestamp = (service: ChainService):
15 | (timestamp: number, includeTransactions: boolean) => Promise =>
16 | (timestamp: number, includeTransactions: boolean): Promise =>
17 | service.query('getBlock', {
18 | timestamp,
19 | includeTransactions
20 | });
21 |
--------------------------------------------------------------------------------
/packages/util/src/convertStringToHexString.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | import {convertStringToByteArray} from './convertStringToByteArray';
7 | import {convertByteArrayToHexString} from './convertByteArrayToHexString';
8 |
9 | /**
10 | * Converts/Encode a String into Hexadecimally encoded
11 | * Inverse function {@link convertHexStringToString}
12 | * @param str The Hex string to be converted
13 | * @return {string} The Hex String representing the input string
14 | *
15 | * @category conversion
16 | */
17 | export const convertStringToHexString = (str: string): string => {
18 | return convertByteArrayToHexString(convertStringToByteArray(str));
19 | };
20 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/account/getRewardRecipient.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2020 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service';
5 | import {RewardRecipient} from '../../..';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link AccountApi}.
9 | *
10 | * See details at {@link AccountApi.getRewardRecipient}
11 | *
12 | * @category factories
13 | */
14 | export const getRewardRecipient = (service: ChainService):
15 | (accountId: string) => Promise =>
16 | async (accountId: string): Promise => {
17 | const parameters = {
18 | account: accountId
19 | };
20 |
21 | return service.query('getRewardRecipient', parameters);
22 |
23 | };
24 |
--------------------------------------------------------------------------------
/examples/nodejs/helper/confirmTransaction.js:
--------------------------------------------------------------------------------
1 | const inquirer = require("inquirer");
2 |
3 | /**
4 | * This method asks for the users passphrase as confirmation for the transaction
5 | */
6 | module.exports = async function confirmTransaction(params) {
7 |
8 | console.info("These are your parameters", JSON.stringify(params, null, `\t`))
9 |
10 | const response = await inquirer.prompt([{
11 | type: 'password',
12 | name: 'passphrase',
13 | message: 'Please enter your passphrase and confirm the transaction (Hit Enter to Abort)',
14 | default: null
15 | }])
16 |
17 | if(!response.passphrase){
18 | console.info('Aborted by user')
19 | process.exit(-1)
20 | return null
21 | }
22 |
23 | return response
24 | }
25 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAliasesOnSaleArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The argument object for {@link AliasApi.getAliasesOnSale}
3 | *
4 | *
5 | * @category args
6 | */
7 | export interface GetAliasesOnSaleArgs {
8 | /**
9 | * The account id of the owner, to filter alias sales by owner
10 | */
11 | accountId?: string;
12 | /**
13 | * The account id of the buyer, to filter alias direct offers
14 | */
15 | buyerId?: string;
16 | /**
17 | * The first index to be returned. Use this for pagination. Starts at 0
18 | */
19 | firstIndex?: number;
20 | /**
21 | * The last index to be returned. Use this for pagination. If not set, at maximum 500 items beginning at firstIndex will be returned
22 | */
23 | lastIndex?: number;
24 | }
25 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/block/getBlockById.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {Block} from '../../../typings/block';
7 |
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link BlockApi}.
11 | *
12 | * See details at {@link BlockApi.getBlockById}
13 | *
14 | * @category factories
15 | */
16 | export const getBlockById = (service: ChainService):
17 | (block: string, includeTransactions: boolean) => Promise =>
18 | (block: string, includeTransactions: boolean): Promise =>
19 | service.query('getBlock', {
20 | block,
21 | includeTransactions
22 | });
23 |
--------------------------------------------------------------------------------
/packages/contracts/src/typings/args/generateMethodCallArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | * Modified Work (c) 2022 Signum Network
4 | */
5 |
6 | import {ContractData} from '../contractData';
7 |
8 | /**
9 | * The argument object for {@link generateMethodCall}
10 | *
11 | * @param {string} methodId The signed long hash for the method generated by BlockTalk compiler
12 | * @param {ContractData[]} methodArgs Optional argument list for the method.
13 | * The arguments must be numerical, and cannot be alphanumeric. To convert a short text (max 8 chars/bytes) into a numerical representation
14 | * use {@link convertShortStringToContractData}
15 | *
16 | */
17 | export interface GenerateMethodCallArgs {
18 | methodId: string;
19 | methodArgs?: ContractData[];
20 | }
21 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/burnAsset.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2020 Burst Apps Team
3 | * Modified (c) 2022 Signum Network
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {TransferAssetArgs} from '../../../typings/args/transferAssetArgs';
7 | import {transferAsset} from './transferAsset';
8 |
9 | /**
10 | *
11 | * Use with {@link ApiComposer} and belongs to {@link AssetApi}.
12 | *
13 | * See details at {@link AssetApi.burnAsset}
14 | *
15 | *
16 | * @category factories
17 | */
18 | export const burnAsset = (service: ChainService) =>
19 | (args: Omit) => transferAsset(service)({
20 | ...args,
21 | recipientId: '0',
22 | recipientPublicKey: undefined
23 | });
24 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/sendMessageArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 |
4 | /**
5 | * The argument object for {@link MessageApi.sendMessage}
6 | *
7 | * @param message The message as text to be sent
8 | * @param messageIsText Defines whether the message is text or another format (hex or base64) (default: `true`)
9 | * @param recipientId The id of the recipient
10 | * @param recipientPublicKey The _optional_ recipients public key in hex format.
11 | * Using this arg allows to activate a recipients account, if not activated yet
12 | *
13 | * @category args
14 | */
15 | export interface SendMessageArgs extends DefaultSendArgs {
16 | message: string;
17 | messageIsText?: boolean;
18 | recipientId: string;
19 | recipientPublicKey?: string;
20 | }
21 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/block/getBlockByHeight.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {Block} from '../../../typings/block';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link BlockApi}.
10 | *
11 | * See details at {@link BlockApi.getBlockByHeight}
12 | *
13 | * @category factories
14 | */
15 | export const getBlockByHeight = (service: ChainService):
16 | (height: number, includeTransactions: boolean) => Promise =>
17 | (height: number, includeTransactions: boolean): Promise =>
18 | service.query('getBlock', {
19 | height,
20 | includeTransactions
21 | });
22 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/transaction/getTransaction.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | * Modified work Copyright (c) 2023 Signum Network
5 | */
6 | import {ChainService} from '../../../service/chainService';
7 | import {Transaction} from '../../../typings/transaction';
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link TransactionApi}.
11 | *
12 | * See details at {@link TransactionApi.getTransaction}
13 | *
14 | * @category factories
15 | */
16 | export const getTransaction = (service: ChainService):
17 | (transactionId: string) => Promise =>
18 | (transactionId: string): Promise =>
19 | service.query('getTransaction', {transaction: transactionId});
20 |
--------------------------------------------------------------------------------
/packages/http/bundle.js:
--------------------------------------------------------------------------------
1 | const esbuildPluginTsc = require('esbuild-plugin-tsc');
2 | const esbuild = require('esbuild');
3 |
4 | function createBuildSettings(options) {
5 | return {
6 | entryPoints: ['./src/index.ts'],
7 | outfile: './dist/signumjs.http.min.js',
8 | globalName: 'sig$http',
9 | minify: true,
10 | sourcemap: true,
11 | format: 'iife',
12 | bundle: true,
13 | plugins: [
14 | esbuildPluginTsc({
15 | force: true
16 | }),
17 | ],
18 | ...options
19 | };
20 | }
21 |
22 | const settings = createBuildSettings();
23 |
24 | esbuild.build({
25 | ...settings,
26 | }).catch( (reason) => {
27 | console.error("Bundling failed:", reason);
28 | process.exit(1)
29 | });
30 |
--------------------------------------------------------------------------------
/packages/util/bundle.js:
--------------------------------------------------------------------------------
1 | const esbuildPluginTsc = require('esbuild-plugin-tsc');
2 | const esbuild = require('esbuild');
3 |
4 | function createBuildSettings(options) {
5 | return {
6 | entryPoints: ['./src/index.ts'],
7 | outfile: './dist/signumjs.util.min.js',
8 | globalName: 'sig$util',
9 | minify: true,
10 | sourcemap: true,
11 | format: 'iife',
12 | bundle: true,
13 | plugins: [
14 | esbuildPluginTsc({
15 | force: true
16 | }),
17 | ],
18 | ...options
19 | };
20 | }
21 |
22 | const settings = createBuildSettings();
23 |
24 | esbuild.build({
25 | ...settings,
26 | }).catch( (reason) => {
27 | console.error("Bundling failed:", reason);
28 | process.exit(1)
29 | });
30 |
--------------------------------------------------------------------------------
/packages/contracts/src/__tests__/generateMethodCall.spec.ts:
--------------------------------------------------------------------------------
1 | import {generateMethodCall} from '../generateMethodCall';
2 |
3 | const ContractMethodId = '-327803124352370';
4 |
5 | describe('generateMethodCall', () => {
6 | it('generates a method call without argument', () => {
7 | const message = generateMethodCall({
8 | methodId: ContractMethodId
9 | });
10 | expect(message).toBe('8e7a3763ddd5feff');
11 | });
12 |
13 | it('generates a method call with three arguments', () => {
14 | const message = generateMethodCall({
15 | methodId: ContractMethodId,
16 | methodArgs: [true, 1234, '-1234567890'],
17 | });
18 | expect(message).toBe('8e7a3763ddd5feff0100000000000000d2040000000000002efd69b6ffffffff');
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/searchAliasesByNameArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The argument object for {@link AliasApi.searchAliasesByName}
3 | *
4 | *
5 | * @category args
6 | */
7 | export interface SearchAliasesByNameArgs {
8 | /**
9 | * The name or part of the name to search for.
10 | */
11 | aliasName: string;
12 | /**
13 | * The first index to be returned. Use this for pagination. Starts at 0
14 | */
15 | firstIndex?: number;
16 | /**
17 | * The last index to be returned. Use this for pagination. If not set, at maximum 500 items beginning at firstIndex will be returned
18 | */
19 | lastIndex?: number;
20 |
21 | /**
22 | * The timestamp in seconds since genesis block.
23 | * @see {@link util.ChainTime}
24 | */
25 | timestamp?: number;
26 | }
27 |
--------------------------------------------------------------------------------
/packages/wallets/bundle.js:
--------------------------------------------------------------------------------
1 | const esbuildPluginTsc = require('esbuild-plugin-tsc');
2 | const esbuild = require('esbuild');
3 |
4 | function createBuildSettings(options) {
5 | return {
6 | entryPoints: ['./src/index.ts'],
7 | outfile: './dist/signumjs.wallets.min.js',
8 | globalName: 'sig$wallets',
9 | minify: true,
10 | sourcemap: true,
11 | format: 'iife',
12 | bundle: true,
13 | plugins: [
14 | esbuildPluginTsc({
15 | force: true
16 | }),
17 | ],
18 | ...options
19 | };
20 | }
21 |
22 | const settings = createBuildSettings();
23 |
24 | esbuild.build({
25 | ...settings,
26 | }).catch( (reason) => {
27 | console.error("Bundling failed:", reason);
28 | process.exit(1)
29 | });
30 |
--------------------------------------------------------------------------------
/packages/contracts/bundle.js:
--------------------------------------------------------------------------------
1 | const esbuildPluginTsc = require('esbuild-plugin-tsc');
2 | const esbuild = require('esbuild');
3 |
4 | function createBuildSettings(options) {
5 | return {
6 | entryPoints: ['./src/index.ts'],
7 | outfile: './dist/signumjs.contracts.min.js',
8 | globalName: 'sig$contracts',
9 | minify: true,
10 | sourcemap: true,
11 | format: 'iife',
12 | bundle: true,
13 | plugins: [
14 | esbuildPluginTsc({
15 | force: true
16 | }),
17 | ],
18 | ...options
19 | };
20 | }
21 |
22 | const settings = createBuildSettings();
23 |
24 | esbuild.build({
25 | ...settings,
26 | }).catch( (reason) => {
27 | console.error("Bundling failed:", reason);
28 | process.exit(1)
29 | });
30 |
--------------------------------------------------------------------------------
/packages/standards/bundle.js:
--------------------------------------------------------------------------------
1 | const esbuildPluginTsc = require('esbuild-plugin-tsc');
2 | const esbuild = require('esbuild');
3 |
4 | function createBuildSettings(options) {
5 | return {
6 | entryPoints: ['./src/index.ts'],
7 | outfile: './dist/signumjs.standards.min.js',
8 | globalName: 'sig$standards',
9 | minify: true,
10 | sourcemap: true,
11 | format: 'iife',
12 | bundle: true,
13 | plugins: [
14 | esbuildPluginTsc({
15 | force: true
16 | }),
17 | ],
18 | ...options
19 | };
20 | }
21 |
22 | const settings = createBuildSettings();
23 |
24 | esbuild.build({
25 | ...settings,
26 | }).catch( (reason) => {
27 | console.error("Bundling failed:", reason);
28 | process.exit(1)
29 | });
30 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/block/getBlocks.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {BlockList} from '../../../typings/blockList';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link BlockApi}.
9 | *
10 | * See details at {@link BlockApi.getBlocks}
11 | *
12 | *
13 | * @category factories
14 | */
15 | export const getBlocks = (service: ChainService):
16 | (firstIndex?: number, lastIndex?: number, includeTransactions?: boolean) => Promise =>
17 | (firstIndex?: number, lastIndex?: number, includeTransactions?: boolean): Promise =>
18 | service.query('getBlocks', {
19 | firstIndex,
20 | lastIndex,
21 | includeTransactions
22 | });
23 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/sendEncryptedMessageArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 | /**
4 | * The argument object for {@link MessageApi.sendEncryptedMessage}
5 | *
6 | * @param message The message that will be encrypted
7 | * @param messageIsText Determine whether content is text or binary data. Defaults to true
8 | * @param recipientId The id of the recipient
9 | * @param recipientPublicKey The recipients public key in hex format.
10 | * @param senderAgreementKey The senders agreement key used for encryption
11 | *
12 | * @category args
13 | */
14 | export interface SendEncryptedMessageArgs extends DefaultSendArgs {
15 | message: string;
16 | messageIsText?: boolean;
17 | recipientId: string;
18 | recipientPublicKey: string;
19 | senderAgreementKey: string;
20 | }
21 |
--------------------------------------------------------------------------------
/packages/core/bundle.js:
--------------------------------------------------------------------------------
1 | const esbuildPluginTsc = require('esbuild-plugin-tsc');
2 | const esbuild = require('esbuild');
3 |
4 | function createBuildSettings(options) {
5 | return {
6 | entryPoints: ['./src/index.ts'],
7 | outfile: './dist/signumjs.min.js',
8 | globalName: 'sig$',
9 | minify: true,
10 | sourcemap: true,
11 | format: 'iife',
12 | bundle: true,
13 | plugins: [
14 | esbuildPluginTsc({
15 | force: true
16 | }),
17 | ],
18 | ...options
19 | };
20 | }
21 |
22 | const settings = createBuildSettings();
23 |
24 | esbuild.build({
25 | ...settings,
26 | external: ["crypto"]
27 | }).catch( (reason) => {
28 | console.error("Bundling failed:", reason);
29 | process.exit(1)
30 | });
31 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/account/getAccountSubscriptions.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {SubscriptionList} from '../../../typings/subscriptionList';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link AccountApi}.
9 | *
10 | * See details at {@link AccountApi.getAccountSubscriptions}
11 | *
12 | * @category factories
13 | */
14 | export const getAccountSubscriptions = (service: ChainService):
15 | (accountId: string) => Promise =>
16 | (accountId: string): Promise => {
17 |
18 | const parameters = {
19 | account: accountId,
20 | };
21 |
22 | return service.query('getAccountSubscriptions', parameters);
23 | };
24 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/network/getSuggestedFees.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {SuggestedFees} from '../../../typings/suggestedFees';
6 | import {FeeQuantPlanck} from '@signumjs/util';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link NetworkApi}.
10 | *
11 | * See details at {@link NetworkApi.getSuggestedFees}
12 | *
13 | * @category factories
14 | */
15 | export const getSuggestedFees = (service: ChainService): () => Promise => {
16 | return async (): Promise => {
17 | const suggestedFees: SuggestedFees = await service.query('suggestFee');
18 | return {
19 | ...suggestedFees,
20 | minimum: FeeQuantPlanck
21 | };
22 | };
23 | };
24 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAllContractsByCodeHashArgs.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The argument object for {@link ContractApi.getAllContractsByCodeHash}
4 | *
5 | *
6 | * @category args
7 | */
8 | export interface GetAllContractsByCodeHashArgs {
9 | /**
10 | * The hash of the machine code
11 | */
12 | machineCodeHash: string;
13 |
14 | /**
15 | * If true all information, including byte code and initial data stack will be returned.
16 | * Note, that using `true` leads to significantly larger payloads
17 | * Default is `false`
18 | */
19 | includeDetails?: boolean;
20 | /**
21 | * The first index of the list, beginning at 0
22 | */
23 | firstIndex?: number;
24 | /**
25 | * The last index of the list. At maximum 500 will be returned
26 | */
27 | lastIndex?: number;
28 | }
29 |
--------------------------------------------------------------------------------
/packages/wallets/src/deeplinkable/deepLinkableOptions.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 |
5 | /**
6 | * The options for the Deeplinkable Wallet
7 | * @module wallets
8 | */
9 | export interface DeeplinkableWalletOptions {
10 | /**
11 | * If true in browser environment, the method calls will try to open the deep link.
12 | * If set to false, the methods just return the generated deeplink.
13 | * In NodeJS this flag will be ignored
14 | */
15 | openInBrowser?: boolean;
16 | /**
17 | * Browser do not support custom URI protocols, i.e. `signum://`, so they need
18 | * a redirect proxy instead. Here you can customize your proxy, but its default is
19 | * set to https://burst-balance-alert.vercel.app/api/redirect?url=
20 | */
21 | redirectProxy?: string;
22 | }
23 |
--------------------------------------------------------------------------------
/packages/util/src/convertHexEndianess.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | /**
7 | * Toggles the endianess of a hex string.
8 | * `0xBEEF` > `0xEFBE`
9 | * If string is little Endianess it turns into Big Endianess, and vice versa
10 | *
11 | * > This method is mainly used for Smart Contract messaging and data inspection
12 | *
13 | * @param hexString The hex string to be converted
14 | * @return The converted string as hex string
15 | *
16 | * @category conversion
17 | */
18 | export const convertHexEndianess = (hexString): string => {
19 | let result = '';
20 | const rawData = hexString;
21 | for (let i = rawData.length - 1; i >= 0; i -= 2) {
22 | result += rawData[i - 1] + rawData[i];
23 | }
24 | return result;
25 | };
26 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getAllTrades.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service';
5 | import {GetAllTradesArgs} from '../../../typings/args/getAllTradesArgs';
6 | import {AssetTradeList} from '../../../typings/assetTradeList';
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link AssetApi}.
9 | *
10 | * See details at {@link AssetApi.getAllTrades}
11 | *
12 | * @category factories
13 | */
14 | export const getAllTrades = (service: ChainService):
15 | (args: GetAllTradesArgs) => Promise =>
16 | async (args: GetAllTradesArgs): Promise => {
17 | const params = {
18 | ...args,
19 | includeAssetInfo: true
20 | };
21 | return service.query('getAllTrades', params);
22 | };
23 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getAsset.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Modified work Copyright (c) 2019 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {Asset} from '../../../typings/asset';
6 | import {GetAssetArgs} from '../../../typings/args';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link AssetApi}.
10 | *
11 | * See details at {@link AssetApi.getAsset}
12 | *
13 | * @category factories
14 | * */
15 | export const getAsset = (service: ChainService):
16 | (args: GetAssetArgs) => Promise =>
17 | (args: GetAssetArgs): Promise =>
18 | service.query('getAsset', {
19 | asset: args.assetId,
20 | quantityMinimumQNT: args.minimumQuantity,
21 | heightStart: args.heightStart,
22 | heightEnd: args.heightEnd
23 | });
24 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This submodule describes the Factory Methods
3 | * of the API. You almost will like to use {@link composeApi}
4 | * or {@link LedgerClientFactory.createClient}
5 | * rather than using the Factory Methods itself
6 | *
7 | * The factory methods are higher-order functions which
8 | * receives a {@link ChainService} instance in first order, and
9 | * the payload in second order.
10 | *
11 | * `factoryMethod(chainServiceInstance)(methodArgs)`
12 | *
13 | * The factory methods are used {@link ApiComposer} and {@link composeApi}
14 | *
15 | * */
16 |
17 | export * from './account';
18 | export * from './alias';
19 | export * from './asset';
20 | export * from './block';
21 | export * from './contract';
22 | export * from './network';
23 | export * from './message';
24 | export * from './transaction';
25 |
--------------------------------------------------------------------------------
/packages/http/src/httpClientFactory.ts:
--------------------------------------------------------------------------------
1 | import {Http} from './http';
2 | import {HttpAdapterAxios} from './httpAdapterAxios';
3 |
4 | /**
5 | * Factory for clients of {@link Http}
6 | *
7 | * @module http
8 | */
9 | export class HttpClientFactory {
10 | /**
11 | * Creates an Http instance
12 | *
13 | * The current default implementation uses https://github.com/axios/axios
14 | *
15 | * @param baseUrl The base/root host url for the adapter, i.e. https://contoso.com
16 | * @param options An arbitrary options object, depending on the implementation.
17 | * As the default implementation uses axios the available options are here: https://axios-http.com/docs/req_config
18 | */
19 | static createHttpClient(baseUrl: string, options?: any): Http {
20 | return new HttpAdapterAxios(baseUrl, options);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/packages/core/src/internal/verifyTransaction/__tests__/getAttachmentFields.spec.ts:
--------------------------------------------------------------------------------
1 | import {getAttachmentFields} from '../getAttachmentFields';
2 |
3 | describe('getAttachmentFields', function () {
4 | it('should return an existing spec', () => {
5 | const spec = getAttachmentFields(1, 'setAlias');
6 | expect(spec).toEqual([{type: 'ByteString*1', parameterName: 'aliasName'},
7 | {type: 'ShortString*1', parameterName: 'aliasURI'}]);
8 | });
9 | it('should throw on non-existing version', () => {
10 |
11 | expect(() => getAttachmentFields(99, 'foo')).toThrow('No attachment specification not found version');
12 | });
13 | it('should throw on non-existing method', () => {
14 | expect(() => getAttachmentFields(2, 'setTLD')).toThrow('Attachment specification not found for transaction type ');
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/transferMultipleAssetsArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 | import {MultioutAssetQuantities} from '../multioutAssetQuantities';
3 |
4 |
5 | /**
6 | * The argument object for {@link AssetApi.transferMultipleAssets}
7 | *
8 | *
9 | * @category args
10 | */
11 | export interface TransferMultipleAssetsArgs extends DefaultSendArgs {
12 | /**
13 | * The list of assets and its quantities. Maximum 4 are allowed
14 | */
15 | assetQuantities: MultioutAssetQuantities[];
16 | /**
17 | * An _optional_ amount in Planck to be sent
18 | */
19 | amountPlanck?: string ;
20 | /**
21 | * The id of the recipient
22 | */
23 | recipientId: string;
24 | /**
25 | * The _optional_ recipients public key in hex format.
26 | */
27 | recipientPublicKey?: string;
28 | }
29 |
--------------------------------------------------------------------------------
/examples/nodejs/advanced/contracts/claimContract.smart.c:
--------------------------------------------------------------------------------
1 | #program name ClaimSigna
2 | #program description This easy contract allows accounts to claim Signa once. Nice for some airdrops. It can be recharged at any time, but the amount to be sent can be set only on initialization
3 | #program activationAmount 0.25
4 |
5 | long amountToSendPerAccount;
6 | long message[4];
7 | message[] = "Successfully claimed SIGNA!";
8 | void main(void) {
9 | long txid;
10 | while ((txid = getNextTx()) != 0) {
11 | long sender = getSender(txid);
12 | if(sender == getCreator()) {
13 | continue;
14 | }
15 | long hasSentAlready = getMapValue(1, sender);
16 | if(!hasSentAlready){
17 | setMapValue(1, sender, 1);
18 | sendAmountAndMessage(amountToSendPerAccount, message, sender);
19 | }
20 | }
21 | };
22 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getOpenAskOrders.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service';
5 | import {GetAssetOpenOrdersArgs} from '../../../typings/args';
6 | import {AssetAskOrderList} from '../../../typings/assetAskOrderList';
7 | import {getOpenOrders} from './getOpenOrders';
8 |
9 | /**
10 | *
11 | * Use with {@link ApiComposer} and belongs to {@link AssetApi.getOpenAskOrders}.
12 | *
13 | * See details at {@link AssetApi.getOpenAskOrders}
14 | *
15 | *
16 | * @category factories
17 | */
18 | export const getOpenAskOrders = (service: ChainService):
19 | (args: GetAssetOpenOrdersArgs) => Promise =>
20 | (args: GetAssetOpenOrdersArgs): Promise =>
21 | getOpenOrders(service)({...args, type: 'ask'}) as Promise;
22 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getOpenBidOrders.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service';
5 | import {GetAssetOpenOrdersArgs} from '../../../typings/args';
6 | import {AssetBidOrderList} from '../../../typings/assetBidOrderList';
7 | import {getOpenOrders} from './getOpenOrders';
8 |
9 | /**
10 | *
11 | * Use with {@link ApiComposer} and belongs to {@link AssetApi.getOpenBidOrders}.
12 | *
13 | * See details at {@link AssetApi.getOpenBidOrders}
14 | *
15 | *
16 | * @category factories
17 | */
18 | export const getOpenBidOrders = (service: ChainService):
19 | (args: GetAssetOpenOrdersArgs) => Promise =>
20 | (args: GetAssetOpenOrdersArgs): Promise =>
21 | getOpenOrders(service)({...args, type: 'bid'}) as Promise;
22 |
--------------------------------------------------------------------------------
/packages/core/src/typings/transactionId.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | * Modified work Copyright (c) 2022 Signum Network
4 | */
5 |
6 | import {Transaction} from './transaction';
7 |
8 | /**
9 | *
10 | * TransactionId
11 | *
12 | * This object is being returned by a signed and broadcasted transaction, i.e. when passed a private key to
13 | * transactional methods.
14 | * @category entities
15 | */
16 | export interface TransactionId {
17 | readonly fullHash: string;
18 | readonly transaction: string;
19 | readonly numberOfPeersSentTo: number;
20 | readonly requestProcessingTime: number;
21 | readonly transactionBytes: string;
22 | readonly unsignedTransactionBytes: string;
23 | readonly signatureHash: string;
24 | readonly broadcasted: boolean;
25 | readonly transactionJSON: Transaction;
26 | }
27 |
--------------------------------------------------------------------------------
/packages/crypto/src/web-bundle.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is the entry point for web-bundle IIFE build
3 | * needed for Burstcoin/Signum.
4 | *
5 | * @ignore
6 | * @internal
7 | * @module crypto
8 | * */
9 | export * from './decrypt';
10 | export * from './encrypt';
11 | export * from './random';
12 | export * from './mnemonic';
13 | export * from './sha256';
14 | export * from './sign';
15 | export * from './typings/cryptoError';
16 | export * from './typings/signKeys';
17 | export * from './typings/encryptedMessage';
18 | export * from './typings/encryptedData';
19 | export * from './typings/cryptoAdapter';
20 | export {Buffer, Crypto} from './base'; // export as very useful!
21 |
22 | // init web adapter
23 | import {Crypto} from './base';
24 | import {WebCryptoAdapter} from './adapters';
25 |
26 | (() => {
27 | Crypto.init(new WebCryptoAdapter());
28 |
29 | })();
30 |
--------------------------------------------------------------------------------
/packages/wallets/src/extension/extensionNotificationHandler.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The notification handler for events in the extension wallet
3 | * @module wallets
4 | */
5 | export interface ExtensionNotificationHandler {
6 | /**
7 | * Called when network changes
8 | */
9 | onNetworkChanged?: (args: {networkName: string, networkHost: string}) => void;
10 | /**
11 | * Called when account changes
12 | */
13 | onAccountChanged?: (args: {accountId: string, accountPublicKey: string}) => void;
14 | /**
15 | * Called when the permission for the currently connected application was removed
16 | */
17 | onPermissionRemoved?: (args: {origin: string}) => void;
18 | /**
19 | * Called when the account for the currently connected application was removed
20 | */
21 | onAccountRemoved?: (args: {accountId: string}) => void;
22 | }
23 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/createSubscriptionArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 | /**
4 | * The argument object for {@link TransactionApi.createSubscription}
5 | **
6 | *
7 | * @category args
8 | */
9 | export interface CreateSubscriptionArgs extends DefaultSendArgs {
10 | /**
11 | * The amount in planck to be paid periodically
12 | */
13 | amountPlanck: string;
14 |
15 | /**
16 | * The frequency of the recurring payments in seconds. Minimum is 3600 seconds
17 | */
18 | frequency: number;
19 |
20 | /**
21 | * The id of the recipient
22 | */
23 | recipientId: string;
24 |
25 | /**
26 | * The _optional_ recipients public key in hex format.
27 | * Using this arg allows to activate a recipients account, if not activated yet
28 | */
29 | recipientPublicKey?: string;
30 | }
31 |
--------------------------------------------------------------------------------
/packages/crypto/bundle.js:
--------------------------------------------------------------------------------
1 | const esbuildPluginTsc = require('esbuild-plugin-tsc');
2 | const esbuild = require('esbuild');
3 |
4 | function createBuildSettings(options) {
5 | return {
6 | entryPoints: ['./src/web-bundle.ts'],
7 | outfile: './dist/signumjs.crypto.min.js',
8 | globalName: 'sig$crypto',
9 | external: ["crypto"],
10 | minify: true,
11 | sourcemap: true,
12 | platform: "browser",
13 | format: 'iife',
14 | bundle: true,
15 | plugins: [
16 | esbuildPluginTsc({
17 | force: true
18 | }),
19 | ],
20 | ...options
21 | };
22 | }
23 |
24 | const settings = createBuildSettings();
25 |
26 | esbuild.build({
27 | ...settings,
28 | }).catch( (reason) => {
29 | console.error("Bundling failed:", reason);
30 | process.exit(1)
31 | });
32 |
--------------------------------------------------------------------------------
/examples/web/connect-xt-wallet/src/notification.js:
--------------------------------------------------------------------------------
1 |
2 | function getMessage() {
3 | return document.getElementById('message-field').value.trim();
4 | }
5 |
6 | function hideMessage() {
7 | document.getElementById('success-message').setAttribute('hidden', '');
8 | }
9 |
10 | function hideError() {
11 | document.getElementById('error-message').setAttribute('hidden', '');
12 | }
13 |
14 | function showError(message) {
15 | const errorMessage = document.getElementById('error-message')
16 | errorMessage.textContent = message;
17 | errorMessage.removeAttribute('hidden');
18 | setTimeout(hideError, 5000)
19 | }
20 |
21 | function showSuccess(message) {
22 | const successMessage = document.getElementById('success-message')
23 | successMessage.textContent = message;
24 | successMessage.removeAttribute('hidden');
25 | setTimeout(hideMessage, 5000)
26 | }
27 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/transaction/broadcastTransaction.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | * Modified work Copyright (c) 2022 Signum Network
5 | */
6 | import {ChainService} from '../../../service/chainService';
7 | import {TransactionId} from '../../../typings/transactionId';
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link TransactionApi}.
11 | *
12 | * See details at {@link TransactionApi.broadcastTransaction}
13 | *
14 | * @category factories
15 | */
16 | export const broadcastTransaction = (service: ChainService):
17 | (signedTransactionPayload: string) => Promise =>
18 | (signedTransactionPayload: string): Promise =>
19 | service.send('broadcastTransaction', {transactionBytes: signedTransactionPayload});
20 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAliasesArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The argument object for {@link AliasApi.getAliases}
3 | *
4 | * @category args
5 | */
6 | export interface GetAliasesArgs {
7 | /**
8 | * The accountId id
9 | */
10 | accountId?: string;
11 |
12 | /**
13 | * The alias name
14 | */
15 | aliasName?: string;
16 |
17 | /**
18 | * The timestamp (block time) you are looking for
19 | */
20 | timestamp?: number;
21 |
22 | /**
23 | * The first index of the list, beginning at 0
24 | */
25 | firstIndex?: number;
26 | /**
27 | * The last index of the list. At maximum 500 will be returned
28 | */
29 | lastIndex?: number;
30 |
31 | /**
32 | * The Top Level Domain. If it is given without further parameters all aliases of this tld are being returned.
33 | */
34 | tld?: string;
35 | }
36 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/sellAliasArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 |
4 | /**
5 | * The argument object for {@link AliasApi.sellAlias}
6 | *
7 | * @param aliasId The alias Id
8 | * @param aliasName The alias name as an alternative for alias Id
9 | * @param amountPlanck The sale amount in Planck
10 | * @param recipientId The optional recipient Id. If given, then only that recipient can buy the alias.
11 | * @param recipientPublicKey The optional recipient public key.
12 | * @param tld The name of the Top Level Domain (TLD) aka namespace where this alias belongs to
13 | *
14 | * @category args
15 | */
16 | export interface SellAliasArgs extends DefaultSendArgs {
17 | aliasId?: string;
18 | aliasName?: string;
19 | amountPlanck: string;
20 | recipientId?: string;
21 | recipientPublicKey?: string;
22 | tld?: string;
23 | }
24 |
--------------------------------------------------------------------------------
/examples/web/send-message/css/custom.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
3 | }
4 |
5 | #message-field {
6 | resize: none;
7 | }
8 |
9 | .inline-container {
10 | display: flex;
11 | flex-direction: row;
12 | width: 100%;
13 | }
14 |
15 | .inline-container #send-button{
16 | width: 120px;
17 | margin-left: 1rem;
18 | }
19 |
20 | .c-alert {
21 | background-color: #96a8b2;
22 | color: #fff;
23 | position: relative;
24 | margin: 0 0 1em;
25 | padding: 1em 3em 1em 1em;
26 | border-radius: 4px;
27 | }
28 |
29 | .c-alerts {
30 | width: fit-content;
31 | }
32 | .c-alert--error {
33 | background-color: #f44336;
34 | color: #fff;
35 | }
36 | .c-alert--success {
37 | background-color: #4caf50;
38 | color: #fff;
39 | }
40 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/placeOrderArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 |
4 | /**
5 | * The argument object for {@link AssetApi.placeAskOrder} and {@link AssetApi.placeBidOrder}
6 | *
7 | *
8 | * @category args
9 | */
10 | export interface PlaceOrderArgs extends DefaultSendArgs {
11 | /**
12 | * The assets id
13 | */
14 | assetId: string;
15 | /**
16 | * The price that is offered for bid/ask
17 | */
18 | pricePlanck: string;
19 | /**
20 | * The amount of assets to ask/bid for
21 | */
22 | quantity: string | number;
23 |
24 | /**
25 | * The decimals of the targeted token, as it's required to calculate the correct price for the order.
26 | * If it is not passed, the decimals will be fetched from the chain (which includes an additional request)
27 | */
28 | decimals?: number;
29 | }
30 |
--------------------------------------------------------------------------------
/packages/core/src/address/__tests__/ensureReedSolomonAddress.spec.ts:
--------------------------------------------------------------------------------
1 | import {describe, it, expect} from 'vitest';
2 | import {ensureReedSolomonAddress} from '../ensureReedSolomonAddress';
3 |
4 | describe('ensureReedSolomonAddress', () => {
5 |
6 | it('should accept correct addresses', () => {
7 | expect(() => ensureReedSolomonAddress('PREFIX_A-K37B-9V85-FB95-793HN')).not.toThrow();
8 | expect(() => ensureReedSolomonAddress('PREFIX_B-K37B-9V85-FB95-793HN')).not.toThrow();
9 | });
10 |
11 | it('should throw on invalid addresses', () => {
12 | expect(() => ensureReedSolomonAddress(null)).toThrow();
13 | expect(() => ensureReedSolomonAddress('')).toThrow();
14 | expect(() => ensureReedSolomonAddress('K37B-9V85-FB95-793HP')).toThrow();
15 | expect(() => ensureReedSolomonAddress('PREFIX-K37B-9V85-FB95-793HP')).toThrow();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/packages/core/src/address/ensureReedSolomonAddress.ts:
--------------------------------------------------------------------------------
1 | // tslint:disable:no-bitwise
2 | /**
3 | * Original work Copyright (c) 2018 PoC-Consortium
4 | * Modified work Copyright (c) 2019 Burst Apps Team
5 | * Modified work Copyright (c) 2021 Signum Network
6 | */
7 |
8 | import {tokenizeReedSolomonAddress} from './tokenizeReedSolomonAddress';
9 | import {isDeeplyValidAddress} from './internal';
10 |
11 | /**
12 | * @internal
13 | * Ensures a valid Reed Solomon address format, like -XXXX-XXXX-XXXX-XXXXX
14 | * @param {string} address The address string
15 | * @throws if is not a valid address
16 | *
17 | */
18 | export const ensureReedSolomonAddress = (address: string): void => {
19 | const tokens = tokenizeReedSolomonAddress(address);
20 | if (!isDeeplyValidAddress(tokens.rs)) {
21 | throw new Error(`Invalid Reed-Solomon Address: ${address}`);
22 | }
23 | };
24 |
25 |
26 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/contract/getSingleContractMapValue.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {GetSingleContractMapValueArgs} from '../../../typings/args';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link ContractApi}.
9 | *
10 | * See details at {@link ContractApi.getSingleContractMapValue}
11 | *
12 | * @category factories
13 | */
14 | export const getSingleContractMapValue = (service: ChainService):
15 | (args: GetSingleContractMapValueArgs) => Promise<{value: string}> =>
16 | (args: GetSingleContractMapValueArgs): Promise<{value: string}> => {
17 | const params = {
18 | at: args.contractId,
19 | key1: args.key1,
20 | key2: args.key2
21 | };
22 |
23 | return service.query('getATMapValue', params);
24 | };
25 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/contract/getAllContractIds.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {ContractIdList} from '../../../typings/contractIdList';
6 | import {GetAllContractIdsArgs} from '../../../typings/args/getAllContractIdsArgs';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link ContractApi}.
10 | *
11 | * See details at {@link ContractApi.getAllContractIds}
12 | *
13 | * @category factories
14 | */
15 | export const getAllContractIds = (service: ChainService):
16 | (args?: GetAllContractIdsArgs) => Promise =>
17 | (args?: GetAllContractIdsArgs): Promise => {
18 | const params = {
19 | machineCodeHashId: args?.machineCodeHash || undefined
20 | };
21 |
22 | return service.query('getATIds', params);
23 | };
24 |
--------------------------------------------------------------------------------
/packages/util/src/convertByteArrayToHexString.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | /**
7 | * Converts byte array to hexadecimal string
8 | * Inverse operation of {@link convertHexStringToByteArray}
9 | * @param bytes The (unsigned) byte array to be converted
10 | * @param uppercase If _true_, converts hex string with uppercase characters (Default: false)
11 | * @return {string} A hex string representing the byte array input
12 | *
13 | * @category conversion
14 | */
15 | export const convertByteArrayToHexString = (bytes: Uint8Array, uppercase = false): string => {
16 | const hex = [];
17 | for (const byte of bytes) {
18 | hex.push((byte >>> 4).toString(16));
19 | hex.push((byte & 0xF).toString(16));
20 | }
21 | return uppercase ? hex.join('').toUpperCase() : hex.join('');
22 | };
23 |
--------------------------------------------------------------------------------
/packages/wallets/src/typings/args/sendEncryptedMessageArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | * @see {@link Wallet.sendEncryptedMessage}
4 | * @module wallets
5 | */
6 | export interface SendEncryptedMessageArgs {
7 | /**
8 | * The recipients public key. It cannot be the numeric Id, i.e. the receiving account must be activated in the network
9 | */
10 | recipientPublicKey: string;
11 | /**
12 | * The plain message string, i.e. text, stringified json or other human readable string.
13 | */
14 | message?: string;
15 |
16 | /**
17 | * The _binary_ hexadecimal message to be sent.
18 | * You can either send a text or hex message, but not both
19 | */
20 | hexMessage?: string;
21 |
22 | /**
23 | * A custom fee in Signa value. You can use this to override automatic calculation.
24 | */
25 | feeSigna?: string | number;
26 | }
27 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getAssetTradesPerAsset.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service';
5 | import {GetAssetTradesPerAssetArgs} from '../../../typings/args';
6 | import {getAssetTrades} from './getAssetTrades';
7 | import {AssetTradeList} from '../../../typings/assetTradeList';
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link AssetApi}.
11 | *
12 | * See details at {@link AssetApi.getAssetTradesPerAsset}
13 | *
14 | * @category factories
15 | */
16 | export const getAssetTradesPerAsset = (service: ChainService):
17 | (args: GetAssetTradesPerAssetArgs) => Promise =>
18 | (args: GetAssetTradesPerAssetArgs): Promise => getAssetTrades(service)({
19 | assetId: args.assetId,
20 | firstIndex: args.firstIndex,
21 | lastIndex: args.lastIndex
22 | });
23 |
--------------------------------------------------------------------------------
/packages/contracts/src/typings/contract.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | * Copyright (c) 2021,2023 Signum Network
4 | */
5 |
6 | /**
7 | * The contract interface returned from Signum Node API {@link core.ContractApi.getContract}
8 | *
9 | */
10 | export interface Contract {
11 | creator: string;
12 | creatorRS: string;
13 | at: string;
14 | atRS: string;
15 | atVersion: number;
16 | name: string;
17 | description: string;
18 | machineCode?: string;
19 | creationMachineData?: string;
20 | machineCodeHashId: string;
21 | machineData: string;
22 | balanceNQT: string;
23 | prevBalanceNQT: string;
24 | nextBlock: number;
25 | frozen: boolean;
26 | running: boolean;
27 | stopped: boolean;
28 | finished: boolean;
29 | dead: boolean;
30 | minActivation: string;
31 | creationBlock: number;
32 | requestProcessingTime: number;
33 | }
34 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAccountBlocksArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The argument object for {@link AccountApi.getAccountBlocks} and {@link AccountApi.getAccountBlockIds}
3 | *
4 | * @param {string} accountId The numeric accountId
5 | * @param {number} firstIndex The first index of a chunk of the list you want fetch. Use indices to paginate your calls
6 | * @param {number} firstIndex The last index of a chunk of the list you want fetch. Use indices to paginate your calls
7 | *
8 | * Currently, the indices do not work on BRS API :(
9 | * @see https://github.com/burst-apps-team/burstcoin/issues/477
10 | *
11 | * @param {boolean?} includeTransactions Includes the transactions also. Note, that this is call may take time
12 | *
13 | * @category args
14 | */
15 | export interface GetAccountBlocksArgs {
16 | accountId: string;
17 | firstIndex?: number;
18 | lastIndex?: number;
19 | includeTransactions?: boolean;
20 | }
21 |
--------------------------------------------------------------------------------
/packages/standards/src/src44/parseIpfsMedia.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 | import { SRC44ParseException } from './exceptions';
5 | import {IpfsMediaType} from './typings';
6 |
7 | /**
8 | *
9 | * Parse IPFS Media Data structure
10 | *
11 | * @internal
12 | * @param o
13 | *
14 | */
15 | export function parseIpfsMedia(o: object): IpfsMediaType {
16 | if (!o) {
17 | return undefined;
18 | }
19 | const keys = Object.keys(o);
20 | if (keys.length === 1) {
21 | const ipfsCid = keys[0];
22 | const mimeType = o[ipfsCid];
23 | if (!mimeType.startsWith('image')) {
24 | throw new SRC44ParseException(`Only image Mime Types allowed. Got [${mimeType}]`);
25 | }
26 | return {
27 | ipfsCid,
28 | mimeType
29 | };
30 | }
31 | throw new SRC44ParseException('Could not parse IPFS Media data');
32 | }
33 |
--------------------------------------------------------------------------------
/packages/util/src/convertPlanckToAssetPrice.ts:
--------------------------------------------------------------------------------
1 | /**
2 | Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {Amount} from './amount';
5 |
6 | /**
7 | * Converts planck into a `priceNQT` used by Node method `placeOrder`.
8 | *
9 | * Usually, you don't need this. {@link core.AssetApi.placeAskOrder} and {@link core.AssetApi.placeBidOrder} convert planck into
10 | * correct value already. This helper is just for those who interact with the Node Http API directly
11 | *
12 | * @see {@link convertAssetPriceToPlanck}
13 | *
14 | * @param planck the amount in planck per token
15 | * @param decimals the number of decimals for targeted asset
16 | * @return the Price in _planck per one token quantity_
17 | *
18 | * @category conversion
19 | */
20 | export function convertPlanckToAssetPrice(planck: string, decimals: number): string {
21 | return Amount.fromSigna(planck).divide(10 ** decimals).getSigna();
22 | }
23 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/transaction/getSubscriptionPayments.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2023 Signum Network
3 | */
4 | import {ChainService} from '../../../service';
5 | import {GetSubscriptionPaymentsArgs, TransactionList} from '../../..';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link TransactionApi}.
9 | *
10 | * See details at {@link TransactionApi.getSubscriptionPayments}
11 | *
12 | * @category factories
13 | */
14 | export const getSubscriptionPayments = (service: ChainService):
15 | (args: GetSubscriptionPaymentsArgs) => Promise =>
16 | (args: GetSubscriptionPaymentsArgs): Promise => {
17 |
18 | const params = {
19 | subscription: args.subscriptionId,
20 | firstIndex: args.firstIndex,
21 | lastIndex: args.lastIndex,
22 | };
23 |
24 | return service.query('getSubscriptionPayments', params);
25 | };
26 |
--------------------------------------------------------------------------------
/packages/util/src/asyncRetry.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2021 Burst Apps Team
3 | */
4 | import {AsyncRetryArgs} from './typings';
5 |
6 | /**
7 | * Utility function to retry async functions.
8 | *
9 | * @param args The argument object*
10 | *
11 | */
12 | export async function asyncRetry(args: AsyncRetryArgs): Promise {
13 | const {asyncFn, onFailureAsync, retryCount = 1, maxRetrials = 20} = args;
14 | try {
15 | return await asyncFn();
16 | // @ts-ignore
17 | } catch (e: any) {
18 | if (retryCount > maxRetrials) {
19 | throw e; // cannot recover
20 | }
21 | const shouldRetry = await onFailureAsync(e, retryCount);
22 | if (shouldRetry) {
23 | await asyncRetry({asyncFn, onFailureAsync, retryCount: retryCount + 1});
24 | } else {
25 | throw e; // rethrow most recent error
26 | }
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getAssetTradesPerAccount.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service';
5 | import {GetAssetTradesPerAccountArgs} from '../../../typings/args';
6 | import {getAssetTrades} from './getAssetTrades';
7 | import {AssetTradeList} from '../../../typings/assetTradeList';
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link AssetApi}.
11 | *
12 | * See details at {@link AssetApi.getAssetTransfersPerAccount}
13 | *
14 | * @category factories
15 | */
16 | export const getAssetTradesPerAccount = (service: ChainService):
17 | (args: GetAssetTradesPerAccountArgs) => Promise =>
18 | (args: GetAssetTradesPerAccountArgs): Promise => getAssetTrades(service)({
19 | accountId: args.accountId,
20 | firstIndex: args.firstIndex,
21 | lastIndex: args.lastIndex
22 | });
23 |
--------------------------------------------------------------------------------
/packages/core/src/typings/assetOrder.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 |
5 | /**
6 | * Asset Order
7 | *
8 | * @category entities
9 | */
10 | export interface AssetOrder {
11 | account: string;
12 | accountRS: string;
13 | /**
14 | * The price in planck per one token quantity. To get the right Planck expression use either price field or this formula: (priceNQT * 10^8) * 10^(decimals-8)
15 | *
16 | * @see {@link util:convertAssetPriceToPlanck}
17 | *
18 | */
19 | priceNQT: string;
20 | /**
21 | * The price per integral token, i.e. if a token has 2 (two) decimals, then this amount is per 100 QNT (Quantity). The amount is always returned in Planck, that is Signa multiplied by 10E8
22 | */
23 | price: string;
24 | order: string;
25 | type: 'ask' | 'bid';
26 | asset: string;
27 | quantityQNT: string;
28 | height: number;
29 | }
30 |
--------------------------------------------------------------------------------
/examples/web/connect-xt-wallet/css/custom.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
3 | }
4 |
5 | #message-field {
6 | resize: none;
7 | }
8 |
9 | .inline-container {
10 | display: flex;
11 | flex-direction: row;
12 | width: 100%;
13 | }
14 |
15 | .inline-container #send-button{
16 | width: 120px;
17 | margin-left: 1rem;
18 | }
19 |
20 | .c-alert {
21 | background-color: #96a8b2;
22 | color: #fff;
23 | position: relative;
24 | margin: 0 0 1em;
25 | padding: 1em 3em 1em 1em;
26 | border-radius: 4px;
27 | }
28 |
29 | .c-alerts {
30 | width: fit-content;
31 | }
32 | .c-alert--error {
33 | background-color: #f44336;
34 | color: #fff;
35 | }
36 | .c-alert--success {
37 | background-color: #4caf50;
38 | color: #fff;
39 | }
40 |
41 | .hidden {
42 | display: none;
43 | }
44 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getOpenAskOrdersPerAsset.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service';
5 | import {GetAssetOpenOrdersPerAssetArgs} from '../../../typings/args';
6 | import {AssetAskOrderList} from '../../../typings/assetAskOrderList';
7 | import {getOpenOrdersPerAsset} from './getOpenOrdersPerAsset';
8 |
9 | /**
10 | *
11 | * Use with {@link ApiComposer} and belongs to {@link AssetApi.getOpenAskOrdersPerAsset}.
12 | *
13 | * See details at {@link AssetApi.getOpenAskOrdersPerAsset}
14 | *
15 | *
16 | * @category factories
17 | */
18 | export const getOpenAskOrdersPerAsset = (service: ChainService):
19 | (args: GetAssetOpenOrdersPerAssetArgs) => Promise =>
20 | (args: GetAssetOpenOrdersPerAssetArgs): Promise =>
21 | getOpenOrdersPerAsset(service)({...args, type: 'ask'}) as Promise;
22 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getOpenBidOrdersPerAsset.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service';
5 | import {GetAssetOpenOrdersPerAssetArgs} from '../../../typings/args';
6 | import {AssetBidOrderList} from '../../../typings/assetBidOrderList';
7 | import {getOpenOrdersPerAsset} from './getOpenOrdersPerAsset';
8 |
9 | /**
10 | *
11 | * Use with {@link ApiComposer} and belongs to {@link AssetApi.getOpenBidOrdersPerAsset}.
12 | *
13 | * See details at {@link AssetApi.getOpenBidOrdersPerAsset}
14 | *
15 | *
16 | * @category factories
17 | */
18 | export const getOpenBidOrdersPerAsset = (service: ChainService):
19 | (args: GetAssetOpenOrdersPerAssetArgs) => Promise =>
20 | (args: GetAssetOpenOrdersPerAssetArgs): Promise =>
21 | getOpenOrdersPerAsset(service)({...args, type: 'bid'}) as Promise;
22 |
--------------------------------------------------------------------------------
/packages/util/src/convertHexStringToByteArray.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | /**
7 | * Converts an hexadecimal string to byte array
8 | * @param hex The hexadecimal string to be converted
9 | * @return {number[]} An byte array representing the hexadecimal input
10 | *
11 | * @category conversion
12 | */
13 | export const convertHexStringToByteArray = (hex: string): Uint8Array => {
14 | if (hex.length % 2) {
15 | throw new Error(`Invalid Hex String: ${hex}`);
16 | }
17 |
18 | const bytes = new Uint8Array(hex.length / 2);
19 | for (let c = 0; c < hex.length; c += 2) {
20 | const byte = parseInt(hex.substr(c, 2), 16);
21 | if (Number.isNaN(byte)) {
22 | throw new Error(`Invalid Hex String: ${hex}`);
23 | }
24 | bytes[c / 2] = byte;
25 | }
26 |
27 | return bytes;
28 | };
29 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/alias/getAliases.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | * Modified work Copyright (c) 2022 Signum Network
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {AliasList} from '../../../typings/aliasList';
7 | import {GetAliasesArgs} from '../../../typings/args/getAliasesArgs';
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link AliasApi}.
11 | *
12 | * See details at {@link AliasApi.getAliases}
13 | *
14 | * @category factories
15 | */
16 | export const getAliases = (service: ChainService):
17 | (args: GetAliasesArgs) => Promise =>
18 | (args: GetAliasesArgs): Promise => service.query('getAliases', {
19 | account: args.accountId,
20 | tld: args.tld,
21 | aliasName: args.aliasName,
22 | timestamp: args.timestamp,
23 | firstIndex: args.firstIndex,
24 | lastIndex: args.lastIndex,
25 | });
26 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/alias/getAliasesOnSale.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {AliasList} from '../../../typings/aliasList';
6 | import {GetAliasesOnSaleArgs} from '../../../typings/args';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link AliasApi}.
10 | *
11 | * See details at {@link AliasApi.getAliasesOnSale}
12 | *
13 | * @category factories
14 | */
15 | export const getAliasesOnSale = (service: ChainService):
16 | (args: GetAliasesOnSaleArgs) => Promise =>
17 | (args: GetAliasesOnSaleArgs): Promise => {
18 |
19 | const params = {
20 | account: args.accountId,
21 | buyer: args.buyerId,
22 | firstIndex: args.firstIndex,
23 | lastIndex: args.lastIndex,
24 | };
25 |
26 | return service.query('getAliasesOnSale', params);
27 | };
28 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getAssetTransfersPerAsset.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service';
5 | import {AssetTransferList} from '../../../typings/assetTransferList';
6 | import {GetAssetTransfersPerAssetArgs} from '../../../typings/args';
7 | import {getAssetTransfers} from './getAssetTransfers';
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link AssetApi}.
11 | *
12 | * See details at {@link AssetApi.getAssetTransfersPerAsset}
13 | *
14 | * @category factories
15 | */
16 | export const getAssetTransfersPerAsset = (service: ChainService):
17 | (args: GetAssetTransfersPerAssetArgs) => Promise =>
18 | (args: GetAssetTransfersPerAssetArgs): Promise => getAssetTransfers(service)({
19 | assetId: args.assetId,
20 | firstIndex: args.firstIndex,
21 | lastIndex: args.lastIndex
22 | });
23 |
--------------------------------------------------------------------------------
/packages/util/src/convertStringToBase64String.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2018 PoC-Consortium
3 | * Modified work Copyright (c) 2019 Burst Apps Team
4 | */
5 |
6 | // FIXME: This implementation has security warnings!
7 | import {Base64} from 'js-base64';
8 |
9 | /**
10 | * Converts/Encodes a String into Base64 (URI) encoded string. UTF-8 is supported.
11 | * Inverse function {@link convertBase64StringToString}
12 | * @param str The string to be converted
13 | * @param isURICompatible Determine whether the resulting string shall be URI compatible, or not. Default is `true`
14 | * @return {string} The Base64 String representing the input string. The string is already URI encoded, i.e. can be used directly in browsers
15 | *
16 | * @category conversion
17 | */
18 | export const convertStringToBase64String = (str: string, isURICompatible = true): string => {
19 | return isURICompatible ? Base64.encodeURI(str) : Base64.encode(str);
20 | };
21 |
--------------------------------------------------------------------------------
/packages/contracts/src/calculateMinimumCreationFee.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original Work Copyright (c) 2019 Burst Apps Team
3 | * Modified Work Copyright (c) 2022 Signum Network
4 | */
5 |
6 | import {Amount, FeeQuantPlanck} from '@signumjs/util';
7 | import {countCodePages} from './countCodePages';
8 | import {countDataPages} from './countDataPages';
9 | import {CalculateMinimumCreationFeeArgs} from './typings';
10 |
11 | /**
12 | * Calculates the minimum creation fee of the contract
13 | *
14 | * @param args The arguments
15 | * @return The minimum fee
16 | *
17 | */
18 | export function calculateMinimumCreationFee(args: CalculateMinimumCreationFeeArgs): Amount {
19 |
20 | const {dataHex, codeHex} = args;
21 |
22 | const codePagesCount = codeHex ? countCodePages(codeHex) : 0;
23 | const dataPagesCount = dataHex?.length ? countDataPages(dataHex) : 1;
24 |
25 | return Amount.fromPlanck(FeeQuantPlanck * 10 * (2 + codePagesCount + dataPagesCount));
26 | }
27 |
--------------------------------------------------------------------------------
/packages/core/src/address/__tests__/convertReedSolomonAddressToNumericId.spec.ts:
--------------------------------------------------------------------------------
1 | import {describe, it, expect} from 'vitest';
2 | import {convertReedSolomonAddressToNumericId} from '../convertReedSolomonAddressToNumericId';
3 |
4 | describe('convertReedSolomonAddressToNumericId', () => {
5 |
6 | it('should convert as expected', () => {
7 | expect(convertReedSolomonAddressToNumericId('PREFIX-K37B-9V85-FB95-793HN')).toBe('6502115112683865257');
8 | expect(convertReedSolomonAddressToNumericId('OTHER-K37B-9V85-FB95-793HN')).toBe('6502115112683865257');
9 | });
10 |
11 | it('should throw as expected', () => {
12 | expect(() => convertReedSolomonAddressToNumericId('6502115112683865257')).toThrow('Invalid Reed-Solomon Address Format: 6502115112683865257');
13 | expect(() => convertReedSolomonAddressToNumericId('')).toThrow();
14 | expect(() => convertReedSolomonAddressToNumericId(null)).toThrow();
15 | });
16 |
17 | });
18 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getOpenAskOrdersPerAccount.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service';
5 | import {GetAssetOpenOrdersPerAccountArgs} from '../../../typings/args';
6 | import {AssetAskOrderList} from '../../../typings/assetAskOrderList';
7 | import {getOpenOrdersPerAccount} from './getOpenOrdersPerAccount';
8 |
9 | /**
10 | *
11 | * Use with {@link ApiComposer} and belongs to {@link AssetApi.getOpenAskOrdersPerAccount}.
12 | *
13 | * See details at {@link AssetApi.getOpenAskOrdersPerAccount}
14 | *
15 | *
16 | * @category factories
17 | */
18 | export const getOpenAskOrdersPerAccount = (service: ChainService):
19 | (args: GetAssetOpenOrdersPerAccountArgs) => Promise =>
20 | (args: GetAssetOpenOrdersPerAccountArgs): Promise =>
21 | getOpenOrdersPerAccount(service)({...args, type: 'ask'}) as Promise;
22 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getOpenBidOrdersPerAccount.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service';
5 | import {GetAssetOpenOrdersPerAccountArgs} from '../../../typings/args';
6 | import {AssetBidOrderList} from '../../../typings/assetBidOrderList';
7 | import {getOpenOrdersPerAccount} from './getOpenOrdersPerAccount';
8 |
9 | /**
10 | *
11 | * Use with {@link ApiComposer} and belongs to {@link AssetApi.getOpenBidOrdersPerAccount}.
12 | *
13 | * See details at {@link AssetApi.getOpenBidOrdersPerAccount}
14 | *
15 | *
16 | * @category factories
17 | */
18 | export const getOpenBidOrdersPerAccount = (service: ChainService):
19 | (args: GetAssetOpenOrdersPerAccountArgs) => Promise =>
20 | (args: GetAssetOpenOrdersPerAccountArgs): Promise =>
21 | getOpenOrdersPerAccount(service)({...args, type: 'bid'}) as Promise;
22 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/transferAssetArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 |
4 | /**
5 | * The argument object for {@link AssetApi.transferAsset}
6 | *
7 | *
8 | * @category args
9 | */
10 | export interface TransferAssetArgs extends DefaultSendArgs {
11 | /**
12 | * The assets id to be transferred
13 | */
14 | assetId: string;
15 | /**
16 | * The amount of assets to be transferred (take the decimals into consideration)
17 | * If you set decimals to 4 and want to have 100 full assets, you need to set this value to 1000000
18 | */
19 | quantity: string | number;
20 | /**
21 | * The id of the recipient
22 | */
23 | recipientId: string;
24 | /**
25 | * The _optional_ recipients public key in hex format.
26 | */
27 | recipientPublicKey?: string;
28 |
29 | /**
30 | * The amount to be sent as Planck value
31 | */
32 | amountPlanck?: string;
33 | }
34 |
--------------------------------------------------------------------------------
/examples/nodejs/basic/calculateSignaPlanck.js:
--------------------------------------------------------------------------------
1 | const {Amount} = require("@signumjs/util");
2 |
3 | (()=> {
4 | console.log('One Signa is', Amount.fromSigna(1.0).getPlanck(), 'Planck')
5 | console.log('One Planck is', Amount.fromPlanck(1).getSigna(), 'SIGNA')
6 |
7 | console.log('10 SIGNA + 245,000 Planck =', Amount.fromSigna(10).add(Amount.fromPlanck(245000)).getSigna(), 'SIGNA')
8 | console.log('10 SIGNA + 245,000 Planck =', Amount.fromSigna(10).add(Amount.fromPlanck(245000)).getPlanck(), 'Planck')
9 |
10 | console.log('50,000 Planck * 16 =', Amount.fromPlanck(50_000).multiply(16).getSigna(), 'SIGNA')
11 | console.log('2 SIGNA < 40,000 Planck is ', Amount.fromSigna(2).less(Amount.fromPlanck(40_000)))
12 |
13 | // Mind that multiply, add, subtract and divide mutates the value object.
14 | const mutatedValue = Amount.fromSigna(1)
15 | mutatedValue.add(Amount.fromSigna(2.65))
16 | console.log('Value is', mutatedValue.getSigna())
17 | })()
18 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/asset/getAssetTransfersPerAccount.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service';
5 | import {AssetTransferList} from '../../../typings/assetTransferList';
6 | import {GetAssetTransfersPerAccountArgs} from '../../../typings/args';
7 | import {getAssetTransfers} from './getAssetTransfers';
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link AssetApi}.
11 | *
12 | * See details at {@link AssetApi.getAssetTransfersPerAccount}
13 | *
14 | * @category factories
15 | */
16 | export const getAssetTransfersPerAccount = (service: ChainService):
17 | (args: GetAssetTransfersPerAccountArgs) => Promise =>
18 | (args: GetAssetTransfersPerAccountArgs): Promise => getAssetTransfers(service)({
19 | accountId: args.accountId,
20 | firstIndex: args.firstIndex,
21 | lastIndex: args.lastIndex
22 | });
23 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/account/getSubscriptionsToAccount.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2020 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {TransactionList} from '../../../typings/transactionList';
6 | import {GetAccountTransactionsArgs} from '../../../typings/args';
7 | import {SubscriptionList} from '../../../typings/subscriptionList';
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link AccountApi}.
11 | *
12 | * See details at {@link AccountApi.getSubscriptionsToAccount}
13 | *
14 | * @category factories
15 | */
16 | export const getSubscriptionsToAccount = (service: ChainService):
17 | (accountId: string) => Promise =>
18 | (accountId: string): Promise => {
19 |
20 | const parameters = {
21 | account: accountId,
22 | };
23 |
24 | return service.query('getSubscriptionsToAccount', parameters);
25 | };
26 |
--------------------------------------------------------------------------------
/packages/util/src/internal/padStartPolyfill.ts:
--------------------------------------------------------------------------------
1 | /** @ignore */
2 | /** @internal */
3 | /** */
4 |
5 | // https://github.com/uxitten/polyfill/blob/master/string.polyfill.js
6 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
7 |
8 | // @ts-ignore
9 | if (!String.prototype.padStart) {
10 | // @ts-ignore
11 | String.prototype.padStart = function padStart(targetLength, padString) {
12 | targetLength = targetLength >> 0;
13 | padString = String(padString !== undefined ? padString : ' ');
14 | if (this.length >= targetLength) {
15 | return String(this);
16 | } else {
17 | targetLength = targetLength - this.length;
18 | if (targetLength > padString.length) {
19 | padString += padString.repeat(targetLength / padString.length);
20 | }
21 | return padString.slice(0, targetLength) + String(this);
22 | }
23 | };
24 | }
25 |
--------------------------------------------------------------------------------
/examples/nodejs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nodejs",
3 | "version": "1.0.0",
4 | "description": "SignumJS examples for NodeJS",
5 | "private": true,
6 | "repository": {
7 | "type": "git",
8 | "url": "git+https://github.com/signum-network/signumjs.git"
9 | },
10 | "keywords": [
11 | "signumjs",
12 | "sdk",
13 | "signum",
14 | "blockchain",
15 | "web3"
16 | ],
17 | "author": "ohager",
18 | "license": "MIT",
19 | "bugs": {
20 | "url": "https://github.com/signum-network/signumjs/issues"
21 | },
22 | "homepage": "https://github.com/signum-network/signumjs#readme",
23 | "dependencies": {
24 | "@signumjs/contracts": "^1.0.0-rc.30",
25 | "@signumjs/core": "^1.0.0-rc.30",
26 | "@signumjs/crypto": "^1.0.0-rc.30",
27 | "@signumjs/http": "^1.0.0-rc.30",
28 | "@signumjs/monitor": "^1.0.0-rc.30",
29 | "@signumjs/wallets": "^1.0.0-rc.30",
30 | "@signumjs/util": "^1.0.0-rc.30",
31 | "inquirer": "^8.2.0"
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/account/index.ts:
--------------------------------------------------------------------------------
1 | export * from './addCommitment';
2 | export * from './generateSendTransactionQRCode';
3 | export * from './generateSendTransactionQRCodeAddress';
4 | export * from './getAccount';
5 | export * from './getAccountBalance';
6 | export * from './getAccountBlockIds';
7 | export * from './getAccountBlocks';
8 | export * from './getAccountSubscriptions';
9 | export * from './getAccountTransactions';
10 | export * from './getAccountTransactionsFromSender';
11 | export * from './getAccountTransactionsToRecipient';
12 | export * from './getAccountTransactionsFromSenderToRecipient';
13 | export * from './getAccountTransactionsBetweenSenderAndRecipient';
14 | export * from './getRewardRecipient';
15 | export * from './getSubscriptionsToAccount';
16 | export * from './getUnconfirmedAccountTransactions';
17 | export * from './removeCommitment';
18 | export * from './setAccountInfo';
19 | export * from './setAlias';
20 | export * from './setRewardRecipient';
21 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/contract/getContractMapValuesByFirstKey.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {GetContractMapValuesByFirstKeyArgs } from '../../../typings/args';
6 | import {ContractMapValueList} from '../../../typings/contractMapValueList';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link ContractApi}.
10 | *
11 | * See details at {@link ContractApi.getContractMapValuesByFirstKey}
12 | *
13 | * @category factories
14 | */
15 | export const getContractMapValuesByFirstKey = (service: ChainService):
16 | (args: GetContractMapValuesByFirstKeyArgs) => Promise =>
17 | (args: GetContractMapValuesByFirstKeyArgs): Promise => {
18 | const params = {
19 | at: args.contractId,
20 | key1: args.key1,
21 | };
22 |
23 | return service.query('getATMapValues', params);
24 | };
25 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/contract/getContractsByAccount.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | * Modified (c) 2021 Signum Network
4 | */
5 | import {ChainService} from '../../../service/chainService';
6 | import {ContractList} from '../../../typings/contractList';
7 | import {GetContractsByAccountArgs} from '../../../typings/args/getContractsByAccountArgs';
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link ContractApi}.
11 | *
12 | * See details at {@link ContractApi.getContractsByAccount}
13 | *
14 | * @category factories
15 | */
16 | export const getContractsByAccount = (service: ChainService):
17 | (args: GetContractsByAccountArgs) => Promise =>
18 | (args: GetContractsByAccountArgs): Promise => {
19 | const params = {
20 | account: args.accountId,
21 | machineCodeHashId: args.machineCodeHash
22 | };
23 | return service.query('getAccountATs', params);
24 | };
25 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/account/getAccountBlocks.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {BlockList} from '../../../typings/blockList';
6 | import {GetAccountBlocksArgs} from '../../../typings/args/getAccountBlocksArgs';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link AccountApi}.
10 | *
11 | * See details at {@link AccountApi.getAccountBlocks}
12 | *
13 | * @category factories
14 | */
15 | export const getAccountBlocks = (service: ChainService):
16 | (args: GetAccountBlocksArgs) => Promise =>
17 | (args): Promise => {
18 |
19 | const params = {
20 | account: args.accountId,
21 | firstIndex: args.firstIndex,
22 | lastIndex: args.lastIndex,
23 | includeTransactions: args.includeTransactions || false
24 | };
25 |
26 | return service.query('getAccountBlocks', params);
27 | };
28 |
--------------------------------------------------------------------------------
/packages/standards/src/src44/typings/args/setAssetBrandingArgs.ts:
--------------------------------------------------------------------------------
1 | import {DescriptorData} from '../../DescriptorData';
2 |
3 | /**
4 | * Arguments for {@link DescriptorDataClient.setAssetBranding}
5 | *
6 | */
7 | export interface SetAssetBrandingArgs {
8 | /**
9 | * Optional name for the used brand alias. If not given an auto-generated name will be used.
10 | */
11 | aliasName?: string;
12 |
13 | /**
14 | * Optional Top Level Domain
15 | */
16 | tld?: string;
17 | /**
18 | * The related assetId
19 | */
20 | assetId: string;
21 | /**
22 | * Additional Descriptor Data. Mind, that id will be set to assetId.
23 | */
24 | descriptorData: DescriptorData;
25 | /**
26 | * If not given the minimum transaction fee is being calculated
27 | */
28 | feePlanck?: string;
29 | senderPublicKey: string;
30 | senderPrivateKey?: string;
31 | deadline?: number;
32 | referencedTransactionFullHash?: string;
33 | }
34 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAccountArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The argument object for {@link AccountApi.getAccount}
3 | *
4 | * @param {string} accountId The numeric accountId
5 | * @param {number?} commitmentAtHeight The height for the commitment, if one wants to see the commitment in the past
6 | * For BRS Versions before 3.0 this must be `undefined`
7 | * @param {boolean?} includeCommittedAmount Includes the committed amount in the response
8 | * For BRS Versions before 3.0 this must be `undefined`
9 | * @param {boolean?} includeEstimatedCommitment Includes the estimated commitment in BURST/Terabyte. This is a relatively costly operation,
10 | * and should be set true only if you really need that info.
11 | * For BRS Versions before 3.0 this must be `undefined`*
12 | *
13 | * @category args
14 | */
15 | export interface GetAccountArgs {
16 | accountId: string;
17 | commitmentAtHeight?: number;
18 | includeCommittedAmount?: boolean;
19 | includeEstimatedCommitment?: boolean;
20 | }
21 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/account/getAccount.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2019 Burst Apps Team
3 | */
4 |
5 | import {ChainService} from '../../../service/chainService';
6 | import {Account} from '../../../typings/account';
7 | import {GetAccountArgs} from '../../../typings/args/getAccountArgs';
8 |
9 | /**
10 | * Use with {@link ApiComposer} and belongs to {@link AccountApi}.
11 | *
12 | * See details at {@link AccountApi.getAccount}
13 | *
14 | * @category factories
15 | */
16 | export const getAccount = (service: ChainService):
17 | (args: GetAccountArgs) => Promise =>
18 | (args: GetAccountArgs): Promise => {
19 |
20 | const params = {
21 | account: args.accountId,
22 | height : args.commitmentAtHeight,
23 | getCommittedAmount : args.includeCommittedAmount,
24 | estimateCommitment : args.includeEstimatedCommitment
25 | };
26 |
27 | return service.query('getAccount', params);
28 | };
29 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/account/getUnconfirmedAccountTransactions.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Original work Copyright (c) 2020 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {UnconfirmedTransactionList} from '../../../typings/unconfirmedTransactionList';
6 |
7 | /**
8 | * Use with {@link ApiComposer} and belongs to {@link AccountApi}.
9 | *
10 | * See details at {@link AccountApi.getUnconfirmedAccountTransactions}
11 | *
12 | * @category factories
13 | */
14 | export const getUnconfirmedAccountTransactions = (service: ChainService):
15 | (
16 | accountId: string,
17 | includeIndirect?: boolean
18 | ) => Promise =>
19 | (
20 | accountId: string,
21 | includeIndirect ?: boolean
22 | ): Promise =>
23 | service.query('getUnconfirmedTransactions', {
24 | account: accountId,
25 | includeIndirect
26 | }
27 | );
28 |
--------------------------------------------------------------------------------
/packages/contracts/src/convertShortStringToContractData.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Signum Network
3 | */
4 |
5 | import {ContractData} from './typings';
6 | import {convertHexEndianess, convertHexStringToDecString, convertStringToHexString} from '@signumjs/util';
7 |
8 | /**
9 | * Converts a short string into {@link ContractData} to be used as argument for smart contract calls, i.e. {@link generateMethodCall}
10 | *
11 | * @param {string} shortString A short alphanumerical string of at maximum 8 characters (bytes) length.
12 | * @return A compatible numerical representation which can be used as string in a smart contract.
13 | *
14 | */
15 | export function convertShortStringToContractData(shortString: string): ContractData {
16 | const MaxChars = 8;
17 | if (shortString.length > MaxChars) {
18 | throw new Error(`At maximum ${MaxChars} bytes/characters are supported`);
19 | }
20 | return convertHexStringToDecString(convertHexEndianess(convertStringToHexString(shortString)));
21 | }
22 |
--------------------------------------------------------------------------------
/packages/standards/src/src44/typings/args/setContractBrandingArgs.ts:
--------------------------------------------------------------------------------
1 | import {DescriptorData} from '../../DescriptorData';
2 |
3 | /**
4 | * Arguments for {@link DescriptorDataClient.setContractBranding}
5 | *
6 | */
7 | export interface SetContractBrandingArgs {
8 | /**
9 | * Optional name for the used brand alias. If not given an auto-generated name will be used.
10 | */
11 | aliasName?: string;
12 |
13 | /**
14 | * Optional Top Level Domain
15 | */
16 | tld?: string;
17 | /**
18 | * The related contractId
19 | */
20 | contractId: string;
21 | /**
22 | * Additional Descriptor Data. Mind, that id will be set to contractId.
23 | */
24 | descriptorData: DescriptorData;
25 | /**
26 | * If not given the minimum transaction fee is being calculated
27 | */
28 | feePlanck?: string;
29 | senderPublicKey: string;
30 | senderPrivateKey?: string;
31 | deadline?: number;
32 | referencedTransactionFullHash?: string;
33 | }
34 |
--------------------------------------------------------------------------------
/packages/core/src/api/factories/account/getAccountBlockIds.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Burst Apps Team
3 | */
4 | import {ChainService} from '../../../service/chainService';
5 | import {BlockIdList} from '../../../typings/blockIdList';
6 | import {GetAccountBlocksArgs} from '../../../typings/args/getAccountBlocksArgs';
7 |
8 | /**
9 | * Use with {@link ApiComposer} and belongs to {@link AccountApi}.
10 | *
11 | * See details at {@link AccountApi.getAccountBlockIds}
12 | *
13 | * @category factories
14 | */
15 | export const getAccountBlockIds = (service: ChainService):
16 | (args: GetAccountBlocksArgs) => Promise =>
17 | (args): Promise => {
18 |
19 | const params = {
20 | account: args.accountId,
21 | firstIndex: args.firstIndex,
22 | lastIndex: args.lastIndex,
23 | includeTransactions: args.includeTransactions || false
24 | };
25 |
26 | return service.query('getAccountBlockIds', params);
27 | };
28 |
29 |
30 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/distributeToAssetHoldersArgs.ts:
--------------------------------------------------------------------------------
1 | import {DefaultSendArgs} from './defaultSendArgs';
2 |
3 |
4 | /**
5 | * The argument object for {@link AssetApi.distributeToAssetHolders}
6 | *
7 | *
8 | * @category args
9 | */
10 | export interface DistributeToAssetHoldersArgs extends DefaultSendArgs {
11 | /**
12 | * The related asset
13 | */
14 | assetId: string;
15 | /**
16 | * Distributes only to those who have a minimum amount of that token/asset
17 | */
18 | minimumHoldQuantity?: string;
19 | /**
20 | * Total Amount of Signa to be distributed, expressed in Planck
21 | */
22 | totalAmountPlanck: string;
23 |
24 | /**
25 | * You may distribute an additional asset, i.e. as air drop, together with this pay out.
26 | */
27 | additionalAssetId?: string;
28 | /**
29 | * If given `additionalAssetId`, then you need to specify a quantity that's being distributed together.
30 | */
31 | additionalAssetQuantity?: string;
32 | }
33 |
--------------------------------------------------------------------------------
/packages/core/src/typings/args/getAllAssetsArgs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The argument object for {@link AssetApi.getAllAssets}
3 | *
4 | *
5 | * @category args
6 | */
7 | export interface GetAllAssetsArgs {
8 | /**
9 | * The first index to be returned. Use this for pagination. Starts at 0
10 | */
11 | firstIndex?: number;
12 | /**
13 | * The last index to be returned. Use this for pagination. If not set, at maximum 500 items beginning at firstIndex will be returned
14 | */
15 | lastIndex?: number;
16 | /**
17 | * Define the start height for trading information over a given period - if not given the last 360 blocks (around 24hrs) are taken as trading period
18 | */
19 | heightStart?: number;
20 | /**
21 | * Define the end height for trading information over a given period - if not given the current block is taken as end height
22 | */
23 | heightEnd?: number;
24 | /**
25 | * If set true all zero volumes are excluded
26 | */
27 | skipZeroVolume?: boolean;
28 | }
29 |
--------------------------------------------------------------------------------