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

Minor version 1.1 #386

Draft
wants to merge 67 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
6965590
Revert "Revert "Add v3 Transaction Types""
pcowgill May 29, 2024
4457037
1.1 draft
pcowgill May 29, 2024
ad952b2
Merge pull request #384 from Once-Upon/revert-383-revert-382-v3-types
pcowgill May 29, 2024
f41dd96
Merge pull request #385 from Once-Upon/preminor/1.1
pcowgill May 29, 2024
a9b659e
change property name
cdt-eth Jun 3, 2024
c55dba1
update context object
guscost Jun 18, 2024
08f18fa
construct id from enum values
guscost Jun 18, 2024
906c06e
stricter type for id field
guscost Jun 18, 2024
86ff4e6
update type for ContextActionFull use case
guscost Jun 18, 2024
227cfda
finish basepaint update
guscost Jun 18, 2024
d3aaf70
protocol map w/ basepaint and bns
guscost Jun 18, 2024
56c7fc1
finish bns updates
guscost Jun 18, 2024
dc0f421
boombox
guscost Jun 18, 2024
d2daf20
claim
guscost Jun 18, 2024
dcb700c
cryptopunks
guscost Jun 18, 2024
d180e9b
disperse
guscost Jun 18, 2024
0562aae
EAS
guscost Jun 18, 2024
4abe84e
ens
guscost Jun 18, 2024
d776558
farcaster & warpcast
guscost Jun 18, 2024
1ecda35
fren pet
guscost Jun 18, 2024
4b86307
one more
guscost Jun 18, 2024
e27b7d4
friend tech
guscost Jun 18, 2024
88a8afb
leeroy
guscost Jun 18, 2024
845491f
nouns
guscost Jun 18, 2024
3c495c4
uniswap
guscost Jun 18, 2024
6e09be7
WETH
guscost Jun 18, 2024
6c032f6
heuristic contextualizers too
guscost Jun 18, 2024
10c4061
bridge txs
guscost Jun 18, 2024
51b7458
gold
guscost Jun 18, 2024
20d9860
nouns builder and superchain faucet
guscost Jun 18, 2024
9183301
Update src/types/contextAction/index.ts
guscost Jun 20, 2024
d755236
actions key on transaction
guscost Jun 20, 2024
2b26f79
nested actions array
guscost Jun 20, 2024
651bd67
across action
guscost Jun 20, 2024
7e54654
codemod and cryptopunks
guscost Jun 20, 2024
204f9e6
codemod for all actions arrays
guscost Jun 20, 2024
18d749b
superchain faucet
guscost Jun 20, 2024
9d274b7
nouns governor
guscost Jun 20, 2024
5c9f233
nouns dao
guscost Jun 20, 2024
20f1247
heuristic contextualizer action array
guscost Jun 20, 2024
7da3992
prettier
guscost Jun 20, 2024
33fd53f
remove duplicates
guscost Jun 20, 2024
0872ed0
Merge pull request #387 from Once-Upon/gus/update-context-object-stru…
pcowgill Jun 20, 2024
1f29d65
Fix builds
pcowgill Jun 20, 2024
bfda023
Merge pull request #389 from Once-Upon/feature/fix-build
pcowgill Jun 20, 2024
b2f3b94
1.1 with actions
pcowgill Jun 20, 2024
f39655a
Merge pull request #390 from Once-Upon/feature/1.1.0-1
pcowgill Jun 20, 2024
4e3de85
Merge branch 'main' into 1.1
pcowgill Jun 21, 2024
d665499
universal actions still indexed for protocol-specific versions
guscost Jun 21, 2024
53cc1d4
update heuristic actions with prefixed version
guscost Jun 21, 2024
2ba437a
prettier
guscost Jun 21, 2024
c4d3a4d
prettier again
guscost Jun 21, 2024
bd0a465
switch order of protocol-scoped actions
guscost Jun 21, 2024
9ef7833
zora, rodeo, highlight
guscost Jun 21, 2024
38a31ea
Merge pull request #392 from Once-Upon/feature/ou-2394-protocol-scopi…
pcowgill Jun 21, 2024
bca31da
1.1 actions cleanup
pcowgill Jun 21, 2024
bcd6a69
Merge pull request #393 from Once-Upon/prerelease/1.1.0-2
pcowgill Jun 21, 2024
15da35c
Merge branch 'main' into 1.1
pcowgill Jul 3, 2024
5145ccc
1.1.0-3
pcowgill Jul 3, 2024
21295f8
Fix type errors
pcowgill Jul 3, 2024
f8ca81b
Merge branch 'main' into 1.1
pcowgill Jul 25, 2024
fabe04a
1.1.0-4
pcowgill Jul 25, 2024
bfd49a4
Merge pull request #405 from Once-Upon/release/1.1.0-4
pcowgill Jul 25, 2024
7a7ed9a
1.1.0-5
pcowgill Jul 25, 2024
695b255
Merge pull request #406 from Once-Upon/release/1.1.0-5
pcowgill Jul 25, 2024
49bdd7a
Merge branch 'main' into 1.1
pcowgill Jul 31, 2024
bb2d074
npm i
pcowgill Jul 31, 2024
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
50 changes: 50 additions & 0 deletions codemods/0001_add_actions_array.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { JSCodeshift } from 'jscodeshift';

