Skip to content

Instantly share code, notes, and snippets.

@aaroncox
Last active February 14, 2025 17:37
Show Gist options
  • Save aaroncox/102a70a9a6a37a9c2a90b6fabfbc86e7 to your computer and use it in GitHub Desktop.
Save aaroncox/102a70a9a6a37a9c2a90b6fabfbc86e7 to your computer and use it in GitHub Desktop.
Using a custom authority provider within eosjs for Greymass Fuel
// A custom cosigner AuthorityProvider for EOSJS v2
// This provider overrides the checks on all keys,
// allowing a partially signed transaction to be
// broadcast to the API node.
class CosignAuthorityProvider {
async getRequiredKeys(args) {
const { transaction } = args;
// Iterate over the actions and authorizations
transaction.actions.forEach((action, ti) => {
action.authorization.forEach((auth, ai) => {
// If the authorization matches the expected cosigner
// then remove it from the transaction while checking
// for what public keys are required
if (
auth.actor === 'greymassfuel'
&& auth.permission === 'cosign'
) {
delete transaction.actions[ti].authorization.splice(ai, 1)
}
})
});
return convertLegacyPublicKeys((await rpc.fetch('/v1/chain/get_required_keys', {
transaction,
available_keys: args.availableKeys,
})).required_keys);
}
}
// Pass in new authorityProvider
const api = new Api({
authorityProvider: new CosignAuthorityProvider(),
// the rest of your configuration
});
@ttb-inc
Copy link

ttb-inc commented Feb 14, 2025

Hi,
I'm using the Anchor mobile app on UNICOVE.
Why am I getting this error?
What is the workaround?


Error: transaction declares authority
'{"actor":"greymassfuel","permission":"cosign"}',
but does not have signatures for it under a provided delay of 0 ms,
provided permissions [],
provided keys ["EOS8gGT...dkGL"],
and a delay max limit of 3888000000 ms

Thanks a lot.

@aaroncox
Copy link
Author

I'm not sure why that would be appearing without more details. If you could shoot an email over to [email protected] and let us know which page you were on and what action you were trying to perform when that error appeared, it'd help us track things down. Thanks!

@ttb-inc
Copy link

ttb-inc commented Feb 14, 2025

Thank you for your response.
I will reorganize and send you an email.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment