-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from edenia/feat/maintenance
Feat/maintenance
- Loading branch information
Showing
32 changed files
with
2,316 additions
and
2,244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
export const endpoint = | ||
process.env.HAPI_NETWORK_API || 'https://jungle.edenia.cloud' | ||
export const chainId = | ||
process.env.HAPI_NETWORK_CHAIN_ID || | ||
'73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d' | ||
export const baseAccount = | ||
import { NameType, PrivateKeyType } from '@wharfkit/session' | ||
import { Chains, ChainIndices, ChainDefinition } from '@wharfkit/common' | ||
|
||
if ( | ||
!process.env.HAPI_NETWORK_CHAIN_INDEX && | ||
!process.env.HAPI_CUSTOM_NETWORK_CHAIN | ||
) { | ||
throw new Error('Chain not defined') | ||
} | ||
|
||
export const chain = process.env.HAPI_NETWORK_CHAIN_INDEX | ||
? Chains[process.env.HAPI_NETWORK_CHAIN_INDEX.trim() as ChainIndices] | ||
: ChainDefinition.from( | ||
JSON.parse(process.env.HAPI_CUSTOM_NETWORK_CHAIN || '{}') | ||
) | ||
|
||
if (!chain) { | ||
throw new Error('Failed to load chain') | ||
} | ||
|
||
export const baseAccount: NameType = | ||
process.env.HAPI_NETWORK_BASE_ACCOUNT || 'accountname1' | ||
export const baseAccountPassword = process.env.HAPI_NETWORK_BASE_PASSWORD | ||
export const baseAccountPassword: PrivateKeyType = | ||
process.env.HAPI_NETWORK_BASE_PASSWORD || 'password' | ||
export const walletUrl = process.env.HAPI_NETWORK_WALLET_URL |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * as coreUtil from './core' | ||
export * as timeUtil from './time.util' | ||
export * as eosUtil from './eos.util' | ||
export * as wharfUtil from './wharf.util' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Session, NameType, AnyAction } from '@wharfkit/session' | ||
import { WalletPluginPrivateKey } from '@wharfkit/wallet-plugin-privatekey' | ||
|
||
import { eosConfig } from '../config' | ||
|
||
const args = { | ||
chain: eosConfig.chain, | ||
actor: eosConfig.baseAccount, | ||
permission: 'active', | ||
walletPlugin: new WalletPluginPrivateKey(eosConfig.baseAccountPassword) | ||
} | ||
|
||
const defaultSessionOptions = {} | ||
const session = new Session(args, defaultSessionOptions) | ||
|
||
export const getAbi = async (account: NameType) => | ||
await session.client.v1.chain.get_abi(account) | ||
|
||
export const getAccount = async (account: NameType) => | ||
await session.client.v1.chain.get_account(account) | ||
|
||
export const sendTransaction = async (actions: AnyAction[]) => { | ||
try { | ||
return await session.transact({ actions }) | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
} catch (error: any) { | ||
throw new Error(error.message) | ||
} | ||
} |
Oops, something went wrong.