-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
329d4a2
commit ea37241
Showing
39 changed files
with
962 additions
and
529 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@siafoundation/sdk': minor | ||
--- | ||
|
||
Updated SDK to latest core changes, updated structure. |
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,6 @@ | ||
GITHUB_TOKEN=secret_token | ||
NOTION_TOKEN=secret_token | ||
ASSETS=/User/bob/web/assets | ||
|
||
# Make Go use UTC for time formatting | ||
TZ=UTC |
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
File renamed without changes.
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,2 +1,2 @@ | ||
export * from './init' | ||
export * from './types' | ||
export * from './wasm' |
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,7 @@ | ||
import { getSDK } from './sdk' | ||
import { initWASM } from './wasm' | ||
|
||
export async function initSDK() { | ||
await initWASM() | ||
return getSDK() | ||
} |
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,7 @@ | ||
import { getSDK } from './sdk' | ||
import { initWASMTest } from './wasmTest' | ||
|
||
export async function initSDKTest() { | ||
await initWASMTest() | ||
return getSDK() | ||
} |
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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
type Currency = string | ||
type Signature = string | ||
type Address = string | ||
type Hash256 = string // 32 bytes | ||
type AccountID = string // 16 bytes | ||
|
||
export type HostPrices = { | ||
contractPrice: Currency | ||
collateral: Currency | ||
storagePrice: Currency | ||
ingressPrice: Currency | ||
egressPrice: Currency | ||
tipHeight: number | ||
validUntil: string | ||
signature: Signature | ||
} | ||
|
||
export type NetAddress = { | ||
protocol: string | ||
address: string | ||
} | ||
|
||
export type HostSettings = { | ||
version: Uint8Array // 3 bytes | ||
netAddresses: NetAddress[] | ||
walletAddress: Address // 32 bytes | ||
acceptingContracts: boolean | ||
maxCollateral: Currency | ||
maxDuration: number | ||
remainingStorage: number | ||
totalStorage: number | ||
prices: HostPrices | ||
} | ||
|
||
export type RPCSettingsRequest = void | ||
|
||
export type RPCSettingsResponse = { | ||
settings: HostSettings | ||
} | ||
|
||
export type RPCSettings = { | ||
request: RPCSettingsRequest | ||
response: RPCSettingsResponse | ||
} | ||
|
||
export type RPCReadSectorRequest = { | ||
prices: HostPrices | ||
accountId: AccountID // 16 bytes | ||
root: Hash256 // 32 bytes - types.Hash256 | ||
offset: number // uint64 | ||
length: number // uint64 | ||
} | ||
|
||
export type RPCReadSectorResponse = { | ||
proof: Hash256[] // 32 bytes each - types.Hash256 | ||
sector: Uint8Array // []byte | ||
} | ||
|
||
export type RPCReadSector = { | ||
request: RPCReadSectorRequest | ||
response: RPCReadSectorResponse | ||
} | ||
|
||
export type RPCWriteSectorRequest = { | ||
prices: HostPrices | ||
accountId: AccountID // 16 bytes | ||
sector: Uint8Array // []byte - extended to SectorSize by host | ||
} | ||
|
||
export type RPCWriteSectorResponse = { | ||
root: Hash256 // 32 bytes - types.Hash256 | ||
} | ||
|
||
export type RPCWriteSector = { | ||
request: RPCWriteSectorRequest | ||
response: RPCWriteSectorResponse | ||
} | ||
|
||
export type RPC = RPCSettings | RPCReadSector | RPCWriteSector |
File renamed without changes.
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,11 @@ | ||
import { WebTransportClient } from './transport' | ||
import { WASM } from './types' | ||
|
||
export function getSDK() { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const wasm = (global as any).sia as WASM | ||
return { | ||
wasm, | ||
WebTransportClient, | ||
} | ||
} |
Oops, something went wrong.