88 Transaction ,
99} from '@wharfkit/antelope'
1010import type { Fetch , LocaleDefinitions } from '@wharfkit/common'
11- import { SigningRequest } from '@wharfkit/signing-request'
11+ import { SigningRequest , PlaceholderAuth } from '@wharfkit/signing-request'
1212import { TransactArgs , TransactPlugin } from './transact'
1313import { WalletPlugin } from './wallet'
1414
@@ -139,6 +139,9 @@ export function extractActions(args: TransactArgs): AnyAction[] {
139139
140140/**
141141 * Check if an action has an authorization matching a given permission level.
142+ * Also matches PlaceholderAuth (actor: '............1', permission: '............2')
143+ * because willUseSessionKey() is called before placeholders are resolved,
144+ * and we need to detect if the action would match after resolution.
142145 *
143146 * @param action AnyAction
144147 * @param permissionLevel PermissionLevel
@@ -148,15 +151,17 @@ export function actionMatchesPermission(
148151 action : AnyAction ,
149152 permissionLevel : PermissionLevel
150153) : boolean {
151- return action . authorization . some ( ( auth : PermissionLevelType ) => permissionLevel . equals ( auth ) )
154+ return action . authorization . some (
155+ ( auth : PermissionLevelType ) => permissionLevel . equals ( auth ) || PlaceholderAuth . equals ( auth )
156+ )
152157}
153158
154159function rewriteAuthIfMatches (
155160 auth : PermissionLevelType ,
156161 permissionLevel : PermissionLevel ,
157162 newPermission : Name
158163) : PermissionLevelType {
159- if ( permissionLevel . equals ( auth ) ) {
164+ if ( permissionLevel . equals ( auth ) || PlaceholderAuth . equals ( auth ) ) {
160165 return PermissionLevel . from ( {
161166 actor : permissionLevel . actor ,
162167 permission : newPermission ,
0 commit comments