module.exports = function (fileInfo, api) {
const j: JSCodeshift = api.jscodeshift;
const root = j(fileInfo.source);

const findTransactionContextVariableId = (path) => {
const firstVariableId = path.value.right.properties
.find((property) => property.key.name === 'variables')
.value.properties?.find((property2) => {
return property2.value?.properties?.some(
(property3) => property3.key.name === 'id',
);
});

return firstVariableId
? firstVariableId.value.properties.find((p) => p.key.name === 'id')?.value
: null;
};

root
.find(j.AssignmentExpression, {
left: {
object: { name: 'transaction' },
property: { name: 'context' },
},
})
.forEach((path) => {
const t = findTransactionContextVariableId(path);
const newValue = t
? t.type === 'MemberExpression'
? j.memberExpression(t.object, t.property)
: j.templateLiteral(
t.quasis.map((q) => j.templateElement(q.value, q.tail)),
t.expressions.map((e) =>
j.memberExpression(e.object, e.property),
),
)
: null;
if (newValue) {
const actionsPropertyAssignment = j.objectProperty(
j.identifier('actions'),
j.arrayExpression([newValue]),
);
path.value.right['properties'].unshift(actionsPropertyAssignment);
}
});

return root.toSource();
};
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@once-upon/evm-context",
"version": "1.0.48",
"version": "1.1.0-5",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
8 changes: 8 additions & 0 deletions src/contextualizers/bridges/acrossProtocol/destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Transaction,
HeuristicContextActionEnum,
Log,
HeuristicPrefix,
} from '../../../types';
import {
ACROSS_PROTOCOL_RELAYER_ABI,
Expand Down Expand Up @@ -73,13 +74,19 @@ export function generate(transaction: Transaction): Transaction {
const chainId = Number(filledRelayEvent.args['originChainId'] as bigint);
const amount = formatEther(filledRelayEvent.args['amount'] as bigint);
transaction.context = {
actions: [
HeuristicContextActionEnum.BRIDGED,
`${HeuristicPrefix}.${HeuristicContextActionEnum.BRIDGED}`,
],

summaries: {
category: 'MULTICHAIN',
en: {
title: `Bridge`,
default: '[[subject]][[bridged]][[amount]]from[[originChainId]]',
},
},

variables: {
subject: {
type: 'address',
Expand All @@ -96,6 +103,7 @@ export function generate(transaction: Transaction): Transaction {
},
bridged: {
type: 'contextAction',
id: HeuristicContextActionEnum.BRIDGED,
value: HeuristicContextActionEnum.BRIDGED,
},
},
Expand Down
8 changes: 8 additions & 0 deletions src/contextualizers/bridges/acrossProtocol/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Transaction,
HeuristicContextActionEnum,
Log,
HeuristicPrefix,
} from '../../../types';
import {
ACROSS_PROTOCOL_RELAYER_ABI,
Expand Down Expand Up @@ -75,13 +76,19 @@ export function generate(transaction: Transaction): Transaction {
);
const amount = formatEther(fundsDepositedEvent.args['amount'] as bigint);
transaction.context = {
actions: [
HeuristicContextActionEnum.BRIDGED,
`${HeuristicPrefix}.${HeuristicContextActionEnum.BRIDGED}`,
],

summaries: {
category: 'MULTICHAIN',
en: {
title: `Bridge`,
default: '[[subject]][[bridged]][[amount]]to[[chainID]]',
},
},

variables: {
subject: {
type: 'address',
Expand All @@ -98,6 +105,7 @@ export function generate(transaction: Transaction): Transaction {
},
bridged: {
type: 'contextAction',
id: HeuristicContextActionEnum.BRIDGED,
value: HeuristicContextActionEnum.BRIDGED,
},
},
Expand Down
8 changes: 8 additions & 0 deletions src/contextualizers/bridges/degen/destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ContextSummaryVariableType,
HeuristicContextActionEnum,
AssetTransfer,
HeuristicPrefix,
} from '../../../types';
import { DEGEN_BRIDGES } from './constants';

Expand Down Expand Up @@ -85,6 +86,11 @@ export function generate(transaction: Transaction): Transaction {
}

transaction.context = {
actions: [
HeuristicContextActionEnum.BRIDGED,
`${HeuristicPrefix}.${HeuristicContextActionEnum.BRIDGED}`,
],

summaries: {
category: 'MULTICHAIN',
en: {
Expand All @@ -93,6 +99,7 @@ export function generate(transaction: Transaction): Transaction {
'[[person]][[bridged]]via[[address]]and[[asset]]was transferred',
},
},

variables: {
person: {
type: 'address',
Expand All @@ -105,6 +112,7 @@ export function generate(transaction: Transaction): Transaction {
asset,
bridged: {
type: 'contextAction',
id: HeuristicContextActionEnum.BRIDGED,
value: HeuristicContextActionEnum.BRIDGED,
},
},
Expand Down
8 changes: 8 additions & 0 deletions src/contextualizers/bridges/degen/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ContextETHType,
AssetTransfer,
ContextSummaryVariableType,
HeuristicPrefix,
} from '../../../types';
import { DEGEN_BRIDGES } from './constants';

Expand Down Expand Up @@ -88,6 +89,11 @@ export function generate(transaction: Transaction): Transaction {
}

transaction.context = {
actions: [
HeuristicContextActionEnum.BRIDGED,
`${HeuristicPrefix}.${HeuristicContextActionEnum.BRIDGED}`,
],

summaries: {
category: 'MULTICHAIN',
en: {
Expand All @@ -96,6 +102,7 @@ export function generate(transaction: Transaction): Transaction {
'[[person]][[bridged]]via[[address]]and[[asset]]was transferred',
},
},

variables: {
person: {
type: 'address',
Expand All @@ -108,6 +115,7 @@ export function generate(transaction: Transaction): Transaction {
asset,
bridged: {
type: 'contextAction',
id: HeuristicContextActionEnum.BRIDGED,
value: HeuristicContextActionEnum.BRIDGED,
},
},
Expand Down
8 changes: 8 additions & 0 deletions src/contextualizers/bridges/hopTransferToL1/destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
AssetType,
EventLogTopics,
HeuristicContextActionEnum,
HeuristicPrefix,
Transaction,
} from '../../../types';
import { HOP_WITHDRAWAL_BONDED_EVENT_ABI, HOP_RELAYERS } from './constants';
Expand Down Expand Up @@ -74,13 +75,19 @@ export function generate(transaction: Transaction): Transaction {
);

transaction.context = {
actions: [
HeuristicContextActionEnum.BRIDGED,
`${HeuristicPrefix}.${HeuristicContextActionEnum.BRIDGED}`,
],

summaries: {
category: 'MULTICHAIN',
en: {
title: `Bridge`,
default: '[[subject]][[bridged]][[amount]]from[[chainID]]',
},
},

variables: {
subject: {
type: 'address',
Expand All @@ -97,6 +104,7 @@ export function generate(transaction: Transaction): Transaction {
},
bridged: {
type: 'contextAction',
id: HeuristicContextActionEnum.BRIDGED,
value: HeuristicContextActionEnum.BRIDGED,
},
},
Expand Down
8 changes: 8 additions & 0 deletions src/contextualizers/bridges/hopTransferToL1/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
AssetType,
EventLogTopics,
HeuristicContextActionEnum,
HeuristicPrefix,
Transaction,
} from '../../../types';
import { HOP_TRANSFER_SENT_EVENT_ABI, HOP_RELAYERS } from './constants';
Expand Down Expand Up @@ -70,13 +71,19 @@ export function generate(transaction: Transaction): Transaction {
const amount = formatEther(decodedTransferSentLog.args['amount'] as bigint);

transaction.context = {
actions: [
HeuristicContextActionEnum.BRIDGED,
`${HeuristicPrefix}.${HeuristicContextActionEnum.BRIDGED}`,
],

summaries: {
category: 'MULTICHAIN',
en: {
title: `Bridge`,
default: '[[subject]][[bridged]][[amount]]to[[chainID]]',
},
},

variables: {
subject: {
type: 'address',
Expand All @@ -93,6 +100,7 @@ export function generate(transaction: Transaction): Transaction {
},
bridged: {
type: 'contextAction',
id: HeuristicContextActionEnum.BRIDGED,
value: HeuristicContextActionEnum.BRIDGED,
},
},
Expand Down
8 changes: 8 additions & 0 deletions src/contextualizers/bridges/hopTransferToL2/destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
AssetType,
EventLogTopics,
HeuristicContextActionEnum,
HeuristicPrefix,
Transaction,
} from '../../../types';
import {
Expand Down Expand Up @@ -77,13 +78,19 @@ export function generate(transaction: Transaction): Transaction {
);

transaction.context = {
actions: [
HeuristicContextActionEnum.BRIDGED,
`${HeuristicPrefix}.${HeuristicContextActionEnum.BRIDGED}`,
],

summaries: {
category: 'MULTICHAIN',
en: {
title: `Bridge`,
default: '[[subject]][[bridged]][[amount]]from[[chainID]]',
},
},

variables: {
subject: {
type: 'address',
Expand All @@ -100,6 +107,7 @@ export function generate(transaction: Transaction): Transaction {
},
bridged: {
type: 'contextAction',
id: HeuristicContextActionEnum.BRIDGED,
value: HeuristicContextActionEnum.BRIDGED,
},
},
Expand Down
8 changes: 8 additions & 0 deletions src/contextualizers/bridges/hopTransferToL2/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
AssetType,
EventLogTopics,
HeuristicContextActionEnum,
HeuristicPrefix,
Transaction,
} from '../../../types';
import { HOP_TRANSFER_SENT_TO_L2_EVENT_ABI, HOP_RELAYERS } from './constants';
Expand Down Expand Up @@ -73,6 +74,11 @@ export function generate(transaction: Transaction): Transaction {
decodedTransferSentToL2Log.args['amount'] as bigint,
);
transaction.context = {
actions: [
HeuristicContextActionEnum.BRIDGED,
`${HeuristicPrefix}.${HeuristicContextActionEnum.BRIDGED}`,
],

variables: {
subject: {
type: 'address',
Expand All @@ -89,9 +95,11 @@ export function generate(transaction: Transaction): Transaction {
},
bridged: {
type: 'contextAction',
id: HeuristicContextActionEnum.BRIDGED,
value: HeuristicContextActionEnum.BRIDGED,
},
},

summaries: {
category: 'MULTICHAIN',
en: {
Expand Down
8 changes: 8 additions & 0 deletions src/contextualizers/bridges/opStack/destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ContextERC1155Type,
AssetTransfer,
HeuristicContextActionEnum,
HeuristicPrefix,
} from '../../../types';

export function contextualize(transaction: Transaction): Transaction {
Expand Down Expand Up @@ -73,13 +74,19 @@ export function generate(transaction: Transaction): Transaction {

// TODO; not sure why we didn't set context here for optimism
transaction.context = {
actions: [
HeuristicContextActionEnum.BRIDGED,
`${HeuristicPrefix}.${HeuristicContextActionEnum.BRIDGED}`,
],

summaries: {
category: 'MULTICHAIN',
en: {
title: `Bridge`,
default: '[[sender]][[bridged]][[asset]]from[[chainID]]',
},
},

variables: {
sender: {
type: 'address',
Expand All @@ -91,6 +98,7 @@ export function generate(transaction: Transaction): Transaction {
},
bridged: {
type: 'contextAction',
id: HeuristicContextActionEnum.BRIDGED,
value: HeuristicContextActionEnum.BRIDGED,
},
asset,
Expand Down
Loading
Loading