Skip to content

Commit

Permalink
fix: farm create mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanVerstraete committed Aug 22, 2022
1 parent f87b45d commit bb3f742
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 157 deletions.
1 change: 1 addition & 0 deletions src/types/v63.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export interface Farm {
pricingPolicyId: number
certification: FarmCertification
publicIps: PublicIP[]
dedicatedFarm: boolean
farmingPolicyLimits: (FarmingPolicyLimit | undefined)
}

Expand Down
34 changes: 8 additions & 26 deletions src/typesDevnet/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,31 +612,22 @@ export class TfgridModuleFarmStoredEvent {
}

get isV63(): boolean {
return this.ctx._chain.getEventHash('tfgridModule.FarmStored') === 'ca41d591947edffabc4e5a891ad112debc48b2e676350f6208a4cb6eb13f4627'
return this.ctx._chain.getEventHash('tfgridModule.FarmStored') === '74b71e5fe3d2ea0881a33f99511ab05ec0233a16d23bc46f38fa69f638b7abe8'
}

get asV63(): v63.Farm {
assert(this.isV63)
return this.ctx._chain.decodeEvent(this.ctx.event)
}

get isV101(): boolean {
return this.ctx._chain.getEventHash('tfgridModule.FarmStored') === '74b71e5fe3d2ea0881a33f99511ab05ec0233a16d23bc46f38fa69f638b7abe8'
}

get asV101(): v101.Farm {
assert(this.isV101)
return this.ctx._chain.decodeEvent(this.ctx.event)
}

get isLatest(): boolean {
deprecateLatest()
return this.isV101
return this.isV63
}

get asLatest(): v101.Farm {
get asLatest(): v63.Farm {
deprecateLatest()
return this.asV101
return this.asV63
}
}

Expand Down Expand Up @@ -664,31 +655,22 @@ export class TfgridModuleFarmUpdatedEvent {
}

get isV63(): boolean {
return this.ctx._chain.getEventHash('tfgridModule.FarmUpdated') === 'ca41d591947edffabc4e5a891ad112debc48b2e676350f6208a4cb6eb13f4627'
return this.ctx._chain.getEventHash('tfgridModule.FarmUpdated') === '74b71e5fe3d2ea0881a33f99511ab05ec0233a16d23bc46f38fa69f638b7abe8'
}

get asV63(): v63.Farm {
assert(this.isV63)
return this.ctx._chain.decodeEvent(this.ctx.event)
}

get isV101(): boolean {
return this.ctx._chain.getEventHash('tfgridModule.FarmUpdated') === '74b71e5fe3d2ea0881a33f99511ab05ec0233a16d23bc46f38fa69f638b7abe8'
}

get asV101(): v101.Farm {
assert(this.isV101)
return this.ctx._chain.decodeEvent(this.ctx.event)
}

get isLatest(): boolean {
deprecateLatest()
return this.isV101
return this.isV63
}

get asLatest(): v101.Farm {
get asLatest(): v63.Farm {
deprecateLatest()
return this.asV101
return this.asV63
}
}

Expand Down
43 changes: 6 additions & 37 deletions src/typesDevnet/v101.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@ export interface Contract {
contractType: ContractData
}

export interface Farm {
version: number
id: number
name: Uint8Array
twinId: number
pricingPolicyId: number
certification: FarmCertification
publicIps: PublicIP[]
dedicatedFarm: boolean
farmingPolicyLimits: (FarmingPolicyLimit | undefined)
}

export interface Node {
version: number
id: number
Expand Down Expand Up @@ -115,31 +103,6 @@ export interface ContractData_RentContract {
value: RentContract
}

export type FarmCertification = FarmCertification_NotCertified | FarmCertification_Gold

export interface FarmCertification_NotCertified {
__kind: 'NotCertified'
}

export interface FarmCertification_Gold {
__kind: 'Gold'
}

export interface PublicIP {
ip: Uint8Array
gateway: Uint8Array
contractId: bigint
}

export interface FarmingPolicyLimit {
farmingPolicyId: number
cu: (bigint | undefined)
su: (bigint | undefined)
end: (bigint | undefined)
nodeCount: (number | undefined)
nodeCertification: boolean
}

export interface Resources {
hru: bigint
sru: bigint
Expand Down Expand Up @@ -238,3 +201,9 @@ export interface Unit_Gigabytes {
export interface Unit_Terrabytes {
__kind: 'Terrabytes'
}

export interface PublicIP {
ip: Uint8Array
gateway: Uint8Array
contractId: bigint
}
1 change: 1 addition & 0 deletions src/typesDevnet/v63.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface Farm {
pricingPolicyId: number
certification: FarmCertification
publicIps: PublicIP[]
dedicatedFarm: boolean
farmingPolicyLimits: (FarmingPolicyLimit | undefined)
}

Expand Down
6 changes: 6 additions & 0 deletions typegenDevnet/tfchainVersions.json

Large diffs are not rendered by default.

Loading

0 comments on commit bb3f742

Please sign in to comment.