Compare commits

..

2 Commits

Author SHA1 Message Date
T-Hax
96b941a315
gitea: save migration for community repo
Signed-off-by: T-Hax <>
2023-05-19 20:21:50 +00:00
T-Hax
92bb8d082a
gitea: add migration script
Signed-off-by: T-Hax <>
2023-05-19 20:20:19 +00:00
16 changed files with 14948 additions and 15107 deletions

View File

@ -17,10 +17,10 @@
"circom",
"zksnark"
],
"homepage": "https://git.tornado.ws/tornado-packages/circomlib",
"homepage": "https://development.tornadocash.community/T-Hax/circomlib",
"repository": {
"type": "git",
"url": "https://git.tornado.ws/tornado-packages/archive-monorepo"
"url": "https://development.tornadocash.community/T-Hax/archive-monorepo"
},
"author": "0Kims",
"license": "GPL-3.0",

View File

@ -2,10 +2,10 @@
"name": "@tornado/fixed-merkle-tree",
"version": "0.7.3-p0",
"description": "Fixed depth merkle tree implementation with sequential inserts",
"homepage": "https://git.tornado.ws/tornado-packages/archive-monorepo/src/branch/main/@tornado/fixed-merkle-tree",
"homepage": "https://development.tornadocash.community/T-Hax/archive-monorepo/src/branch/main/@tornado/fixed-merkle-tree",
"repository": {
"type": "git",
"url": "https://git.tornado.ws/tornado-packages/archive-monorepo"
"url": "https://development.tornadocash.community/T-Hax/archive-monorepo"
},
"main": "lib/index.js",
"types": "lib/index.d.ts",

View File

