Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wax
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
wax
Merge requests
!282
Add signature providers
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add signature providers
tm-sign-ext
into
develop
Overview
0
Commits
40
Pipelines
46
Changes
7
Merged
Mateusz Tyszczak
requested to merge
tm-sign-ext
into
develop
1 month ago
Overview
0
Commits
40
Pipelines
46
Changes
7
Expand
Requires:
common-ci-configuration!75 (merged)
Edited
3 weeks ago
by
Bartek Wrona
0
0
Merge request reports
Viewing commit
6958c713
Show latest version
7 files
+
120
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
6958c713
Add signature provider example based on our extensions
· 6958c713
Mateusz Tyszczak
authored
1 month ago
examples/ts/signature-extension/test/index.html
0 → 100644
+
57
−
0
Options
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
</head>
<body>
<h1>
Signing example
</h1>
<h3>
Remember to unlock Peak Vault before using it
</h3>
<button
onclick=
"useKeychain()"
>
Use Keychain
</button>
<button
onclick=
"usePeakVault()"
>
Use Peak Vault
</button>
<pre><code
id=
"tx-result"
></code></pre>
<script
type=
"module"
>
import
{
createHiveChain
}
from
"
@hiveio/wax
"
;
import
{
accountName
,
publicKey
,
voteData
}
from
"
../common-data
"
;
import
KeychainProvider
from
"
@hiveio/wax-signers-keychain
"
;
import
PeakVaultProvider
from
"
@hiveio/wax-signers-peakvault
"
;
const
txResult
=
document
.
getElementById
(
'
tx-result
'
);
(
async
()
=>
{
const
keychainProvider
=
KeychainProvider
.
for
(
accountName
,
"
posting
"
);
const
peakVaultProvider
=
PeakVaultProvider
.
for
(
accountName
,
"
posting
"
);
const
chain
=
await
createHiveChain
();
const
createTransaction
=
async
()
=>
{
txResult
.
textContent
=
'
Signing...
'
;
const
tx
=
await
chain
.
createTransaction
();
tx
.
pushOperation
({
vote
:
voteData
});
console
.
log
(
tx
.
transaction
);
console
.
log
(
`Sig digest:
${
tx
.
sigDigest
}
`
);
return
tx
;
};
const
sign
=
async
(
provider
)
=>
{
try
{
const
tx
=
await
createTransaction
();
await
tx
.
sign
(
provider
);
const
apiJson
=
tx
.
toApiJson
();
console
.
log
(
'
Transaction:
'
,
apiJson
);
console
.
log
(
`Keys match:
${
tx
.
signatureKeys
[
0
]
===
publicKey
}
`
);
txResult
.
textContent
=
JSON
.
stringify
(
apiJson
,
null
,
2
);
}
catch
(
error
)
{
console
.
error
(
error
);
txResult
.
textContent
=
`Error:
${
error
.
message
}
`
;
}
};
window
.
useKeychain
=
()
=>
void
sign
(
keychainProvider
);
window
.
usePeakVault
=
()
=>
void
sign
(
peakVaultProvider
);
})();
</script>
</body>
</html>
Loading