@xyo-network/xl1-protocol-sdk 1.16.2 → 1.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/ChainServiceCollectionV2.d.ts +2 -1
- package/dist/neutral/ChainServiceCollectionV2.d.ts.map +1 -1
- package/dist/neutral/index.mjs +24 -11
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/interfaces/viewers/AccountBalance.d.ts +2 -2
- package/dist/neutral/interfaces/viewers/Block.d.ts +1 -1
- package/dist/neutral/interfaces/viewers/Block.d.ts.map +1 -1
- package/dist/neutral/interfaces/viewers/Chain.d.ts +1 -1
- package/dist/neutral/interfaces/viewers/ChainContract.d.ts +3 -1
- package/dist/neutral/interfaces/viewers/ChainContract.d.ts.map +1 -1
- package/dist/neutral/interfaces/viewers/Fork.d.ts +1 -1
- package/dist/neutral/interfaces/viewers/Fork.d.ts.map +1 -1
- package/dist/neutral/interfaces/viewers/NetworkStakeStepReward.d.ts +4 -4
- package/dist/neutral/interfaces/viewers/NetworkStakeStepReward.d.ts.map +1 -1
- package/dist/neutral/interfaces/viewers/StakeTotalsViewer.d.ts +3 -1
- package/dist/neutral/interfaces/viewers/StakeTotalsViewer.d.ts.map +1 -1
- package/dist/neutral/interfaces/viewers/StakeViewer.d.ts +2 -2
- package/dist/neutral/interfaces/viewers/StakeViewer.d.ts.map +1 -1
- package/dist/neutral/interfaces/viewers/StepStake.d.ts +3 -1
- package/dist/neutral/interfaces/viewers/StepStake.d.ts.map +1 -1
- package/dist/neutral/interfaces/viewers/TimeSync.d.ts +3 -3
- package/dist/neutral/interfaces/viewers/TimeSync.d.ts.map +1 -1
- package/dist/neutral/interfaces/viewers/Transaction.d.ts +1 -1
- package/dist/neutral/interfaces/viewers/TransferBalance.d.ts +2 -2
- package/dist/neutral/interfaces/viewers/index.d.ts +0 -1
- package/dist/neutral/interfaces/viewers/index.d.ts.map +1 -1
- package/dist/neutral/model/ChainStake/ChainStakeRead.d.ts +1 -1
- package/dist/neutral/model/ChainStake/ChainStakeRead.d.ts.map +1 -1
- package/dist/neutral/{interfaces/viewers/Stake.d.ts → model/Position.d.ts} +1 -1
- package/dist/neutral/model/Position.d.ts.map +1 -0
- package/dist/neutral/model/index.d.ts +1 -0
- package/dist/neutral/model/index.d.ts.map +1 -1
- package/dist/neutral/provider/XyoGateway.d.ts +7 -2
- package/dist/neutral/provider/XyoGateway.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/StepViewer.d.ts +1 -1
- package/dist/neutral/provider/viewer/StepViewer.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/XyoViewer.d.ts +2 -2
- package/dist/neutral/provider/viewer/XyoViewer.d.ts.map +1 -1
- package/dist/neutral/services/Chain/ChainService.d.ts +2 -1
- package/dist/neutral/services/Chain/ChainService.d.ts.map +1 -1
- package/dist/neutral/services/Chain/interfaces/ChainStakeViewer.d.ts +1 -2
- package/dist/neutral/services/Chain/interfaces/ChainStakeViewer.d.ts.map +1 -1
- package/dist/neutral/services/Chain/interfaces/index.d.ts +0 -1
- package/dist/neutral/services/Chain/interfaces/index.d.ts.map +1 -1
- package/dist/neutral/services/NetworkStakeService.d.ts +2 -2
- package/dist/neutral/services/NetworkStakeService.d.ts.map +1 -1
- package/dist/neutral/services/StepStakeService.d.ts +2 -2
- package/dist/neutral/services/StepStakeService.d.ts.map +1 -1
- package/dist/neutral/services/TimeSyncService.d.ts +2 -4
- package/dist/neutral/services/TimeSyncService.d.ts.map +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGateway.d.ts +5 -2
- package/dist/neutral/simple/gateway/SimpleXyoGateway.d.ts.map +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts +6 -2
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/ChainServiceCollectionV2.ts +2 -1
- package/src/interfaces/viewers/AccountBalance.ts +2 -2
- package/src/interfaces/viewers/Block.ts +1 -1
- package/src/interfaces/viewers/Chain.ts +1 -1
- package/src/interfaces/viewers/ChainContract.ts +3 -1
- package/src/interfaces/viewers/Fork.ts +1 -1
- package/src/interfaces/viewers/NetworkStakeStepReward.ts +7 -7
- package/src/interfaces/viewers/StakeTotalsViewer.ts +3 -1
- package/src/interfaces/viewers/StakeViewer.ts +2 -2
- package/src/interfaces/viewers/StepStake.ts +3 -1
- package/src/interfaces/viewers/TimeSync.ts +3 -3
- package/src/interfaces/viewers/Transaction.ts +1 -1
- package/src/interfaces/viewers/TransferBalance.ts +2 -2
- package/src/interfaces/viewers/index.ts +0 -1
- package/src/model/ChainStake/ChainStakeRead.ts +1 -1
- package/src/model/index.ts +1 -0
- package/src/provider/XyoGateway.ts +10 -2
- package/src/provider/viewer/StepViewer.ts +1 -1
- package/src/provider/viewer/XyoViewer.ts +11 -8
- package/src/services/Chain/ChainService.ts +2 -3
- package/src/services/Chain/interfaces/ChainStakeViewer.ts +1 -2
- package/src/services/Chain/interfaces/index.ts +0 -1
- package/src/services/NetworkStakeService.ts +2 -2
- package/src/services/StepStakeService.ts +2 -2
- package/src/services/TimeSyncService.ts +2 -4
- package/src/simple/gateway/SimpleXyoGateway.ts +12 -2
- package/src/simple/gateway/SimpleXyoGatewayRunner.ts +24 -9
- package/dist/neutral/interfaces/viewers/Stake.d.ts.map +0 -1
- package/dist/neutral/services/Chain/interfaces/ChainContractViewer.d.ts +0 -4
- package/dist/neutral/services/Chain/interfaces/ChainContractViewer.d.ts.map +0 -1
- package/src/services/Chain/interfaces/ChainContractViewer.ts +0 -5
- /package/src/{interfaces/viewers/Stake.ts → model/Position.ts} +0 -0
|
@@ -2,7 +2,7 @@ import type { Hash } from '@xylabs/hex'
|
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
3
|
import type { HydratedBlock } from '@xyo-network/xl1-protocol'
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface BlockViewierMethods {
|
|
6
6
|
blockByHash(hash: Hash): Promisable<HydratedBlock | null>
|
|
7
7
|
blockByNumber(blockNumber: number): Promisable<HydratedBlock | null>
|
|
8
8
|
blocksByHash(hash: Hash, limit?: number): Promisable<HydratedBlock[]>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address } from '@xylabs/hex'
|
|
2
2
|
|
|
3
|
-
export interface
|
|
3
|
+
export interface ChainContractViewerMethods {
|
|
4
4
|
forkedAtBlockNumber(): Promise<bigint>
|
|
5
5
|
forkedAtHash(): Promise<bigint>
|
|
6
6
|
forkedChainId(): Promise<Address>
|
|
@@ -8,3 +8,5 @@ export interface ChainContractViewInterface {
|
|
|
8
8
|
rewardsContract(): Promise<string>
|
|
9
9
|
stakingTokenAddress(): Promise<string>
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
export interface ChainContractViewer extends ChainContractViewerMethods {}
|
|
@@ -3,7 +3,7 @@ import type { ChainId } from '@xyo-network/xl1-protocol'
|
|
|
3
3
|
|
|
4
4
|
export type ForkHistory = Record<number, ChainId>
|
|
5
5
|
|
|
6
|
-
export interface
|
|
6
|
+
export interface ForkViewerMethods {
|
|
7
7
|
chainIdAtBlock(blockNumber: number): Promisable<ChainId | undefined>
|
|
8
8
|
forkHistory(): Promisable<ForkHistory>
|
|
9
9
|
}
|
|
@@ -2,7 +2,7 @@ import type { Address } from '@xylabs/hex'
|
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
3
|
import type { StepIdentity, StepIdentityString } from '@xyo-network/xl1-protocol'
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface NetworkStakeStepAddressRewardViewerMethods {
|
|
6
6
|
// the step rewards for a specific network stakers for all of history
|
|
7
7
|
networkStakeStepRewardAddressHistory(address: Address): Promisable<Record<Address, bigint>>
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ export interface NetworkStakeStepAddressRewardViewInterface {
|
|
|
16
16
|
networkStakeStepRewardWeightForAddress(context: StepIdentity, address: Address): Promisable<bigint>
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export interface
|
|
19
|
+
export interface NetworkStakeStepPoolRewardViewerMethods {
|
|
20
20
|
|
|
21
21
|
// all the step rewards for all the network stakers for a given step and block
|
|
22
22
|
networkStakeStepRewardPoolRewards(context: StepIdentity): Promisable<Record<Address, bigint>>
|
|
@@ -25,7 +25,7 @@ export interface NetworkStakeStepPoolRewardViewInterface {
|
|
|
25
25
|
networkStakeStepRewardPoolShares(context: StepIdentity): Promisable<Record<Address, bigint>>
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export interface
|
|
28
|
+
export interface NetworkStakeStepRewardPositionViewerMethods {
|
|
29
29
|
// estimate the current weight for a given position at a given step
|
|
30
30
|
networkStakeStepRewardPositionWeight(context: StepIdentity, position: number): Promisable<bigint>
|
|
31
31
|
|
|
@@ -33,10 +33,10 @@ export interface NetworkStakeStepRewardPositionViewInterface {
|
|
|
33
33
|
networkStakeStepRewardPotentialPositionLoss(context: StepIdentity, position: number): Promisable<bigint>
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export interface
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
export interface NetworkStakeStepRewardViewer extends
|
|
37
|
+
NetworkStakeStepPoolRewardViewerMethods,
|
|
38
|
+
NetworkStakeStepAddressRewardViewerMethods,
|
|
39
|
+
NetworkStakeStepRewardPositionViewerMethods
|
|
40
40
|
{
|
|
41
41
|
networkStakeStepRewardClaimedByAddress(address: Address): Promisable<bigint>
|
|
42
42
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address } from '@xylabs/hex'
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface StakeTotalsViewerMethods {
|
|
5
5
|
active(): Promisable<bigint>
|
|
6
6
|
activeByStaked(staked: Address): Promisable<bigint>
|
|
7
7
|
activeByStaker(address: Address): Promisable<bigint>
|
|
@@ -10,3 +10,5 @@ export interface StakeTotalsViewer {
|
|
|
10
10
|
withdrawn(): Promisable<bigint>
|
|
11
11
|
withdrawnByStaker(staker: Address): Promisable<bigint>
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
export interface StakeTotalsViewer extends StakeTotalsViewerMethods {}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Address } from '@xylabs/hex'
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
3
|
|
|
4
|
-
import type { Position } from '
|
|
4
|
+
import type { Position } from '../../model/index.ts'
|
|
5
5
|
|
|
6
|
-
export interface
|
|
6
|
+
export interface StakeViewerMethods {
|
|
7
7
|
stakeById(id: number): Promisable<Position>
|
|
8
8
|
stakeByStaker(staker: Address, slot: number): Promisable<Position>
|
|
9
9
|
/* @deprecated use stakesByStaker */
|
|
@@ -2,7 +2,7 @@ import type { Address } from '@xylabs/hex'
|
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
3
|
import type { StepIdentity } from '@xyo-network/xl1-protocol'
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface StepStakeViewerMethods {
|
|
6
6
|
// this is the prorated stake for all addresses in the step
|
|
7
7
|
stepStake: (step: StepIdentity) => Promisable<Record<Address, bigint>>
|
|
8
8
|
|
|
@@ -17,3 +17,5 @@ export interface StepStakeViewInterface {
|
|
|
17
17
|
The simplest way to calculate it is to enumerate every XL1 block in the step add the current stake at that point to a counter.
|
|
18
18
|
For example, if an Address had a stake of 100 for the entire time, then the prorated stake would be 100 * number of blocks in the step.
|
|
19
19
|
*/
|
|
20
|
+
|
|
21
|
+
export interface StepStakeViewer extends StepStakeViewerMethods {}
|
|
@@ -2,18 +2,18 @@ import type { Hash } from '@xylabs/hex'
|
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
3
|
import type { TimeDomain, TimePayload } from '@xyo-network/xl1-protocol'
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface TimeSyncViewerMethods {
|
|
6
6
|
/** Convert time between different domains */
|
|
7
7
|
convertTime(fromDomain: TimeDomain, toDomain: TimeDomain, from: number): Promisable<number>
|
|
8
8
|
|
|
9
9
|
/** Get the current time for a given domain */
|
|
10
10
|
currentTime(domain: TimeDomain): Promisable<[string, number]>
|
|
11
|
-
}
|
|
12
11
|
|
|
13
|
-
export interface TimeSyncViewInterfaceV2 extends TimeSyncViewInterface {
|
|
14
12
|
/** Get the current time for a given domain */
|
|
15
13
|
currentTimeAndHash(domain: TimeDomain): Promisable<[number, Hash | null]>
|
|
16
14
|
|
|
17
15
|
/** Create a TimePayload with the current time from all configured domains */
|
|
18
16
|
currentTimePayload(): Promisable<TimePayload>
|
|
19
17
|
}
|
|
18
|
+
|
|
19
|
+
export interface TimeSyncViewer extends TimeSyncViewerMethods {}
|
|
@@ -2,7 +2,7 @@ import type { Hash } from '@xylabs/hex'
|
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
3
|
import type { SignedHydratedTransaction } from '@xyo-network/xl1-protocol'
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface TransactionViewerMethods {
|
|
6
6
|
transactionByBlockHashAndIndex(blockHash: Hash, transactionIndex: number): Promisable<SignedHydratedTransaction | null>
|
|
7
7
|
transactionByBlockNumberAndIndex(blockNumber: number, transactionIndex: number): Promisable<SignedHydratedTransaction | null>
|
|
8
8
|
transactionByHash(transactionHash: Hash): Promisable<SignedHydratedTransaction | null>
|
|
@@ -14,14 +14,14 @@ export type TransferBalanceHistoryItem = [
|
|
|
14
14
|
]
|
|
15
15
|
export type TransferPair = [/* from */ Address, /* to */Address]
|
|
16
16
|
|
|
17
|
-
export interface
|
|
17
|
+
export interface TransferBalancesViewerMethods {
|
|
18
18
|
transferBalances(address: Address[]): Promisable<Partial<Record<Address, Record<Address, AttoXL1>>>>
|
|
19
19
|
transferBalancesHistories(address: Address[]): Promisable<Partial<Record<Address, Record<Address, TransferBalanceHistoryItem[]>>>>
|
|
20
20
|
transferPairBalances(address: TransferPair[]): Promisable<Partial<Record<Address, Record<Address, AttoXL1>>>>
|
|
21
21
|
transferPairBalancesHistories(address: TransferPair[]): Promisable<Partial<Record<Address, Record<Address, TransferBalanceHistoryItem[]>>>>
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export interface
|
|
24
|
+
export interface TransferBalanceViewerMethods {
|
|
25
25
|
transferBalance(address: Address): Promisable<AttoXL1>
|
|
26
26
|
transferBalanceHistory(address: Address, range?: XL1BlockRange): Promisable<TransferBalanceHistoryItem[]>
|
|
27
27
|
transferPairBalance(address: TransferPair): Promisable<AttoXL1>
|
|
@@ -4,7 +4,6 @@ export * from './Chain.ts'
|
|
|
4
4
|
export * from './ChainContract.ts'
|
|
5
5
|
export * from './Fork.ts'
|
|
6
6
|
export * from './NetworkStakeStepReward.ts'
|
|
7
|
-
export * from './Stake.ts'
|
|
8
7
|
export * from './StakeTotalsViewer.ts'
|
|
9
8
|
export * from './StakeViewer.ts'
|
|
10
9
|
export * from './StepStake.ts'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address } from '@xylabs/hex'
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
3
|
|
|
4
|
-
import type { Position } from '
|
|
4
|
+
import type { Position } from '../Position.ts'
|
|
5
5
|
|
|
6
6
|
export interface ChainStakeRead {
|
|
7
7
|
active(time?: number): Promisable<bigint>
|
package/src/model/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './ChainIdentity.ts'
|
|
|
4
4
|
export * from './ChainStake/index.ts'
|
|
5
5
|
export * from './ChainStore.ts'
|
|
6
6
|
export * from './PayloadMap.ts'
|
|
7
|
+
export * from './Position.ts'
|
|
7
8
|
export * from './RecordKeyType.ts'
|
|
8
9
|
export * from './StakeEvents.ts'
|
|
9
10
|
export * from './summary.ts'
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Promisable } from '@xylabs/promise'
|
|
2
|
+
|
|
1
3
|
import type { XyoSigner } from './signer/index.ts'
|
|
2
4
|
import type { XyoConnection } from './XyoConnection.ts'
|
|
3
5
|
|
|
@@ -5,9 +7,15 @@ export interface XyoGateway {
|
|
|
5
7
|
/**
|
|
6
8
|
* Returns the connection provider for this gateway.
|
|
7
9
|
*/
|
|
8
|
-
|
|
10
|
+
connectionInstance: XyoConnection
|
|
9
11
|
/**
|
|
10
12
|
* Returns the signer for this gateway.
|
|
11
13
|
*/
|
|
12
|
-
|
|
14
|
+
signerInstance: XyoSigner
|
|
15
|
+
|
|
16
|
+
/** @deprecated use connectionInstance */
|
|
17
|
+
connection(): Promisable<XyoConnection>
|
|
18
|
+
|
|
19
|
+
/** @deprecated use signerInstance */
|
|
20
|
+
signer(): Promisable<XyoSigner>
|
|
13
21
|
}
|
|
@@ -2,7 +2,7 @@ import type { Address } from '@xylabs/hex'
|
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
3
|
import type { PositionId, StepIdentity } from '@xyo-network/xl1-protocol'
|
|
4
4
|
|
|
5
|
-
import type { Position } from '../../
|
|
5
|
+
import type { Position } from '../../model/index.ts'
|
|
6
6
|
import type { NetworkStakeStepRewardsViewer } from './NetworkStake/index.ts'
|
|
7
7
|
|
|
8
8
|
export interface PagedPositionsOptions {
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
AccountBalanceViewerMethods,
|
|
3
|
+
BlockViewierMethods,
|
|
4
|
+
ChainViewerMethods,
|
|
5
|
+
ForkViewerMethods,
|
|
6
|
+
NetworkStakeStepRewardViewer,
|
|
7
|
+
StakeViewerMethods,
|
|
8
|
+
TransactionViewerMethods,
|
|
9
|
+
TransferBalanceViewerMethods,
|
|
7
10
|
} from '../../interfaces/index.ts'
|
|
8
11
|
import type { NetworkStakeViewer } from './NetworkStake/index.ts'
|
|
9
12
|
import type { StepViewer } from './StepViewer.ts'
|
|
10
13
|
|
|
11
|
-
export interface XyoViewerMethods extends
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
export interface XyoViewerMethods extends AccountBalanceViewerMethods, TransferBalanceViewerMethods,
|
|
15
|
+
NetworkStakeStepRewardViewer,
|
|
16
|
+
ChainViewerMethods, BlockViewierMethods, TransactionViewerMethods, StakeViewerMethods, ForkViewerMethods {
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
export interface XyoViewer extends XyoViewerMethods {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import type { ChainContractViewer } from '../../interfaces/index.ts'
|
|
1
2
|
import type { BaseChainService } from './BaseChainService.ts'
|
|
2
|
-
import type {
|
|
3
|
-
ChainContractViewer, ChainStaker, ChainStakeViewer,
|
|
4
|
-
} from './interfaces/index.ts'
|
|
3
|
+
import type { ChainStaker, ChainStakeViewer } from './interfaces/index.ts'
|
|
5
4
|
|
|
6
5
|
export interface ChainService extends ChainContractViewer, ChainStakeViewer, ChainStaker, BaseChainService {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { StakeTotalsViewer } from '../../../interfaces/index.ts'
|
|
2
|
-
import type { ChainContractViewer } from './ChainContractViewer.ts'
|
|
1
|
+
import type { ChainContractViewer, StakeTotalsViewer } from '../../../interfaces/index.ts'
|
|
3
2
|
|
|
4
3
|
export interface ChainStakeViewer extends ChainContractViewer, StakeTotalsViewer {
|
|
5
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NetworkStakeStepRewardViewer } from '../interfaces/index.ts'
|
|
2
2
|
import type { ServiceInterface } from './Service.ts'
|
|
3
3
|
|
|
4
|
-
export interface NetworkStakeStepRewardService extends
|
|
4
|
+
export interface NetworkStakeStepRewardService extends NetworkStakeStepRewardViewer, ServiceInterface {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StepStakeViewer } from '../interfaces/index.ts'
|
|
2
2
|
import type { ServiceInterface } from './Service.ts'
|
|
3
3
|
|
|
4
|
-
export interface StepStakeService extends ServiceInterface,
|
|
4
|
+
export interface StepStakeService extends ServiceInterface, StepStakeViewer {}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TimeSyncViewerMethods } from '../interfaces/index.ts'
|
|
2
2
|
import type { ServiceInterface } from './Service.ts'
|
|
3
3
|
|
|
4
|
-
export interface TimeSyncService extends ServiceInterface,
|
|
5
|
-
|
|
6
|
-
export interface TimeSyncServiceV2 extends ServiceInterface, TimeSyncViewInterfaceV2 {}
|
|
4
|
+
export interface TimeSyncService extends ServiceInterface, TimeSyncViewerMethods {}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Promisable } from '@xylabs/promise'
|
|
2
|
+
|
|
1
3
|
import type {
|
|
2
4
|
XyoConnection, XyoGateway, XyoSigner,
|
|
3
5
|
} from '../../provider/index.ts'
|
|
@@ -11,11 +13,19 @@ export class SimpleXyoGateway implements XyoGateway {
|
|
|
11
13
|
this._connection = connection
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
get
|
|
16
|
+
get connectionInstance(): XyoConnection {
|
|
17
|
+
return this._connection
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get signerInstance(): XyoSigner {
|
|
21
|
+
return this._signer
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
connection(): Promisable<XyoConnection> {
|
|
15
25
|
return this._connection
|
|
16
26
|
}
|
|
17
27
|
|
|
18
|
-
|
|
28
|
+
signer(): Promisable<XyoSigner> {
|
|
19
29
|
return this._signer
|
|
20
30
|
}
|
|
21
31
|
}
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
Address, Hash, Hex,
|
|
4
4
|
} from '@xylabs/hex'
|
|
5
5
|
import { BigIntToJsonZod } from '@xylabs/hex'
|
|
6
|
+
import type { Promisable } from '@xylabs/promise'
|
|
6
7
|
import { isDefined } from '@xylabs/typeof'
|
|
7
8
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
8
9
|
import type { Payload, WithHashMeta } from '@xyo-network/payload-model'
|
|
@@ -32,16 +33,16 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
32
33
|
this._dataLakes = [...dataLakes]
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
get
|
|
36
|
-
return this.gateway.
|
|
36
|
+
get connectionInstance(): XyoConnection {
|
|
37
|
+
return this.gateway.connectionInstance
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
get dataLakes(): DataLakeRunner[] {
|
|
40
41
|
throw new Error('Method not implemented.')
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
get
|
|
44
|
-
return this.gateway.
|
|
44
|
+
get signerInstance(): XyoSigner {
|
|
45
|
+
return this.gateway.signerInstance
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
addDataLake(dataLake: DataLakeRunner): number {
|
|
@@ -55,7 +56,7 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
55
56
|
options?: TransactionOptions,
|
|
56
57
|
): Promise<[Hash, SignedHydratedTransactionWithHashMeta]> {
|
|
57
58
|
// Get chain providers
|
|
58
|
-
const viewer = assertEx(this.
|
|
59
|
+
const viewer = assertEx(this.connectionInstance.viewer, () => 'No viewer available on connection')
|
|
59
60
|
|
|
60
61
|
// Resolve transaction options
|
|
61
62
|
const {
|
|
@@ -66,13 +67,16 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
66
67
|
const resolvedExp = isDefined(exp) ? exp : resolvedNbf + 10
|
|
67
68
|
|
|
68
69
|
// Build, sign, and broadcast the transaction
|
|
69
|
-
|
|
70
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
71
|
+
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await (await this.signer()).address(), fees)
|
|
70
72
|
return await this.addTransactionToChain(tx)
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
async addTransactionToChain(tx: SignedHydratedTransaction): Promise<[Hash, SignedHydratedTransactionWithHashMeta]> {
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
77
|
+
const connection = await this.gateway.connection()
|
|
78
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
79
|
+
const signer = await this.gateway.signer()
|
|
76
80
|
const runner = assertEx(connection.runner, () => 'No runner available on connection')
|
|
77
81
|
const signedTx = await signer.signTransaction(tx)
|
|
78
82
|
await this.addPayloadsToDataLakes(signedTx[1])
|
|
@@ -82,6 +86,10 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
82
86
|
), signedTx]
|
|
83
87
|
}
|
|
84
88
|
|
|
89
|
+
connection(): Promisable<XyoConnection> {
|
|
90
|
+
throw new Error('Method not implemented.')
|
|
91
|
+
}
|
|
92
|
+
|
|
85
93
|
removeDataLake(index: number): void {
|
|
86
94
|
this._dataLakes[index] = null
|
|
87
95
|
}
|
|
@@ -91,7 +99,8 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
91
99
|
}
|
|
92
100
|
|
|
93
101
|
async sendMany(transfers: Record<Address, AttoXL1>, options?: TransactionOptions): Promise<Hash> {
|
|
94
|
-
|
|
102
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
103
|
+
const from = await (await this.signer()).address()
|
|
95
104
|
const hexTransfers: Record<Address, Hex> = Object.fromEntries(
|
|
96
105
|
Object.entries(transfers).map(([address, amount]) => ([
|
|
97
106
|
address, BigIntToJsonZod.parse(amount),
|
|
@@ -106,6 +115,12 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
|
|
|
106
115
|
return hash
|
|
107
116
|
}
|
|
108
117
|
|
|
118
|
+
/** @deprecated use signerInstance instead */
|
|
119
|
+
signer(): Promisable<XyoSigner> {
|
|
120
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
121
|
+
return this.gateway.signer()
|
|
122
|
+
}
|
|
123
|
+
|
|
109
124
|
protected async addPayloadsToDataLakes(payloads: WithHashMeta<Payload>[]): Promise<void> {
|
|
110
125
|
await Promise.all(this._dataLakes.map(async (dataLake) => {
|
|
111
126
|
await Promise.all(payloads.map(async (payload) => {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Stake.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/viewers/Stake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAE3D,MAAM,MAAM,QAAQ,GAAG;IAErB,QAAQ,EAAE,MAAM,CAAA;IAEhB,MAAM,EAAE,MAAM,CAAA;IAEd,EAAE,EAAE,UAAU,CAAA;IAEd,WAAW,EAAE,MAAM,CAAA;IAEnB,MAAM,EAAE,OAAO,CAAA;IAEf,MAAM,EAAE,OAAO,CAAA;IAEf,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,yCAAyC;AACzC,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChainContractViewer.d.ts","sourceRoot":"","sources":["../../../../../src/services/Chain/interfaces/ChainContractViewer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AAE9E,MAAM,WAAW,mBAAoB,SAAQ,0BAA0B;CAEtE"}
|
|
File without changes
|