Skip to content

Commit

Permalink
refactor: migrate wallet wasm into sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Mar 19, 2024
1 parent 5441e7d commit 551ac0c
Show file tree
Hide file tree
Showing 23 changed files with 552 additions and 571 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ runs:
registry-url: https://registry.npmjs.org
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21.7'
- uses: acifani/setup-tinygo@v2
with:
tinygo-version: '0.30.0'
Expand Down
2 changes: 1 addition & 1 deletion apps/walletd/hooks/useSyncStatus.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { hoursInMilliseconds } from '@siafoundation/design-system'
import { useAppSettings } from '@siafoundation/react-core'
import { ConsensusState } from '@siafoundation/types'
import {
ConsensusState,
useConsensusTip,
useConsensusTipState,
useEstimatedNetworkBlockHeight,
Expand Down
3 changes: 2 additions & 1 deletion apps/walletd/lib/signSeed.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ConsensusState, ConsensusNetwork } from '@siafoundation/react-walletd'
import {
SiacoinElement,
Transaction,
SiafundElement,
ConsensusState,
ConsensusNetwork,
} from '@siafoundation/types'
import { getWalletWasm } from './wasm'
import { AddressData } from '../contexts/addresses/types'
Expand Down
4 changes: 2 additions & 2 deletions go.work
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
go 1.20
go 1.21.7

use (
./
./hostd
./renterd
./walletd
./sdk
./walletd
)
6 changes: 6 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.etcd.io/gofail v0.1.0/go.mod h1:VZBCXYGZhHAinaBiiqYvuDynvahNsAyLFwB3kEHKz1M=
go.sia.tech/mux v1.2.0/go.mod h1:Yyo6wZelOYTyvrHmJZ6aQfRoer3o4xyKQ4NmQLJrBSo=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
10 changes: 3 additions & 7 deletions libs/react-walletd/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
useDeleteFunc,
} from '@siafoundation/react-core'
import {
ConsensusState,
ConsensusNetwork,
Currency,
BlockHeight,
ChainIndex,
Expand All @@ -20,13 +22,7 @@ import {
SiafundElement,
Transaction,
} from '@siafoundation/types'
import {
ConsensusState,
ConsensusNetwork,
PoolTransaction,
WalletEvent,
GatewayPeer,
} from './siaTypes'
import { PoolTransaction, WalletEvent, GatewayPeer } from './siaTypes'

// consensus

Expand Down
57 changes: 0 additions & 57 deletions libs/react-walletd/src/siaTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,63 +9,6 @@ import {
FileContractElement,
} from '@siafoundation/types'

export type ConsensusNetwork = {
name: 'mainnet' | 'zen'
initialCoinbase: Currency
minimumCoinbase: Currency
initialTarget: string
hardforkDevAddr: {
height: number
oldAddress: string
newAddress: string
}
hardforkTax: {
height: number
}
hardforkStorageProof: {
height: number
}
hardforkOak: {
height: number
fixHeight: number
genesisTimestamp: string
}
hardforkASIC: {
height: number
oakTime: number
oakTarget: string
}
hardforkFoundation: {
height: number
primaryAddress: string
failsafeAddress: string
}
hardforkV2: {
allowHeight: number
requireHeight: number
}
}

export type ConsensusState = {
index: ChainIndex
prevTimestamps: string[]
depth: string
childTarget: string
siafundPool: string
oakTime: number
oakTarget: string
foundationPrimaryAddress: string
foundationFailsafeAddress: string
totalWork: string
difficulty: string
oakWork: string
elements: {
numLeaves: number
trees: string[]
}
attestations: number
}

export type GatewayPeer = {
addr: string
inbound: boolean
Expand Down
1 change: 0 additions & 1 deletion libs/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"description": "SDK for interacting directly with the Sia network from browsers and web clients.",
"version": "0.0.2",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"undici": "5.28.3"
},
Expand Down
Loading

0 comments on commit 551ac0c

Please sign in to comment.