Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace hard coded default-url #58

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/utils/multi-sign.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ test('first multi sign', async () => {
receiverAddress,
amount,
]
const nodeUrl = 'http://localhost:9850'
const nodeUrl = JsonRpcProvider.defaultUrl()
const chainId = 254
const scriptFunction = await encodeScriptFunctionByResolve(functionId, typeArgs, args, nodeUrl);

Expand Down Expand Up @@ -256,14 +256,14 @@ still require ${ threshold - count_signatures } signatures
})

test('second multi sign', async () => {
// 2.2 alice 拿到上述的交易文件后,在自己的 starcoin cosole 中签名
// 2.2 alice 拿到上述的交易文件后,在自己的 starcoin console 中签名
// starcoin% account sign-multisig-txn /Users/starcoin/projects/starcoinorg/starcoin/5e764f83.multisig-txn
// mutlisig txn(address: 0xdec266f6749fa0b193f3a7f89d3cd9f2, threshold: 2): 2 signatures collected
// enough signatures collected for the multisig txn, txn can be submitted now
// {
// "ok": "/Users/starcoin/projects/starcoinorg/starcoin/194d547f.multisig-txn"
// }
// 该命令会用多签账户(由alice的私钥生成)的私钥签名生成另一个交易文件,该交易同时包含有 tom 和 alice 的签名。
// 该命令会用多签账户(由alice的私钥生成)的私钥签名生成另一个交易文件,该交易同时包含有 tom 和 alice 的签名。
// 返回信息提示用户,该多签交易已经收集到足够多的签名,可以提交到链上执行了。
const rbuf = readFileSync("4d6e1867.multisig-txn");
console.log(hexlify(rbuf));
Expand All @@ -281,7 +281,7 @@ test('second multi sign', async () => {
console.log(existingAuthenticator.signature.signatures)
const count_signatures = existingAuthenticator.signature.signatures.length
expect(existingAuthenticator.public_key.threshold).toEqual(2);
console.log(`is_enough: ${ count_signatures >= threshold },
console.log(`is_enough: ${ count_signatures >= threshold },
threshold= ${ threshold }
${ count_signatures } signatures collected, still require ${ threshold - count_signatures } signatures
`)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/signed-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export async function recoverSignedMessageAddress(signedMessageHex: string): Pro
// const rawMessageHex = hexlify(rawMessageBytes)
// const rawMessage = Buffer.from(stripHexPrefix(rawMessageHex), 'hex').toString('utf8')

let address
let address: string

if (signedMessage.authenticator instanceof TransactionAuthenticatorVariantEd25519) {
const signatureBytes = signedMessage.authenticator.signature.value;
Expand Down