@aragon/connect-agreement
Advanced tools
Comparing version 0.0.0-beta.11 to 0.0.0-beta.12
@@ -21,4 +21,7 @@ "use strict"; | ||
const roundedDecimals = Math.round(parseInt(decimals) / 10 ** (decimalsLength - formattedDecimals)); | ||
return `${integer}.${roundedDecimals}`; | ||
const parsedRoundedDecimals = (roundedDecimals === 0) | ||
? '0'.repeat(formattedDecimals) | ||
: roundedDecimals.toString(); | ||
return `${integer}.${parsedRoundedDecimals}`; | ||
}; | ||
//# sourceMappingURL=numbers.js.map |
@@ -13,3 +13,2 @@ import { SubscriptionCallback, SubscriptionResult } from '@aragon/connect-types'; | ||
readonly versionId: string; | ||
readonly script: string; | ||
readonly context: string; | ||
@@ -16,0 +15,0 @@ readonly createdAt: string; |
@@ -29,3 +29,2 @@ "use strict"; | ||
this.context = data.context; | ||
this.script = data.script; | ||
this.createdAt = data.createdAt; | ||
@@ -32,0 +31,0 @@ } |
@@ -44,4 +44,4 @@ import { SubscriptionCallback, SubscriptionResult } from '@aragon/connect-types'; | ||
stakingId(tokenAddress: string, userAddress: string): string; | ||
staking(tokenAddress: string, userAddress: string): Promise<Staking>; | ||
onStaking(tokenAddress: string, userAddress: string, callback?: SubscriptionCallback<Staking>): SubscriptionResult<Staking>; | ||
staking(tokenAddress: string, userAddress: string): Promise<Staking | null>; | ||
onStaking(tokenAddress: string, userAddress: string, callback?: SubscriptionCallback<Staking | null>): SubscriptionResult<Staking | null>; | ||
stakingMovements(tokenAddress: string, userAddress: string, { first, skip }?: { | ||
@@ -48,0 +48,0 @@ first?: number | undefined; |
@@ -85,3 +85,3 @@ "use strict"; | ||
stakingId(tokenAddress, userAddress) { | ||
return `${tokenAddress.toLowerCase()}-user-${userAddress.toLowerCase()}`; | ||
return `${tokenAddress.toLowerCase()}-staking-${userAddress.toLowerCase()}`; | ||
} | ||
@@ -88,0 +88,0 @@ async staking(tokenAddress, userAddress) { |
@@ -9,2 +9,3 @@ import { SubscriptionCallback, SubscriptionResult } from '@aragon/connect-types'; | ||
readonly tokenId: string; | ||
readonly tokenSymbol: string; | ||
readonly tokenDecimals: string; | ||
@@ -11,0 +12,0 @@ readonly actionAmount: string; |
@@ -26,2 +26,3 @@ "use strict"; | ||
this.tokenId = data.tokenId; | ||
this.tokenSymbol = data.tokenSymbol; | ||
this.tokenDecimals = data.tokenDecimals; | ||
@@ -28,0 +29,0 @@ this.actionAmount = data.actionAmount; |
@@ -9,2 +9,3 @@ import { SubscriptionCallback, SubscriptionResult } from '@aragon/connect-types'; | ||
readonly tokenId: string; | ||
readonly tokenSymbol: string; | ||
readonly tokenDecimals: string; | ||
@@ -11,0 +12,0 @@ readonly available: string; |
@@ -26,2 +26,3 @@ "use strict"; | ||
this.tokenId = data.tokenId; | ||
this.tokenSymbol = data.tokenSymbol; | ||
this.tokenDecimals = data.tokenDecimals; | ||
@@ -28,0 +29,0 @@ this.available = data.available; |
@@ -12,5 +12,8 @@ import { SubscriptionCallback, SubscriptionResult } from '@aragon/connect-types'; | ||
readonly tokenId: string; | ||
readonly tokenSymbol: string; | ||
readonly tokenDecimals: string; | ||
readonly amount: string; | ||
readonly actionId: string; | ||
readonly disputableAddress: string; | ||
readonly disputableActionId: string; | ||
readonly actionState: string; | ||
@@ -24,7 +27,8 @@ readonly collateralState: string; | ||
onToken(callback?: SubscriptionCallback<ERC20>): SubscriptionResult<ERC20>; | ||
staking(): Promise<Staking>; | ||
onStaking(callback?: SubscriptionCallback<Staking>): SubscriptionResult<Staking>; | ||
action(): Promise<Action | null>; | ||
staking(): Promise<Staking | null>; | ||
onStaking(callback?: SubscriptionCallback<Staking | null>): SubscriptionResult<Staking | null>; | ||
action(): Promise<Action>; | ||
tryAction(): Promise<Action | null>; | ||
onAction(callback?: SubscriptionCallback<Action | null>): SubscriptionResult<Action | null>; | ||
} | ||
//# sourceMappingURL=StakingMovement.d.ts.map |
@@ -27,5 +27,8 @@ "use strict"; | ||
this.tokenId = data.tokenId; | ||
this.tokenSymbol = data.tokenSymbol; | ||
this.tokenDecimals = data.tokenDecimals; | ||
this.amount = data.amount; | ||
this.actionId = data.actionId; | ||
this.disputableAddress = data.disputableAddress; | ||
this.disputableActionId = data.disputableActionId; | ||
this.actionState = data.actionState; | ||
@@ -54,4 +57,11 @@ this.collateralState = data.collateralState; | ||
async action() { | ||
return __classPrivateFieldGet(this, _connector).action(this.actionId || ''); | ||
const action = await this.tryAction(); | ||
if (!action) { | ||
throw Error(`Could not find given action number ${this.actionId}`); | ||
} | ||
return action; | ||
} | ||
async tryAction() { | ||
return __classPrivateFieldGet(this, _connector).action(this.actionId); | ||
} | ||
onAction(callback) { | ||
@@ -58,0 +68,0 @@ return connect_core_1.subscription(callback, (callback) => __classPrivateFieldGet(this, _connector).onAction(this.actionId || '', callback)); |
@@ -38,6 +38,6 @@ import { SubscriptionCallback, SubscriptionHandler } from '@aragon/connect-types'; | ||
onCollateralRequirement(collateralRequirementId: string, callback: SubscriptionCallback<CollateralRequirement>): SubscriptionHandler; | ||
staking(stakingId: string): Promise<Staking>; | ||
onStaking(stakingId: string, callback: SubscriptionCallback<Staking>): SubscriptionHandler; | ||
stakingMovements(stakingId: string, agreement: string, first: number, skip: number): Promise<StakingMovement[]>; | ||
onStakingMovements(stakingId: string, agreement: string, first: number, skip: number, callback: SubscriptionCallback<StakingMovement[]>): SubscriptionHandler; | ||
staking(stakingId: string): Promise<Staking | null>; | ||
onStaking(stakingId: string, callback: SubscriptionCallback<Staking | null>): SubscriptionHandler; | ||
stakingMovements(stakingId: string, agreementId: string, first: number, skip: number): Promise<StakingMovement[]>; | ||
onStakingMovements(stakingId: string, agreementId: string, first: number, skip: number, callback: SubscriptionCallback<StakingMovement[]>): SubscriptionHandler; | ||
action(actionId: string): Promise<Action | null>; | ||
@@ -44,0 +44,0 @@ onAction(actionId: string, callback: SubscriptionCallback<Action | null>): SubscriptionHandler; |
@@ -121,9 +121,7 @@ "use strict"; | ||
} | ||
async stakingMovements(stakingId, agreement, first, skip) { | ||
const agreements = [agreement, '0x0000000000000000000000000000000000000000']; | ||
return __classPrivateFieldGet(this, _gql).performQueryWithParser(queries.GET_STAKING_MOVEMENTS('query'), { stakingId, agreements, first, skip }, (result) => parsers_1.parseStakingMovements(result, this)); | ||
async stakingMovements(stakingId, agreementId, first, skip) { | ||
return __classPrivateFieldGet(this, _gql).performQueryWithParser(queries.GET_STAKING_MOVEMENTS('query'), { stakingId, agreementId, first, skip }, (result) => parsers_1.parseStakingMovements(result, this)); | ||
} | ||
onStakingMovements(stakingId, agreement, first, skip, callback) { | ||
const agreements = [agreement, '0x0000000000000000000000000000000000000000']; | ||
return __classPrivateFieldGet(this, _gql).subscribeToQueryWithParser(queries.GET_STAKING_MOVEMENTS('query'), { stakingId, agreements, first, skip }, callback, (result) => parsers_1.parseStakingMovements(result, this)); | ||
onStakingMovements(stakingId, agreementId, first, skip, callback) { | ||
return __classPrivateFieldGet(this, _gql).subscribeToQueryWithParser(queries.GET_STAKING_MOVEMENTS('query'), { stakingId, agreementId, first, skip }, callback, (result) => parsers_1.parseStakingMovements(result, this)); | ||
} | ||
@@ -130,0 +128,0 @@ async action(actionId) { |
@@ -13,3 +13,3 @@ "use strict"; | ||
} | ||
const { id, agreement, collateralRequirement, disputable, version, disputableActionId, script, context, createdAt } = action; | ||
const { id, agreement, collateralRequirement, disputable, version, disputableActionId, context, createdAt } = action; | ||
return new Action_1.default({ | ||
@@ -22,3 +22,2 @@ id, | ||
disputableActionId, | ||
script, | ||
context, | ||
@@ -25,0 +24,0 @@ createdAt |
@@ -14,2 +14,3 @@ "use strict"; | ||
tokenId: token.id, | ||
tokenSymbol: token.symbol, | ||
tokenDecimals: token.decimals, | ||
@@ -16,0 +17,0 @@ actionAmount, |
import { QueryResult } from '@aragon/connect-thegraph'; | ||
import Staking from '../../models/Staking'; | ||
import StakingMovement from '../../models/StakingMovement'; | ||
export declare function parseStaking(result: QueryResult, connector: any): Staking; | ||
export declare function parseStaking(result: QueryResult, connector: any): Staking | null; | ||
export declare function parseStakingMovements(result: QueryResult, connector: any): StakingMovement[]; | ||
//# sourceMappingURL=staking.d.ts.map |
@@ -12,3 +12,3 @@ "use strict"; | ||
if (!staking) { | ||
throw new Error('Unable to parse staking.'); | ||
return null; | ||
} | ||
@@ -24,2 +24,3 @@ const { id, token, user, total, available, locked, challenged } = staking; | ||
tokenId: token.id, | ||
tokenSymbol: token.symbol, | ||
tokenDecimals: token.decimals, | ||
@@ -35,3 +36,3 @@ }, connector); | ||
return movements.map((movement) => { | ||
const { id, staking, agreement, action, amount, actionState, collateralState, createdAt } = movement; | ||
const { id, staking, agreement, action, disputableActionId, amount, actionState, collateralState, createdAt } = movement; | ||
return new StakingMovement_1.default({ | ||
@@ -45,5 +46,8 @@ id, | ||
tokenId: staking.token.id, | ||
tokenSymbol: staking.token.symbol, | ||
tokenDecimals: staking.token.decimals, | ||
actionId: (action ? action.id : null), | ||
agreementId: (agreement ? agreement.id : null), | ||
actionId: action.id, | ||
disputableActionId, | ||
disputableAddress: action.disputable.address, | ||
agreementId: agreement.id | ||
}, connector); | ||
@@ -50,0 +54,0 @@ }); |
@@ -113,2 +113,3 @@ "use strict"; | ||
id | ||
symbol | ||
decimals | ||
@@ -126,2 +127,3 @@ } | ||
id | ||
symbol | ||
decimals | ||
@@ -137,6 +139,6 @@ } | ||
exports.GET_STAKING_MOVEMENTS = (type) => graphql_tag_1.default ` | ||
${type} StakingMovements($stakingId: String!, $agreements: [String]!, $first: Int!, $skip: Int!) { | ||
${type} StakingMovements($stakingId: String!, $agreementId: String!, $first: Int!, $skip: Int!) { | ||
stakingMovements(where: { | ||
staking: $stakingId, | ||
agreementId_in: $agreements, | ||
agreement: $agreementId, | ||
}, orderBy: createdAt, orderDirection: asc, first: $first, skip: $skip) { | ||
@@ -148,2 +150,3 @@ id | ||
id | ||
symbol | ||
decimals | ||
@@ -157,2 +160,6 @@ } | ||
id | ||
disputableActionId | ||
disputable { | ||
address | ||
} | ||
} | ||
@@ -183,3 +190,2 @@ amount | ||
disputableActionId | ||
script | ||
context | ||
@@ -186,0 +192,0 @@ createdAt |
@@ -37,2 +37,3 @@ import { SubscriptionCallback, SubscriptionHandler } from '@aragon/connect-types'; | ||
tokenId: string; | ||
tokenSymbol: string; | ||
tokenDecimals: string; | ||
@@ -68,3 +69,2 @@ actionAmount: string; | ||
context: string; | ||
script: string; | ||
createdAt: string; | ||
@@ -76,2 +76,3 @@ } | ||
tokenId: string; | ||
tokenSymbol: string; | ||
tokenDecimals: string; | ||
@@ -86,2 +87,3 @@ available: string; | ||
tokenId: string; | ||
tokenSymbol: string; | ||
tokenDecimals: string; | ||
@@ -92,2 +94,4 @@ stakingId: string; | ||
actionId: string; | ||
disputableAddress: string; | ||
disputableActionId: string; | ||
actionState: string; | ||
@@ -117,4 +121,4 @@ collateralState: string; | ||
onAction(actionId: string, callback: SubscriptionCallback<Action | null>): SubscriptionHandler; | ||
staking(stakingId: string): Promise<Staking>; | ||
onStaking(stakingId: string, callback: SubscriptionCallback<Staking>): SubscriptionHandler; | ||
staking(stakingId: string): Promise<Staking | null>; | ||
onStaking(stakingId: string, callback: SubscriptionCallback<Staking | null>): SubscriptionHandler; | ||
stakingMovements(stakingId: string, agreement: string, first: number, skip: number): Promise<StakingMovement[]>; | ||
@@ -121,0 +125,0 @@ onStakingMovements(stakingId: string, agreement: string, first: number, skip: number, callback: SubscriptionCallback<StakingMovement[]>): SubscriptionHandler; |
@@ -18,4 +18,7 @@ import { BigNumber, utils } from 'ethers'; | ||
const roundedDecimals = Math.round(parseInt(decimals) / 10 ** (decimalsLength - formattedDecimals)); | ||
return `${integer}.${roundedDecimals}`; | ||
const parsedRoundedDecimals = (roundedDecimals === 0) | ||
? '0'.repeat(formattedDecimals) | ||
: roundedDecimals.toString(); | ||
return `${integer}.${parsedRoundedDecimals}`; | ||
}; | ||
//# sourceMappingURL=numbers.js.map |
@@ -13,3 +13,2 @@ import { SubscriptionCallback, SubscriptionResult } from '@aragon/connect-types'; | ||
readonly versionId: string; | ||
readonly script: string; | ||
readonly context: string; | ||
@@ -16,0 +15,0 @@ readonly createdAt: string; |
@@ -27,3 +27,2 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { | ||
this.context = data.context; | ||
this.script = data.script; | ||
this.createdAt = data.createdAt; | ||
@@ -30,0 +29,0 @@ } |
@@ -44,4 +44,4 @@ import { SubscriptionCallback, SubscriptionResult } from '@aragon/connect-types'; | ||
stakingId(tokenAddress: string, userAddress: string): string; | ||
staking(tokenAddress: string, userAddress: string): Promise<Staking>; | ||
onStaking(tokenAddress: string, userAddress: string, callback?: SubscriptionCallback<Staking>): SubscriptionResult<Staking>; | ||
staking(tokenAddress: string, userAddress: string): Promise<Staking | null>; | ||
onStaking(tokenAddress: string, userAddress: string, callback?: SubscriptionCallback<Staking | null>): SubscriptionResult<Staking | null>; | ||
stakingMovements(tokenAddress: string, userAddress: string, { first, skip }?: { | ||
@@ -48,0 +48,0 @@ first?: number | undefined; |
@@ -83,3 +83,3 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { | ||
stakingId(tokenAddress, userAddress) { | ||
return `${tokenAddress.toLowerCase()}-user-${userAddress.toLowerCase()}`; | ||
return `${tokenAddress.toLowerCase()}-staking-${userAddress.toLowerCase()}`; | ||
} | ||
@@ -86,0 +86,0 @@ async staking(tokenAddress, userAddress) { |
@@ -9,2 +9,3 @@ import { SubscriptionCallback, SubscriptionResult } from '@aragon/connect-types'; | ||
readonly tokenId: string; | ||
readonly tokenSymbol: string; | ||
readonly tokenDecimals: string; | ||
@@ -11,0 +12,0 @@ readonly actionAmount: string; |
@@ -24,2 +24,3 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { | ||
this.tokenId = data.tokenId; | ||
this.tokenSymbol = data.tokenSymbol; | ||
this.tokenDecimals = data.tokenDecimals; | ||
@@ -26,0 +27,0 @@ this.actionAmount = data.actionAmount; |
@@ -9,2 +9,3 @@ import { SubscriptionCallback, SubscriptionResult } from '@aragon/connect-types'; | ||
readonly tokenId: string; | ||
readonly tokenSymbol: string; | ||
readonly tokenDecimals: string; | ||
@@ -11,0 +12,0 @@ readonly available: string; |
@@ -24,2 +24,3 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { | ||
this.tokenId = data.tokenId; | ||
this.tokenSymbol = data.tokenSymbol; | ||
this.tokenDecimals = data.tokenDecimals; | ||
@@ -26,0 +27,0 @@ this.available = data.available; |
@@ -12,5 +12,8 @@ import { SubscriptionCallback, SubscriptionResult } from '@aragon/connect-types'; | ||
readonly tokenId: string; | ||
readonly tokenSymbol: string; | ||
readonly tokenDecimals: string; | ||
readonly amount: string; | ||
readonly actionId: string; | ||
readonly disputableAddress: string; | ||
readonly disputableActionId: string; | ||
readonly actionState: string; | ||
@@ -24,7 +27,8 @@ readonly collateralState: string; | ||
onToken(callback?: SubscriptionCallback<ERC20>): SubscriptionResult<ERC20>; | ||
staking(): Promise<Staking>; | ||
onStaking(callback?: SubscriptionCallback<Staking>): SubscriptionResult<Staking>; | ||
action(): Promise<Action | null>; | ||
staking(): Promise<Staking | null>; | ||
onStaking(callback?: SubscriptionCallback<Staking | null>): SubscriptionResult<Staking | null>; | ||
action(): Promise<Action>; | ||
tryAction(): Promise<Action | null>; | ||
onAction(callback?: SubscriptionCallback<Action | null>): SubscriptionResult<Action | null>; | ||
} | ||
//# sourceMappingURL=StakingMovement.d.ts.map |
@@ -25,5 +25,8 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { | ||
this.tokenId = data.tokenId; | ||
this.tokenSymbol = data.tokenSymbol; | ||
this.tokenDecimals = data.tokenDecimals; | ||
this.amount = data.amount; | ||
this.actionId = data.actionId; | ||
this.disputableAddress = data.disputableAddress; | ||
this.disputableActionId = data.disputableActionId; | ||
this.actionState = data.actionState; | ||
@@ -52,4 +55,11 @@ this.collateralState = data.collateralState; | ||
async action() { | ||
return __classPrivateFieldGet(this, _connector).action(this.actionId || ''); | ||
const action = await this.tryAction(); | ||
if (!action) { | ||
throw Error(`Could not find given action number ${this.actionId}`); | ||
} | ||
return action; | ||
} | ||
async tryAction() { | ||
return __classPrivateFieldGet(this, _connector).action(this.actionId); | ||
} | ||
onAction(callback) { | ||
@@ -56,0 +66,0 @@ return subscription(callback, (callback) => __classPrivateFieldGet(this, _connector).onAction(this.actionId || '', callback)); |
@@ -38,6 +38,6 @@ import { SubscriptionCallback, SubscriptionHandler } from '@aragon/connect-types'; | ||
onCollateralRequirement(collateralRequirementId: string, callback: SubscriptionCallback<CollateralRequirement>): SubscriptionHandler; | ||
staking(stakingId: string): Promise<Staking>; | ||
onStaking(stakingId: string, callback: SubscriptionCallback<Staking>): SubscriptionHandler; | ||
stakingMovements(stakingId: string, agreement: string, first: number, skip: number): Promise<StakingMovement[]>; | ||
onStakingMovements(stakingId: string, agreement: string, first: number, skip: number, callback: SubscriptionCallback<StakingMovement[]>): SubscriptionHandler; | ||
staking(stakingId: string): Promise<Staking | null>; | ||
onStaking(stakingId: string, callback: SubscriptionCallback<Staking | null>): SubscriptionHandler; | ||
stakingMovements(stakingId: string, agreementId: string, first: number, skip: number): Promise<StakingMovement[]>; | ||
onStakingMovements(stakingId: string, agreementId: string, first: number, skip: number, callback: SubscriptionCallback<StakingMovement[]>): SubscriptionHandler; | ||
action(actionId: string): Promise<Action | null>; | ||
@@ -44,0 +44,0 @@ onAction(actionId: string, callback: SubscriptionCallback<Action | null>): SubscriptionHandler; |
@@ -98,9 +98,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { | ||
} | ||
async stakingMovements(stakingId, agreement, first, skip) { | ||
const agreements = [agreement, '0x0000000000000000000000000000000000000000']; | ||
return __classPrivateFieldGet(this, _gql).performQueryWithParser(queries.GET_STAKING_MOVEMENTS('query'), { stakingId, agreements, first, skip }, (result) => parseStakingMovements(result, this)); | ||
async stakingMovements(stakingId, agreementId, first, skip) { | ||
return __classPrivateFieldGet(this, _gql).performQueryWithParser(queries.GET_STAKING_MOVEMENTS('query'), { stakingId, agreementId, first, skip }, (result) => parseStakingMovements(result, this)); | ||
} | ||
onStakingMovements(stakingId, agreement, first, skip, callback) { | ||
const agreements = [agreement, '0x0000000000000000000000000000000000000000']; | ||
return __classPrivateFieldGet(this, _gql).subscribeToQueryWithParser(queries.GET_STAKING_MOVEMENTS('query'), { stakingId, agreements, first, skip }, callback, (result) => parseStakingMovements(result, this)); | ||
onStakingMovements(stakingId, agreementId, first, skip, callback) { | ||
return __classPrivateFieldGet(this, _gql).subscribeToQueryWithParser(queries.GET_STAKING_MOVEMENTS('query'), { stakingId, agreementId, first, skip }, callback, (result) => parseStakingMovements(result, this)); | ||
} | ||
@@ -107,0 +105,0 @@ async action(actionId) { |
@@ -7,3 +7,3 @@ import Action from '../../models/Action'; | ||
} | ||
const { id, agreement, collateralRequirement, disputable, version, disputableActionId, script, context, createdAt } = action; | ||
const { id, agreement, collateralRequirement, disputable, version, disputableActionId, context, createdAt } = action; | ||
return new Action({ | ||
@@ -16,3 +16,2 @@ id, | ||
disputableActionId, | ||
script, | ||
context, | ||
@@ -19,0 +18,0 @@ createdAt |
@@ -8,2 +8,3 @@ import CollateralRequirement from '../../models/CollateralRequirement'; | ||
tokenId: token.id, | ||
tokenSymbol: token.symbol, | ||
tokenDecimals: token.decimals, | ||
@@ -10,0 +11,0 @@ actionAmount, |
import { QueryResult } from '@aragon/connect-thegraph'; | ||
import Staking from '../../models/Staking'; | ||
import StakingMovement from '../../models/StakingMovement'; | ||
export declare function parseStaking(result: QueryResult, connector: any): Staking; | ||
export declare function parseStaking(result: QueryResult, connector: any): Staking | null; | ||
export declare function parseStakingMovements(result: QueryResult, connector: any): StakingMovement[]; | ||
//# sourceMappingURL=staking.d.ts.map |
@@ -6,3 +6,3 @@ import Staking from '../../models/Staking'; | ||
if (!staking) { | ||
throw new Error('Unable to parse staking.'); | ||
return null; | ||
} | ||
@@ -18,2 +18,3 @@ const { id, token, user, total, available, locked, challenged } = staking; | ||
tokenId: token.id, | ||
tokenSymbol: token.symbol, | ||
tokenDecimals: token.decimals, | ||
@@ -28,3 +29,3 @@ }, connector); | ||
return movements.map((movement) => { | ||
const { id, staking, agreement, action, amount, actionState, collateralState, createdAt } = movement; | ||
const { id, staking, agreement, action, disputableActionId, amount, actionState, collateralState, createdAt } = movement; | ||
return new StakingMovement({ | ||
@@ -38,5 +39,8 @@ id, | ||
tokenId: staking.token.id, | ||
tokenSymbol: staking.token.symbol, | ||
tokenDecimals: staking.token.decimals, | ||
actionId: (action ? action.id : null), | ||
agreementId: (agreement ? agreement.id : null), | ||
actionId: action.id, | ||
disputableActionId, | ||
disputableAddress: action.disputable.address, | ||
agreementId: agreement.id | ||
}, connector); | ||
@@ -43,0 +47,0 @@ }); |
@@ -107,2 +107,3 @@ import gql from 'graphql-tag'; | ||
id | ||
symbol | ||
decimals | ||
@@ -120,2 +121,3 @@ } | ||
id | ||
symbol | ||
decimals | ||
@@ -131,6 +133,6 @@ } | ||
export const GET_STAKING_MOVEMENTS = (type) => gql ` | ||
${type} StakingMovements($stakingId: String!, $agreements: [String]!, $first: Int!, $skip: Int!) { | ||
${type} StakingMovements($stakingId: String!, $agreementId: String!, $first: Int!, $skip: Int!) { | ||
stakingMovements(where: { | ||
staking: $stakingId, | ||
agreementId_in: $agreements, | ||
agreement: $agreementId, | ||
}, orderBy: createdAt, orderDirection: asc, first: $first, skip: $skip) { | ||
@@ -142,2 +144,3 @@ id | ||
id | ||
symbol | ||
decimals | ||
@@ -151,2 +154,6 @@ } | ||
id | ||
disputableActionId | ||
disputable { | ||
address | ||
} | ||
} | ||
@@ -177,3 +184,2 @@ amount | ||
disputableActionId | ||
script | ||
context | ||
@@ -180,0 +186,0 @@ createdAt |
@@ -37,2 +37,3 @@ import { SubscriptionCallback, SubscriptionHandler } from '@aragon/connect-types'; | ||
tokenId: string; | ||
tokenSymbol: string; | ||
tokenDecimals: string; | ||
@@ -68,3 +69,2 @@ actionAmount: string; | ||
context: string; | ||
script: string; | ||
createdAt: string; | ||
@@ -76,2 +76,3 @@ } | ||
tokenId: string; | ||
tokenSymbol: string; | ||
tokenDecimals: string; | ||
@@ -86,2 +87,3 @@ available: string; | ||
tokenId: string; | ||
tokenSymbol: string; | ||
tokenDecimals: string; | ||
@@ -92,2 +94,4 @@ stakingId: string; | ||
actionId: string; | ||
disputableAddress: string; | ||
disputableActionId: string; | ||
actionState: string; | ||
@@ -117,4 +121,4 @@ collateralState: string; | ||
onAction(actionId: string, callback: SubscriptionCallback<Action | null>): SubscriptionHandler; | ||
staking(stakingId: string): Promise<Staking>; | ||
onStaking(stakingId: string, callback: SubscriptionCallback<Staking>): SubscriptionHandler; | ||
staking(stakingId: string): Promise<Staking | null>; | ||
onStaking(stakingId: string, callback: SubscriptionCallback<Staking | null>): SubscriptionHandler; | ||
stakingMovements(stakingId: string, agreement: string, first: number, skip: number): Promise<StakingMovement[]>; | ||
@@ -121,0 +125,0 @@ onStakingMovements(stakingId: string, agreement: string, first: number, skip: number, callback: SubscriptionCallback<StakingMovement[]>): SubscriptionHandler; |
{ | ||
"name": "@aragon/connect-agreement", | ||
"version": "0.0.0-beta.11", | ||
"version": "0.0.0-beta.12", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "license": "LGPL-3.0-or-later", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1498014
3179