This specification introduces a backwards-compatible extension to SNIP-24 that adds "blanket" permits, which allow the permit holder to use them with any compatible token. The idea is that a user signs a single message to grant an application permission to query all current and future SNIP tokens.
The revised PermitMsg
schema is defined as:
export type PermitMsg = {
type: 'query_permit';
value: {
permit_name: string;
allowed_tokens: `secret1${string}`[] | ['ANY_TOKEN'];
permissions: (
| 'balance' // ability to query balance
| 'history' // ability to query histories
| 'allowance' // ability to query allowances
| 'owner' // ability to query everything
| string // custom permissions defined by contract
)[];
created?: Iso8601UtcDateTime; // {YYYY}-{MM}-{DD}T{hh}:{mm}:{ss}.{uuu}Z
expires?: Iso8601UtcDateTime;
};
};
The changes to the schema are summarized as:
"ANY_TOKEN"
as the single item in the allowed_tokens
listcreated
for when this message was signedexpires
for when this permit shall no longer be validcreated
Permits using the "ANY_TOKEN"
keyword MUST include a value for created
. For all other cases, the created
and expires
fields are encouraged but optional.
Revokes all permits. Client can supply a datetime for created_after
, created_before
, both, or neither.
created_before
โ makes it so any permits using a created
value less than this datetime will be rejectedcreated_after
โ makes it so any permits using a created
value greater than this datetime will be rejectedcreated_before
and created_after
โ makes it so any permits using a created
value between these two datetimes will be rejected"REVOKED_ALL"
. this action is idempotentContract implementors MAY enforce an upper bound on the number of revocations an account is allowed to make. If an attempt is made to exceed this limit, the contract MUST throw an error.
export type RevokeAllPermitsExecutionRequest = {
revoke_all_permits: {
interval?: {
// both specified in seconds since unix epoch
created_before?: Uint64Str;
created_after?: Uint64Str;
};
};
}
export type RevokeAllPermitsExecutionResponse = {
revoke_all_permits: {
status: "success";
revocation_id?: string; // if a new revocation was created
};
};
Deletes a previously issued permit revocation.
export type DeletePermitRevocationExecutionRequest = {
delete_permit_revocation: {
revocation_id: string;
};
};
export type DeletePermitRevocationExecutionResponse = {
delete_permit_revocation: {
status: "success";
};
};
Enumerates permit revocations that have been previously made.
export type ListPermitRevocationsQueryRequest = {
list_permit_revocations: {
page_size?: number;
page?: number;
};
};
export type ListPermitRevocationsQueryResponse = {
list_permit_revocations: {
revocations: Array<{
revocation_id: string;
interval: {
// both specified in seconds since unix epoch
created_before?: Uint64Str;
created_after?: Uint64Str;
};
}>;
};
};
The contract shall enforce the following additional rules when verifying query permits:
created
is specified:
expires
is specified:
allowed_tokens
list includes an item "ANY_TOKEN"
:
1
created
is specified