TODO
- make ready to go public
- npm registry
- release cycles
Function Migration Progress
- DONE: 16
- PENDING: 5
- TODO: 35
crypto:
- DONE
binToHex
- DONE
hexToBin
- DONE
base64UrlEncode
- DONE
base64UrlDecode
- DONE
base64UrlEncodeArr
- DONE
base64UrlDecodeArr
- DONE
strToUint8Array
- DONE
uint8ArrayToStr
- DONE
hash
- DONE
hashBin
- DONE
genKeyPair
- DONE
restoreKeyPairFromSecretKey
- DONE
sign
- DONE
signHash
- DONE
verifySig
- DONE
toTweetNaclSecretKey
api:
- PENDING
createSendRequest
:- Omitted, it just wrapped a list of Commands into the expected format for the
/send
endpoint.ISendRequestBody
type created instead.
- Omitted, it just wrapped a list of Commands into the expected format for the
- DONE
prepareContCommand
:- Puts together and signs a continuation payload
Command
.
- Puts together and signs a continuation payload
- DONE
prepareExecCommand
:- Puts together and signs an exec payload
Command
.
- Puts together and signs an exec payload
- PENDING
createCommand
:- Puts together a
Command
type from a list of signatures and a stringified payload. Also checks that the signatures are for correct hash. - Pending for renaming, formally mkSingleCmd.
- Puts together a
- DONE
createContCommand
:- A wrapper for a
mkPublicSend
andprepareContCmd
call. Could potentially be omitted.
- A wrapper for a
- DONE
createExecCommand
:- A wrapper for a
mkPublicSend
andprepareExecCmd
call. Could potentially be omitted.
- A wrapper for a
- PENDING
createLocalCommand
:- Wrapper for
prepareExecCmd
. The request type forlocal
endpoint is just a singleCommand
. Could be omitted, but the naming here does provides extra clarity.
- Wrapper for
- DONE
createPollRequest
:- Prepares a
/poll
endpoint request type (i.e. a list of request keys) from a{cmds: [Command]}
type (i.e. the type of the/send
endpoint). Ignore naming/docs that imply theCommand
should have an exec payload.
- Prepares a
- DONE
createListenRequest
:- Prepares a
/listen
endpoint request type. Similar tocreatePollRequest
, but only uses the first request key.
- Prepares a
- DONE
attachSignature
:- API Helper function that attaches signed or unsigned signature from a keypair and stringified payload.
- DONE
pullAndCheckHashs
:- API Helper function maps through signatures and make sure that the signatures are signing the same hash and pulls the hash.
- DONE
pullSignature
:- API Helper function that pulls signature only object from signature with
hash object
{hash, pubKey, sig}
- API Helper function that pulls signature only object from signature with
hash object
- DONE
pullSigner
:- API Helper function that pulls public key and capability list if it exists.
lang:
- PENDING
mkExp
- PENDING
mkMeta
- PENDING
mkCap
:- Returns a
SigningCap
, which contains a regular Pact capability and some added fields consumed by chainweaver.
- Returns a
fetch:
- PENDING
send
- TODO
local
- TODO
poll
- TODO
listen
- TODO
spv
wallet:
- TODO
sign
:- Sends an enriched
Command
payload to the signing API of the Chainweaver wallet.
- Sends an enriched
- TODO
sendSigned
:- Very similar to
fetch.send
function, but expects a singleCommand
instead of a list of them. Could be omitted.
- Very similar to
- DONE
createCap
- Returns a
SigningCap
, which contains a regular Pact capability and some added fields consumed by chainweaver.
- Returns a
cut:
- TODO
current
:- Queries a chainweb node's
/cut
endpoint. Uses retry.
- Queries a chainweb node's
event:
- TODO
range
:- Calls the
blocks
function, which eventually callsbranchPage
function.
- Calls the
- TODO
recent
:- Similar to
event.range
, but callsrecentBlocks
instead.
- Similar to
- TODO
stream
- TODO
height
:- Similar to
range
but filters for a specific block height.
- Similar to
- TODO blockHash:
- Queries
blockByBlockHash
and filters for the events produced by that block.
- Queries
SigData:
-
DONE
mkCap
:- Similar to pact-lang's
mkCap
function, but this one creates a regular Pact capability.
- Similar to pact-lang's
-
TODO
mkMeta
:- Identical to pact-lang's
mkMeta
. Can be omitted.
- Identical to pact-lang's
-
TODO
mkSignerCList
:- Returns the capability and signer's public key in the format expected in the
signers
field ofSigBuilder
.
- Returns the capability and signer's public key in the format expected in the
-
TODO
mkSignerGas
:- Calls
mkSignerCList
with gas capability.
- Calls
-
TODO
mkSignerUnrestricted
:- Similar to
mkSignerCList
but without caps (hence an unrestricted signer).
- Similar to
-
TODO
mkExecPayload
:- Prepares an exec payload for the
cmd
field of theSigData
type.
- Prepares an exec payload for the
-
TODO
mkContPayload
:- Prepares a continuation payload for the
cmd
field of theSigData
type.
- Prepares a continuation payload for the
-
TODO
mkSigData
-
util:
- TODO
gasCap
: Gas capability. - TODO
addGasCap
:- Adds a gas capbility to a list of capabilities. Uses
gasCap
.
- Adds a gas capbility to a list of capabilities. Uses
- TODO
mergeSigners
:- Combines multiple signer arrays created by the
mkSigner*
functions. Used bySigBuilder
.
- Combines multiple signer arrays created by the
- TODO
autoCreationTime
:- Gets the system's local time in the format expected by
creation-time
fields in transactions.
- Gets the system's local time in the format expected by
- TODO
autoNonce
:- Stringifies the current date as an easy way to set a default nonce.
- TODO
pubKeysFromSigners
:- Gets public key from signers created by
mkSigner*
functions.
- Gets public key from signers created by
- TODO
-
ex:
- TODO
execCmdExample1
:- Creates an example exec transaction that can be sent to the wallet for signing. Could be omitted.
- TODO
contCmdExample1
:- Creates an example continuation transaction that can be sent to the wallet for signing. Could be omitted.
- TODO
-
debug
- DONE
toggleDebug
: Omitted.
- DONE
Enhacements
(1) Auto detection of network versions
Problem:
(A) When querying a chainweb node, the server expects the endpoint to have a specific format. For example:
http://localhost:8080/chainweb/0.0/development/chain/1/pact
In the above, 0.0
represents the node API Version and could change later on.
Also, development
represents the version of Chainweb that the node is running.
Other possible values are testnet04
and mainnet01
. Both of these pieces of
information is returned by querying the /info
endpoint. For example:
http://localhost:8080/info
(B) The Chainweb node version (i.e. development
) is a required field in a
transaction's payload. An error is thrown if the network specified in the
transaction payload does not match the network version specified in the endpoint
prefix (i.e. ../0.0/development/chain..
).
It is an error prone user experience to have users pass along a node's version information along with the hostname, especially if this information is easily autodected.
Proposal:
Doug outlines an approach in KadenaPorcelain where network (i.e.
pact-server, Chainweb mainnet, Chainweb testnet) and other version specific data
(i.e. Chainweb's 0.0
version) is autodetected. This is done by querying the
/info
endpoint for Chainweb nodes and the /version
endpoint for pact-server.
This network and version information is then passed to functions that construct transactions and functions that call the different Pact API endpoints.