@ -8,11 +8,12 @@ This is a library with a collection of onchain and offchain gas price oracle URL
Current offchain list:
- https://ethgasstation.info/json/ethgasAPI.json
- https://etherchain.org/api/gasnow
Current onchain list:
- [Chainlink aggregator](https://etherscan.io/address/0x169e633a2d1e6c10dd91238ba11c4a708dfef37c#readContract)
- [chainlink](https://etherscan.io/address/0x169e633a2d1e6c10dd91238ba11c4a708dfef37c#readContract)
### Binance Smart Chain
@ -24,14 +25,13 @@ Current offchain list:
Current offchain list:
- https://gnosis.blockscout.com/api/v1/gas-price-oracle
- https://blockscout.com/xdai/mainnet/api/v1/gas-price-oracle
### Polygon (Matic) Network
Current offchain list:
- https://gasstation.polygon.technology/v2
- https://matic-gas-station.tornado.ws
- https://gasstation-mainnet.matic.network/
### Avalanche C Network
@ -252,9 +252,7 @@ type GetTxGasParamsRes =
}
const gasParams: GetTxGasParamsRes = await oracle.getTxGasParams({ legacySpeed: 'fast', bumpPercent: 30 })
console.log(gasParams)
// { maxFeePerGas: '3f5476a00', maxPriorityFeePerGas: 'b2d05e00' } || { gasPrice: '46c7cfe00' }
// equal to: { maxFeePerGas: 17 gwei, maxPriorityFeePerGas: 3 gwei } || { gasPrice: 19 gwei }
console.log(gasParams) // { maxFeePerGas: 17, maxPriorityFeePerGas: 3 } || { gasPrice: 19 }
web3.eth.sendTransaction({
from: '0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8',
@ -269,8 +267,6 @@ web3.eth.sendTransaction({
`bumpPercent` argument (`0` by default) - response data will increase by `bumpPercent`%.
`legacySpeed` argument (`fast` by default) - select the speed of legacy gasPrice.
Returns gas info in `wei`, hex-format.
### Offchain oracles only
```typescript

View File

@ -1,14 +1,14 @@
{
"name": "@tornado/gas-price-oracle",
"version": "0.5.3",
"version": "0.5.2-p1",
"description": "Gas Price Oracle library for Ethereum dApps.",
"homepage": "https://git.tornado.ws/tornado-packages/gas-price-oracle",
"homepage": "https://development.tornadocash.community/T-Hax/gas-price-oracle",
"main": "./lib/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/index.d.ts",
"repository": {
"type": "git",
"url": "https://git.tornado.ws/tornado-packages/gas-price-oracle"
"url": "https://development.tornadocash.community/T-Hax/archive-monorepo"
},
"scripts": {
"test": "ts-mocha --timeout 30000 --paths 'src/tests/*.test.ts'",

View File

@ -1,5 +1,16 @@
import { OffChainOracle, OffChainOracles, OnChainOracle, OnChainOracles } from '@/services'
const ethgasstation: OffChainOracle = {
name: 'ethgasstation',
url: 'https://ethgasstation.info/json/ethgasAPI.json',
instantPropertyName: 'fastest',
fastPropertyName: 'fast',
standardPropertyName: 'average',
lowPropertyName: 'safeLow',
denominator: 10,
additionalDataProperty: null,
}
const etherchain: OffChainOracle = {
name: 'etherchain',
url: 'https://etherchain.org/api/gasnow',
@ -19,6 +30,7 @@ const chainlink: OnChainOracle = {
}
export const offChainOracles: OffChainOracles = {
ethgasstation,
etherchain,
}

View File

@ -2,21 +2,10 @@ import { OffChainOracle, OffChainOracles, OnChainOracles } from '@/services'
const maticGasStation: OffChainOracle = {
name: 'maticGasStation',
url: 'https://gasstation.polygon.technology/v2',
instantPropertyName: 'fast.maxFee',
fastPropertyName: 'fast.maxFee',
standardPropertyName: 'standard.maxFee',
lowPropertyName: 'safeLow.maxFee',
denominator: 1,
additionalDataProperty: null,
}
const tornadoMaticGasStation: OffChainOracle = {
name: 'tornadoMGasStation',
url: 'https://matic-gas-station.tornado.ws',
instantPropertyName: 'standard',
fastPropertyName: 'standard',
standardPropertyName: 'safeLow',
url: 'https://gasstation-mainnet.matic.network',
instantPropertyName: 'fastest',
fastPropertyName: 'fast',
standardPropertyName: 'standard',
lowPropertyName: 'safeLow',
denominator: 1,
additionalDataProperty: null,
@ -24,7 +13,6 @@ const tornadoMaticGasStation: OffChainOracle = {
export const offChainOracles: OffChainOracles = {
maticGasStation,
tornadoMaticGasStation,
}
export const onChainOracles: OnChainOracles = {}

View File

@ -2,7 +2,7 @@ import { OffChainOracle, OffChainOracles, OnChainOracles } from '@/services'
const blockscout: OffChainOracle = {
name: 'blockscout',
url: 'https://gnosis.blockscout.com/api/v1/gas-price-oracle',
url: 'https://blockscout.com/xdai/mainnet/api/v1/gas-price-oracle',
instantPropertyName: 'fast',
fastPropertyName: 'average',
standardPropertyName: 'slow',

View File

@ -16,7 +16,6 @@ import {
import { ChainId, NETWORKS } from '@/config'
import { RpcFetcher, NodeJSCache } from '@/services'
import { resolvePropertyPath } from '@/utils'
import { GWEI, DEFAULT_TIMEOUT, GWEI_PRECISION, DEFAULT_BLOCK_DURATION } from '@/constants'
import { MULTIPLIERS, DEFAULT_GAS_PRICE } from './constants'
@ -298,17 +297,17 @@ export class LegacyGasPriceOracle implements LegacyOracle {
const response = await axios.get(url, { timeout: this.configuration.timeout })
if (response.status === 200) {
const gas = resolvePropertyPath(response.data, additionalDataProperty)
const gas = additionalDataProperty ? response.data[additionalDataProperty] : response.data
if (Number(resolvePropertyPath(gas, fastPropertyName)) === 0) {
if (Number(gas[fastPropertyName]) === 0) {
throw new Error(`${name} oracle provides corrupted values`)
}
const gasPrices: GasPrice = {
instant: parseFloat(resolvePropertyPath(gas, instantPropertyName)) / denominator,
fast: parseFloat(resolvePropertyPath(gas, fastPropertyName)) / denominator,
standard: parseFloat(resolvePropertyPath(gas, standardPropertyName)) / denominator,
low: parseFloat(resolvePropertyPath(gas, lowPropertyName)) / denominator,
instant: parseFloat(gas[instantPropertyName]) / denominator,
fast: parseFloat(gas[fastPropertyName]) / denominator,
standard: parseFloat(gas[standardPropertyName]) / denominator,
low: parseFloat(gas[lowPropertyName]) / denominator,
}
return LegacyGasPriceOracle.normalize(gasPrices)
} else {

View File

@ -5,43 +5,4 @@ const sleep = (time: number): Promise<boolean> => {
return new Promise((res) => setTimeout(() => res(true), time))
}
/**
* Returns the recursively resolved value of the object's subproperty given the properties path, separated by dots.
* If properties path is null, undefined or an empty string - returns the object itself
* @param obj - The object, from which get property or subproperty
* @param propertiesInString - Property name or properties chained string, like 'user.email.domain'
* @returns The value of the subproperty by path or object itself
*
* @example
*
* ### Object
* ```ts
* const x = {
* y: {
* z: 11
* }
* };
* ```
*
* ### Property path in object
* ```ts
* const propertyPath = 'y.z';
* ```
*
* ### Usage
* ```ts
* const subpropertyValue = resolvePropertyPath(x, propertyPath);
* ```
*
* ### Result (subproperty value)
* ```ts
* 11
* ```
*/
const resolvePropertyPath = (obj: object, propertyPath: string | undefined | null): any => {
const properties = propertyPath?.split('.') || []
return properties.reduce((curr: { [key: string]: any }, nextProperty: string) => curr[nextProperty], obj)
}
export { sleep, resolvePropertyPath }
export { sleep }

View File

@ -23,10 +23,10 @@
],
"author": "Jordi Baylina",
"license": "GPL-3.0",
"homepage": "https://git.tornado.ws/tornado-packages/snarkjs",
"homepage": "https://development.tornadocash.community/T-Hax/snarkjs",
"repository": {
"type": "git",
"url": "https://git.tornado.ws/tornado-packages/archive-monorepo"
"url": "https://development.tornadocash.community/T-Hax/archive-monorepo"
},
"dependencies": {
"big-integer": "^1.6.43",

View File

@ -2,10 +2,10 @@
"name": "@tornado/web3-providers-http",
"version": "1.6.5-p1",
"description": "Module to handle web3 RPC connections over HTTP.",
"homepage": "https://git.tornado.ws/tornado-packages/archive-monorepo/src/branch/main/@tornado/web3-providers-http",
"homepage": "https://development.tornadocash.community/T-Hax/archive-monorepo/src/branch/main/@tornado/web3-providers-http",
"repository": {
"type": "git",
"url": "https://git.tornado.ws/tornado-packages/archive-monorepo"
"url": "https://development.tornadocash.community/T-Hax/archive-monorepo"
},
"license": "LGPL-3.0",
"engines": {

View File

@ -20,10 +20,10 @@
],
"author": "Jordi Baylina",
"license": "GPL-3.0",
"homepage": "https://git.tornado.ws/tornado-packages/websnark",
"homepage": "https://development.tornadocash.community/T-Hax/websnark",
"repository": {
"type": "git",
"url": "https://git.tornado.ws/tornado-packages/archive-monorepo"
"url": "https://development.tornadocash.community/T-Hax/archive-monorepo"
},
"devDependencies": {
"browserify": "^16.2.3",

View File

@ -7,7 +7,7 @@
"homepage": "https://github.com/souldreamer/xhr2-cookies",
"repository": {
"type": "git",
"url": "https://git.tornado.ws/tornado-packages/archive-monorepo"
"url": "https://development.tornadocash.community/T-Hax/archive-monorepo"
},
"keywords": [
"XMLHttpRequest",

2
gitea/migrate.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
find @tornado package.json -type f -name "package.json" -not -path "*node_modules*" -execdir sed -i "s/$OLD_REGISTRY_DOMAIN\/$OLD_REGISTRY_USER/$TARGET_REGISTRY_DOMAIN\/$TARGET_REGISTRY_USER/g" {} +

View File

@ -1,6 +1,6 @@
{
"name": "archive-monorepo",
"packageManager": "yarn@3.6.1",
"packageManager": "yarn@3.5.0",
"private": true,
"workspaces": [
"@tornado/*"

857
yarn.lock

File diff suppressed because it is too large Load Diff